login
A288185
Least even number k such that the continued fraction for sqrt(k) has period n.
2
2, 6, 130, 14, 74, 22, 58, 44, 106, 86, 298, 46, 746, 134, 1066, 94, 1018, 424, 922, 268, 394, 166, 586, 382, 1306, 214, 1354, 334, 1642, 436, 2122, 508, 1114, 454, 4138, 478, 3194, 1108, 4874, 526, 3418, 724, 2458, 604, 9914, 694, 4618, 844, 2746, 1318
OFFSET
1,1
LINKS
Eric Weisstein's World of Mathematics, Periodic Continued Fraction
FORMULA
A003285(a(n)) = n, A000035(a(n)) = 0.
EXAMPLE
a(2) = 6, sqrt(6) = 2 + 1/(2 + 1/(4 + 1/(2 + 1/(4 + 1/...)))), period 2: [2, 4].
PROG
(Python)
from sympy import continued_fraction_periodic
def A288185(n):
d = 2
while True:
s = continued_fraction_periodic(0, 1, d)[-1]
if isinstance(s, list) and len(s) == n:
return d
d += 2 # Chai Wah Wu, Jun 08 2017
KEYWORD
nonn
AUTHOR
Ilya Gutkovskiy, Jun 06 2017
STATUS
approved