Project Euler 119 - Digit Power Sum
Project Euler 119 - Digit Power Sum
Official link: https://projecteuler.net/problem=119
Thought Process
Thought Process
There were 2 thought processes for me:
Go through numbers, check if the sum of the digits of the number to the power of an integer is the same number
Go through some numbers, raise them all to the power of 2 through 50 (or some big number), and see if the sum of this is equal to the number
Way 2 is much much faster! See here for Sum of Digits Function
I set up a function which only stopped when 50 numbers of the given condition were found to be sure that I wouldnt accidentally skip over the 30th number
Interactive Code
Interactive Code
Enter a number (yourinput)
Code will output the a(yourinput)