Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- filtered=[]
- for num in range(168630, 718099):
- counter = 0
- last = None
- pair_detected = False
- smaller_than = False
- for digit in str(num):
- if last is not None:
- if digit < last:
- smaller_than = True
- elif digit == last:
- if not pair_detected:
- counter += 1
- if counter == 2:
- pair_detected = True
- else:
- counter += 1
- if counter >= 3:
- pair_detected = False
- else:
- last = digit
- counter = 1
- else:
- last = digit
- counter = 1
- if not smaller_than and pair_detected:
- filtered.append(num)
- print(len(filtered))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement