Numbers which are the cube roots of the product of their proper divisors: Difference between revisions
Content added Content deleted
(Added C) |
(→{{header|Ruby}}: Add Ruby) |
||
Line 1,153: | Line 1,153: | ||
Fifty thousandth: 223,735</pre> |
Fifty thousandth: 223,735</pre> |
||
=={{header|Ruby}}== |
|||
<syntaxhighlight lang="ruby" line>require 'prime' |
|||
def tau(n) = n.prime_division.inject(1){|res, (d, exp)| res *= exp+1} |
|||
a111398 = [1].chain (1..).lazy.select{|n| tau(n) == 8} |
|||
puts "The first 50 numbers which are the cube roots of the products of their proper divisors:" |
|||
p a111398.first(50) |
|||
[500, 5000, 50000].each{|n| puts "#{n}th: #{a111398.drop(n-1).next}" } |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre>The first 50 numbers which are the cube roots of the products of their proper divisors: |
|||
[1, 24, 30, 40, 42, 54, 56, 66, 70, 78, 88, 102, 104, 105, 110, 114, 128, 130, 135, 136, 138, 152, 154, 165, 170, 174, 182, 184, 186, 189, 190, 195, 222, 230, 231, 232, 238, 246, 248, 250, 255, 258, 266, 273, 282, 285, 286, 290, 296, 297] |
|||
500th: 2526 |
|||
5000th: 23118 |
|||
50000th: 223735 |
|||
</pre> |
|||
=={{header|Wren}}== |
=={{header|Wren}}== |