OFFSET
1,2
LINKS
Ray Chandler, Table of n, a(n) for n = 1..10000 (first 1000 terms from Vincenzo Librandi)
Kival Ngaokrajang, Illustration of initial terms, periodic are colored.
Eric Weisstein's World of Mathematics, Continued Fraction.
MATHEMATICA
nonSquares = Select[Range[120], !IntegerQ[Sqrt[#]]&]; a[n_] := Length[ Last[ ContinuedFraction[ Sqrt[ nonSquares[[n]] ]]]]; Table[a[n], {n, 1, Length[nonSquares]}] (* Jean-François Alcover, May 27 2013 *)
PROG
(Python)
from math import isqrt
from sympy.ntheory.continued_fraction import continued_fraction_periodic
def A013943(n): return len(continued_fraction_periodic(0, 1, n+(k:=isqrt(n))+int(n>=k*(k+1)+1))[-1]) # Chai Wah Wu, Jul 20 2024
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
STATUS
approved