Skip to content

Instantly share code, notes, and snippets.

View michaelsoltys's full-sized avatar

Michael Soltys michaelsoltys

View GitHub Profile
@michaelsoltys
michaelsoltys / number-powers.py
Created October 20, 2023 20:18
Sum of powers of digits
import math
# replace 999999999 with upper limit of your choice
for i in range(1, 999999999):
i_as_string = str(i)
i_as_list = []
j = 1
output = 0
for digits in i_as_string:
output += pow(int(digits),j)
def fib(n):
if n == 0:
return 0
elif n == 1:
return 1
else:
return fib(n-1) + fib(n-2)
print(fib(10))