From Project Euler:
215 = 32,768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
What is the sum of the digits of the number 21000?
This is another one of those problems that Ruby makes so easy by having a built-in arbitrary precision integer. Also, remember that back in problem 8 we created a method on
Integer that will return an array with the digits of an integer. Putting these two elements together, we come to the very simple solution: