Triangular numbers: Difference between revisions
m
→{{header|Raku}}: Math::Root now includes the r-simplex root routines
(→{{header|jq}}: cbrt) |
Thundergnat (talk | contribs) m (→{{header|Raku}}: Math::Root now includes the r-simplex root routines) |
||
Line 1,170:
=={{header|Raku}}==
<syntaxhighlight lang="raku" line>use Math::Root:ver<0.0.4>;
my \ε = FatRat.new: 1, 10**24;▼
sub binomial { [×] ($^n … 0) Z/ 1 .. $^p }
sub polytopic (Int $r, @range) { @range.map: { binomial $_ + $r - 1, $r } }
sub display (@values) {
Line 1,196 ⟶ 1,185:
say '';
▲my \ε = FatRat.new: 1, 10**24;
for 7140, 21408696, 26728085384, 14545501785001 {
say qq:to/R/;
Roots of $_:
triangular-root: {.&triangular-root.round: ε}
tetrahedral-root: {.&tetrahedral-root.round: ε}
pentatopic-root: {.&pentatopic-root.round: ε}
R
}</syntaxhighlight>
|