|
|
A351139
|
|
a(n) is the least k such that the continued fraction for sqrt(k) has periodic part [r, 1, 2, ..., n-1, n, n-1, ..., 1, 2r] for some positive integer r.
|
|
1
|
|
|
3, 14, 216, 25185, 23287359, 1953082923, 81112983931776, 6667182474680388, 699567746120736710880, 855784807474766398870755, 51592564054278677032777194015, 1474855822717073602911008555048040, 23175672095781915301598668218548941215, 474577479777785868138090462593743556930231
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
LINKS
|
|
|
EXAMPLE
|
a(3) = 216 because the continued fraction of sqrt(216) has periodic part [14; 1, 2, 3, 2, 1, 28] and this is the least number with this property.
|
|
PROG
|
(Python)
from itertools import count
from sympy.ntheory.continued_fraction import continued_fraction_reduce
if n == 2:
return 14
for r in count(1):
if (k := continued_fraction_reduce([r, list(range(1, n+1))+list(range(n-1, 0, -1))+[2*r]])**2).is_integer:
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|