016 Power digit sum.sf 315 B

123456789101112131415
  1. #!/usr/bin/ruby
  2. # Author: Daniel "Trizen" Șuteu
  3. # License: GPLv3
  4. # Website: https://github.com/trizen
  5. # 2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
  6. # What is the sum of the digits of the number 2^1000?
  7. # https://projecteuler.net/problem=16
  8. # Runtime: 0.147s
  9. say (2**1000 -> digits.sum);