login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A013944
Sum of terms in period of continued fraction for square root of the n-th nonsquare.
1
2, 3, 4, 6, 7, 5, 6, 9, 8, 10, 10, 7, 8, 12, 17, 10, 14, 18, 13, 9, 10, 15, 18, 16, 12, 25, 13, 14, 16, 11, 12, 18, 16, 15, 16, 14, 29, 20, 20, 34, 19, 13, 14, 21, 26, 22, 26, 20, 16, 22, 20, 27, 18, 36, 22, 15, 16, 24, 41, 20, 34, 24, 33, 18, 30, 20, 19, 40
OFFSET
1,1
MATHEMATICA
Table[If[IntegerQ[Sqrt[n]], {}, Total[ContinuedFraction[Sqrt[n]][[2]]]], {n, 100}]//Flatten (* Harvey P. Dale, Apr 26 2016 *)
PROG
(Python)
from math import isqrt
from sympy.ntheory.continued_fraction import continued_fraction_periodic
def A013944(n): return sum(continued_fraction_periodic(0, 1, n+(k:=isqrt(n))+int(n>=k*(k+1)+1))[-1]) # Chai Wah Wu, Jul 20 2024
CROSSREFS
Sequence in context: A071373 A344412 A143102 * A123497 A123501 A073210
KEYWORD
nonn
EXTENSIONS
Definition corrected by Clark Kimberling, Apr 21 2010
Corrected by Harvey P. Dale, Apr 26 2016
STATUS
approved