Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
27
Task/Partition-function-P/11l/partition-function-p.11l
Normal file
27
Task/Partition-function-P/11l/partition-function-p.11l
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
F partitions(n)
|
||||
V p = [BigInt(1)] [+] [BigInt(0)] * n
|
||||
L(i) 1 .. n
|
||||
V k = 0
|
||||
L
|
||||
k++
|
||||
V j = (k * (3 * k - 1)) I/ 2
|
||||
I j > i
|
||||
L.break
|
||||
I k [&] 1
|
||||
p[i] += p[i - j]
|
||||
E
|
||||
p[i] -= p[i - j]
|
||||
j = (k * (3 * k + 1)) I/ 2
|
||||
I j > i
|
||||
L.break
|
||||
I k [&] 1
|
||||
p[i] += p[i - j]
|
||||
E
|
||||
p[i] -= p[i - j]
|
||||
R p[n]
|
||||
|
||||
print(‘Partitions: ’(0.<15).map(x -> partitions(x)))
|
||||
|
||||
V start = time:perf_counter()
|
||||
print(partitions(6666))
|
||||
print(time:perf_counter() - start)
|
||||
Loading…
Add table
Add a link
Reference in a new issue