32 lines
499 B
Python
32 lines
499 B
Python
#!/usr/bin/env python3
|
|
|
|
def sols():
|
|
"""yields int solutions of a**2 - 5 b**2 = 1"""
|
|
a, b = 9, 4
|
|
while True:
|
|
yield a, b
|
|
a, b = 9*a + 20*b, 4*a + 9*b
|
|
|
|
def Cs():
|
|
"""yields int solutions of a in a**2 - 5 b**2 = -4"""
|
|
for a, b in sols():
|
|
yield 25*b - 11*a
|
|
yield 10*b - 4*a
|
|
yield 5*b - a
|
|
|
|
gen = Cs()
|
|
next(gen)
|
|
count = 0
|
|
|
|
N = 15
|
|
|
|
while count < N:
|
|
c = next(gen)
|
|
if (c-1) % 5 != 0:
|
|
continue
|
|
count += 1
|
|
|
|
n = (c-1) // 5
|
|
print(n)
|
|
|