def solve(N): max_digit_sum = 0 for a in range(1, N): n = 1 for b in range(1, N): n *= a max_digit_sum = max(max_digit_sum, sum_of_digits(n)) return max_digit_sum
"""Find the sum of the digits in the number 100!""" from number import sum_of_digits, factorial if __name__ == '__main__': n = 100 result = sum_of_digits(factorial(n)) print("The sum of the digits in the number %(n)d! is %(result)d" % vars())
def solve(n): cfe = create_e_continuous_fraction(n) return sum_of_digits(cfe.to_fraction(n).numerator)
"""What is the sum of the digits of the number 2^1000""" from number import sum_of_digits if __name__ == '__main__': exp = 1000 result = sum_of_digits(2**exp) print("The sum of the digits of 2^%(exp)d is %(result)d" % vars())