Skip to content

Instantly share code, notes, and snippets.

@Taminiora
Created December 4, 2019 05:24
Show Gist options
  • Save Taminiora/08a9e1d101dcd578a404586f96d620e0 to your computer and use it in GitHub Desktop.
Save Taminiora/08a9e1d101dcd578a404586f96d620e0 to your computer and use it in GitHub Desktop.
s = 136818
t = 685979
def short():
tot = 0
for i in range(s, t):
x = str(i)
f = False
if x != ''.join(sorted(x)):
continue
for j in range(len(x)-1):
if x[j] == x[j+1]:
tot+=1
break
return tot
def long_pr():
tot = 0
for i in range(s, t):
x = str(i)
f = False
if x != ''.join(sorted(x)):
continue
for j in range(len(x)-1):
if x[j] == x[j+1]:
if (j==0 or x[j-1] != x[j]) and (j==len(x)-2 or x[j+2] != x[j]):
tot+=1
break
return tot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment