Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
18
Task/Partition-function-P/PicoLisp/partition-function-p.l
Normal file
18
Task/Partition-function-P/PicoLisp/partition-function-p.l
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
(de gpentagonals (Max)
|
||||
(make
|
||||
(let (N 0 M 1)
|
||||
(loop
|
||||
(inc 'N (if (=0 (& M 1)) (>> 1 M) M))
|
||||
(T (> N Max))
|
||||
(link N)
|
||||
(inc 'M)))))
|
||||
|
||||
(de p (N)
|
||||
(cache '(NIL) N
|
||||
(if (=0 N)
|
||||
1
|
||||
(let (Sum 0 Sgn 0)
|
||||
(for G (gpentagonals N)
|
||||
((if (< Sgn 2) 'inc 'dec) 'Sum (p (- N G)))
|
||||
(setq Sgn (& 3 (inc Sgn))))
|
||||
Sum))))
|
||||
Loading…
Add table
Add a link
Reference in a new issue