Partition function P: Difference between revisions

(Realize in F#)
Line 562:
 
 
=={{header|Picat}}==
<lang picat>
table
partition1(0) = 1.
partition1(N) = P =>
S = 0,
K = 1,
M = (K*(3*K-1)) // 2,
while (M <= N)
S := S - ((-1)**K)*partition1(N-M),
K := K + 1,
M := (K*(3*K-1)) // 2
end,
K := 1,
M := (K*(3*K+1)) // 2,
while (M <= N)
S := S - ((-1)**K)*partition1(N-M),
K := K + 1,
M := (K*(3*K+1)) // 2
end,
P = S.
 
Picat> time(println('p(6666)'=partition1(6666)))
p(6666) = 193655306161707661080005073394486091998480950338405932486880600467114423441282418165863
 
CPU time 0.206 seconds.
</lang>
=={{header|Prolog}}==
<lang prolog>
Line 580 ⟶ 607:
05932486880600467114423441282418165863.
</lang>
 
=={{header|Python}}==
===Python: Mathloger===
18

edits