24 lines
480 B
Python
24 lines
480 B
Python
#!/usr/bin/env python3
|
|
|
|
# Brute force
|
|
from math import sqrt
|
|
|
|
def main():
|
|
low = 10*(int(sqrt(10203040506070809))//10)
|
|
upp = int(sqrt(19293949596979899))
|
|
for i in range(low+3, upp+1, 10):
|
|
if is_num(i**2):
|
|
return i*10
|
|
for i in range(low+7, upp+1, 10):
|
|
if is_num(i**2):
|
|
return i*10
|
|
return False
|
|
|
|
def is_num(n):
|
|
s = str(n)
|
|
for i in range(9):
|
|
if int(s[2*i]) != i+1: return False
|
|
return True
|
|
|
|
print(main())
|