Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def toOct(n):
- tempStr = ""
- while n > 0:
- tempStr += str(n % 8)
- n //= 8
- outStr = tempStr[::-1]
- return outStr
- def checkNumber(strNumber):
- for i in range(0, 10):
- if strNumber.count(str(i)):
- return False
- for i in range(0, len(strNumber) - 3):
- if int(strNumber[i]) % 2 == 0 and int(strNumber[i + 1]) % 2 == 0 and int(strNumber[i + 2]) % 2 == 1 and int(strNumber[i + 3]) % 2 == 1:
- return False
- if int(strNumber[i]) % 2 == 1 and int(strNumber[i + 1]) % 2 == 1 and int(strNumber[i + 2]) % 2 == 0 and int(strNumber[i + 3]) % 2 == 0:
- return False
- #print(toOct(999999))
- score = 0
- for i in range(262144, 2097151):
- if checkNumber(toOct(i)):
- score += 1
- print(score)
Add Comment
Please, Sign In to add comment