mirror of
https://github.com/Alexander-D-Karpov/scripts.git
synced 2024-11-25 13:03:44 +03:00
26 lines
499 B
Python
26 lines
499 B
Python
def to_6(n):
|
|
s = ""
|
|
while n:
|
|
s += str(n % 6)
|
|
n //= 6
|
|
return s[::-1]
|
|
|
|
|
|
c = 0
|
|
ch = "02468"
|
|
|
|
for i in range(100000, 1000000):
|
|
s = to_6(i)
|
|
if s.count("2") == 1:
|
|
ind = s.index("2")
|
|
if ind == 0:
|
|
if s[1] in ch:
|
|
c += 1
|
|
elif ind == len(s) - 1:
|
|
if s[-2] in ch:
|
|
c += 1
|
|
else:
|
|
if s[ind - 1] in ch and s[ind + 1] in ch:
|
|
c += 1
|
|
print(c)
|