If the number of digits is less than five, how about this one for Ruby Golf ;-) "2011".sum(48)%48 Regards, Bill -- Posted via http://www.ruby-forum.com/.