[go: up one dir, main page]

login
A288184
Least odd number k such that the continued fraction for sqrt(k) has period n.
2
5, 3, 41, 7, 13, 19, 73, 31, 113, 43, 61, 103, 193, 179, 109, 133, 157, 139, 337, 151, 181, 253, 853, 271, 457, 211, 949, 487, 821, 379, 601, 463, 613, 331, 1061, 1177, 421, 619, 541, 589, 1117, 571, 1153, 823, 1249, 739, 1069, 631, 1021, 1051, 1201, 751
OFFSET
1,1
LINKS
Eric Weisstein's World of Mathematics, Periodic Continued Fraction
FORMULA
A003285(a(n)) = n, A000035(a(n)) = 1.
EXAMPLE
a(2) = 3, sqrt(3) = 1 + 1/(1 + 1/(2 + 1/(1 + 1/(2 + 1/...)))), period 2: [1, 2].
PROG
(Python)
from sympy import continued_fraction_periodic
def A288184(n):
d = 1
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 07 2017
KEYWORD
nonn
AUTHOR
Ilya Gutkovskiy, Jun 06 2017
STATUS
approved