This commit is contained in:
Ben Charlton 2019-12-06 13:03:45 +00:00
parent b2608af813
commit c41a4c2037
2 changed files with 46 additions and 0 deletions

27
4/4-2.py Executable file
View file

@ -0,0 +1,27 @@
#!/usr/bin/env python3
import sys
start = 125730
end = 579381
for x in range(start, end+1):
s = str(x)
fail=False
double=False
matchcount = 1
for n in range(0,5):
if s[n] > s[n+1]:
fail = True
break
if s[n] == s[n+1]:
matchcount += 1
else:
if matchcount == 2:
double = True
matchcount = 1
if matchcount == 2:
double = True
if double and not fail:
print(x)

19
4/4.py Executable file
View file

@ -0,0 +1,19 @@
#!/usr/bin/env python3
import sys
start = 125730
end = 579381
for x in range(start, end+1):
s = str(x)
fail=False
double=False
for n in range(0,5):
if s[n] > s[n+1]:
fail = True
break
if s[n] == s[n+1]:
double = True
if double and not fail:
print(x)