2010-07-09 10:35:54 +02:00
|
|
|
const n:int = 43
|
|
|
|
|
|
|
|
node f(a:int^n; i:int) returns (o:int^n; m:int)
|
|
|
|
let
|
|
|
|
m = a.[i] default 0;
|
|
|
|
o = i^n;
|
|
|
|
tel
|
|
|
|
|
|
|
|
node sumdup (a, acc_in:int) returns (o:int; acc_out:int)
|
|
|
|
let
|
2011-05-23 14:04:11 +02:00
|
|
|
acc_out = acc_in + a;
|
|
|
|
o = acc_out;
|
2010-07-09 10:35:54 +02:00
|
|
|
tel
|
|
|
|
|
|
|
|
node p(a:int^n) returns (o:int^n)
|
|
|
|
var acc:int;
|
|
|
|
let
|
2011-05-23 14:04:11 +02:00
|
|
|
(o, acc) = mapfold<<n>> sumdup (a, 0);
|
2010-07-09 10:35:54 +02:00
|
|
|
tel
|
2012-07-16 18:49:08 +02:00
|
|
|
|
|
|
|
node main() returns (o:int^n)
|
|
|
|
var last t:int^n = 1^n;
|
|
|
|
let
|
|
|
|
automaton
|
|
|
|
state Prepare
|
|
|
|
var i,x1,x2:int;
|
|
|
|
do
|
|
|
|
i = 0 fby i + 1;
|
|
|
|
x1 = (last t).[i-2] default 0;
|
|
|
|
x2 = (last t).[i-1] default 1;
|
|
|
|
t = [ (last t) with [i] = x1 + x2 ];
|
|
|
|
o = p(t);
|
|
|
|
until i = 43 then Compute
|
|
|
|
state Compute
|
|
|
|
var i,j:int;
|
|
|
|
do
|
|
|
|
i = 0 fby if i > 43 then 0 else i + 1;
|
|
|
|
j = 0 fby if j > 1031 then 0 else j + 1;
|
|
|
|
o = p([ t with [i] = j ]);
|
|
|
|
end
|
|
|
|
tel
|