-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprob_38.py
More file actions
39 lines (32 loc) · 763 Bytes
/
Copy pathprob_38.py
File metadata and controls
39 lines (32 loc) · 763 Bytes
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 13 12:45:45 2017
@author: fun
"""
from timeit import default_timer as timer
start = timer()
def panDigital(n):
string = str(n)
kuch = True
for i in range(1,10):
if str(i) not in string:
kuch = False
return kuch
a= []
for i in range (1,100000):
sum = ''
for j in range(1,10):
string = str(i*j)
sum = sum + string
if len(sum) == 9:
if panDigital(int(sum)):
a.append(int(sum))
elif len(sum) >9:
break;
else:
pass
end = timer()
time_taken = (end-start)*1000
print(max(a))
print("Total time taken to run this program %d ms"%time_taken)