Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = 3 * 7**3 + 2*3* 7**2 + 6* 3**2 *7 + 6*7 * 3**2 + 6 * 7**2 * 3
- #print(n)
- #2961
- ok = set()
- v = list(range(8))
- for a1 in v:
- for a2 in v:
- for a3 in v:
- for a4 in v:
- for a5 in v:
- s = str(a1) + str(a2) + str(a3) + str(a4) + str(a5)
- if s[0] == '0':
- continue
- if s.count('6') != 1:
- continue
- if s[0] == '6' and int(s[1]) % 2 == 1:
- continue
- if s[-1] == '6' and int(s[-2]) % 2 == 1:
- continue
- if s[0] == '6':
- ok.add(s)
- continue
- if s[-1] == '6':
- ok.add(s)
- continue
- i = s.find('6')
- if int(s[i-1]) % 2 == 1 or int(s[i+1]) % 2==1:
- continue
- ok.add(s)
- print(len(ok))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement