-
Notifications
You must be signed in to change notification settings - Fork 0
/
Mulpre.py
39 lines (36 loc) · 849 Bytes
/
Mulpre.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import time
op = 'y'
while(op.upper()=='Y'):
a = input("\nNum:")
start_time = time.time()
i = 0
while(int(a) % 10 !=int(a)):
ans = 1
i=i+1
for x in str(a):
ans = ans * int(x)
a = ans
print(ans, end="\n")
print("Multiplicative Persistence = ",i, end='\n')
print(time.time()-start_time);
op = input("Continue?(Y/N)")
# start_time=time.time()
# num=0
# i = 0
# while(num<10000000000000000 or i==4):
# a = num
# print(num,end="\n")
# i=0
# while(int(a) % 10 !=int(a)):
# ans = 1
# for x in str(a):
# ans = ans * int(x)
# a = ans
# i=i+1
# # print(ans, end="\n")
# num = num+1
#
# print("Multiplicative Persistence = ",i, end='\n')
# if(i==9):
# break
# print(time.time()-start_time)