Victor qwerty wrote:
> x = 5 ** 500
> 
> x.to_s.scan(/./)

The value of this expression is an array, but you don't assign it to 
anything, so it is lost. Try:

digits = x.to_s.scan(/./)

> 
> y = 0
> 
> x.each do |i|

digits.each do |i|

>   i.to_i

That again does nothing - it converts i to an integer, but the resulting 
value is discarded.

>   y += i

You probably meant:

    val = i.to_i
    y += val

or more simply,

    y += i.to_i

> 
> end
> 
> puts y

-- 
Posted via http://www.ruby-forum.com/.