Triangular numbers: Difference between revisions

m
(julia example)
Line 81:
polytopic(r, range) = map(n -> binomial(n + r - 1, r), range)
 
triangular_root(x) = (sqrt(8x + 1) - 1) / 2
 
function tetrahedral_root(x)
Line 100:
 
for n in [7140, 21408696, 26728085384, 14545501785001]
println("\nRoots of $n:")
println(" triangular-root: ", triangular_root(n))
println(" tetrahedral-root: ", tetrahedral_root(n))
println(" pentatopic-root: ", pentatopic_root(n))
end
</syntaxhighlight>{{out}}
4,102

edits