Anonymous user
Digital root/Multiplicative digital root: Difference between revisions
Digital root/Multiplicative digital root (view source)
Revision as of 00:59, 2 September 2014
, 9 years ago→{{header|Ruby}}
Line 1,111:
=={{header|Ruby}}==
<lang ruby>def
until
persist += 1
end
[
end
puts "
[123321, 7739, 893, 899998].each{|n| puts "
counter = Hash.new{|h,k| h[k]=[]}
0.step do |i|
counter[
break if counter.values.all?{|v| v.size >= 5 }
end
puts "", "MDR: [n0..n4]", "=== ========"
10.times{|i| puts "%3d: %p" % [i, counter[i].first(5)]}</lang>
{{out}}
<pre>
Number: MDR MP
899998: 0 2
MDR: [n0..n4]
=== ========
8: [8, 18, 24, 29, 36]
9: [9, 19, 33, 91, 119]
</pre>
=={{header|Scala}}==
|