Hi -- On Sat, 2 Aug 2008, Todd Benson wrote: > On Thu, Jul 31, 2008 at 5:06 AM, Web Reservoir <webreservoir / gmail.com> wrote: >> Hi, >> >> I am planning to implement a Numerology code like this. >> >> Every alphabet in Numerology is given a number like this... >> >> -------------------------------------------------------------- >> 1 2 3 4 5 6 7 8 9 >> >> A B C D E F G H I >> >> J K L M N O P Q R >> >> S T U V W X Y Z >> ---------------------------------------------------------- >> >> Or you can even say that >> >> 1 = A, J, S >> 2 = B, K, T >> 3 = C, L, U >> 4 = D, M, V >> 5 = E, N, W >> 6 = F, O, X >> 7 = G, P, Y >> 8 = H, Q, Z >> 9 = I, R >> >> Now when you type RUBY you should get the total as 9+3+2+7 = (21) 2+1 = >> 3 >> where R = 9, U = 3, B = 2 and y = 7 ( as shown above ) > > golfing solution... > > 'HELLO'.unpack('C*').inject(0){|s, b|s+(b-65)%9} I get 20 for that, but every result should be a single digit. David -- Rails training from David A. Black and Ruby Power and Light: * Advancing With Rails August 18-21 Edison, NJ * Co-taught by D.A. Black and Erik Kastner See http://www.rubypal.com for details and updates!