We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0f78cd6 commit c787a22Copy full SHA for c787a22
Project Euler/Problem 16/sol1.py
@@ -0,0 +1,15 @@
1
+power = int(input("Enter the power of 2: "))
2
+num = 2**power
3
+
4
+string_num = str(num)
5
6
+list_num = list(string_num)
7
8
+sum_of_num = 0
9
10
+print("2 ^",power,"=",num)
11
12
+for i in list_num:
13
+ sum_of_num += int(i)
14
15
+print("Sum of the digits are:",sum_of_num)
Project Euler/README.md
@@ -49,3 +49,6 @@ PROBLEMS:
49
Using the rule above and starting with 13, we generate the following sequence:
50
13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1
51
Which starting number, under one million, produces the longest chain?
52
53
+16. 2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
54
+ What is the sum of the digits of the number 2^1000?
0 commit comments