Aaron D. Gifford wrote in post #1034519:
>
> irb(main):001:0> s="2011";s.sum%(48*s.size)
> => 4
>
> And to verify worst-case a string of 1149 nine digits:
>
> irb(main):002:0> s="9"*1149;s.sum%(48*s.size)
> => 10341
>
> For longer strings, pass an argument to String#sum bigger than the
> default 16.
>
Very good, Aaron.  Now, is there any way to replace that "s.size" with
something to make it really a one-liner (without the semicolon):
    "some number".sum%(48 times something)
?

Regards,

Bill

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