Skip to content

Commit c787a22

Browse files
author
Thejus-Paul
committed
Problem 16 Added
Solution to the Problem 16 has been added.
1 parent 0f78cd6 commit c787a22

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

Diff for: Project Euler/Problem 16/sol1.py

+15
Original file line numberDiff line numberDiff line change
@@ -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)

Diff for: Project Euler/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,6 @@ PROBLEMS:
4949
Using the rule above and starting with 13, we generate the following sequence:
5050
13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1
5151
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

Comments
 (0)