Jump to content

Multifactorial: Difference between revisions

no edit summary
No edit summary
Line 503:
8: 1 2 3 4 5 6 7 8 9 20
9: 1 2 3 4 5 6 7 8 9 10
10: 1 2 3 4 5 6 7 8 9 10</pre>
 
</pre>
=={{header|Crystal}}==
{{trans|Ruby}}
<lang ruby>def multifact(n, d)
n.step(to: 1, by: -d).product
end
 
(1..5).each {|d| puts "Degree #{d}: #{(1..10).map{|n| multifact(n, d)}.join "\t"}"}</lang>
'''output'''
<pre style="overflow:scroll">
Degree 1: 1 2 6 24 120 720 5040 40320 362880 3628800
Degree 2: 1 2 3 8 15 48 105 384 945 3840
Degree 3: 1 2 3 4 10 18 28 80 162 280
Degree 4: 1 2 3 4 5 12 21 32 45 120
Degree 5: 1 2 3 4 5 6 14 24 36 50</pre>
 
=={{header|D}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.