-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path024.py
More file actions
31 lines (29 loc) · 719 Bytes
/
024.py
File metadata and controls
31 lines (29 loc) · 719 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
#this took approx 1h
#
#should try this next:
# http://en.wikipedia.org/wiki/Permutation#Generation_in_lexicographic_order
#items starting with zero
st=123456789
end=9876543210
position=0
zeros=0
while st<=end:
s=str(st)
if st==1000000000:
zeros=1
if s.count('1')==1 \
and s.count('2')==1 \
and s.count('3')==1 \
and s.count('4')==1 \
and s.count('5')==1 \
and s.count('6')==1 \
and s.count('7')==1 \
and s.count('8')==1 \
and s.count('9')==1 \
and s.count('0')==zeros:
position += 1
print position, st
if position==1000000:
print st
break
st+=1