Combinations with repetitions/Square digit chain: Difference between revisions

(Created page with "{{draft task}} Iterated digits squaring introduces RC the Project Euler Task #92. Combinations with repetitions introduce RC to the concept of generating all the combi...")
 
Line 23:
end
return res==89?0:res
#An array: N[n]==01 means that n translates to1, 89 and 10 means that nit translatesdoes to 1not. }
N = (G=Array.new(D*81+1){|n| n==0? 1:(i=g.call(n))==89 ? 0:i}).collect{|n| while n>1 do n = G[n] end; n }
 
2,171

edits