Partition function P: Difference between revisions
m
→{{header|Wren}}: Minor tidy
(→{{header|jq}}: gojq) |
m (→{{header|Wren}}: Minor tidy) |
||
(3 intermediate revisions by one other user not shown) | |||
Line 3:
The [https://mathworld.wolfram.com/PartitionFunctionP.html Partition Function P]
Line 15:
The successive numbers in the above equation have the differences: 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8 ...
This task may be of popular interest because [https://www.youtube.com/channel/UC1_uAIS3r8Vu6JjXWvastJg Mathologer] made the video, [https://www.youtube.com/watch?v=iJ8pnCO0nTY The hardest "What comes next?" (Euler's pentagonal formula)], where he asks the programmers among his viewers to calculate P(666). The video
In Wolfram Language, this function has been implemented as PartitionsP.
Line 906:
<pre>[1,2,3,5,7,11,15,22,30,42,56,77,101,135]</pre>
Using gojq 0.12.11, `partitions(6666)` yields (in about 12 minutes (u+s) on a 3GHz machine):
193655306161707661080005073394486091998480950338405932486880600467114423441282418165863
Line 917:
"193655306161707661080005073394486091998480950338405932486880600467114423441282418165863"
=== Recursive ===
{{trans|Julia}} with memoization
<syntaxhighlight lang="jq">def partDiffDiff($n):
Line 1,791:
{{libheader|Wren-big}}
Although it may not look like it, this is actually a decent time for Wren which is interpreted and the above module is written entirely in Wren itself.
<syntaxhighlight lang="
var p = []
|