Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
26
Task/Partition-function-P/Picat/partition-function-p.picat
Normal file
26
Task/Partition-function-P/Picat/partition-function-p.picat
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/* Picat 3.0#5 */
|
||||
/* Author: Hakan Kjellerstrand */
|
||||
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.
|
||||
Loading…
Add table
Add a link
Reference in a new issue