A099725 a(n) is the number of 1's in the period of the continued fraction of the square root of the n-th nonsquare integer.
0, 1, 0, 0, 3, 1, 0, 0, 0, 4, 2, 1, 0, 0, 2, 0, 4, 2, 2, 1, 0, 0, 0, 2, 0, 4, 3, 2, 2, 1, 0, 0, 0, 0, 0, 0, 6, 6, 2, 6, 2, 1, 0, 0, 2, 2, 2, 0, 0, 4, 6, 2, 2, 4, 2, 1, 0, 0, 4, 0, 2, 2, 2, 0, 4, 4, 3, 6, 2, 2, 2, 1, 0, 0, 0, 2, 6, 0, 3, 0, 0, 5, 4, 6, 8, 2, 2, 8, 2, 1, 0, 0, 6, 0, 0, 4, 2, 4, 4, 0, 4, 4, 6, 2, 7
Offset: 1
Keywords
Links
- A.H.M. Smeets, Table of n, a(n) for n = 1..10000
Programs
-
Python
from math import isqrt from sympy.ntheory.continued_fraction import continued_fraction_periodic def A099725(n): return (continued_fraction_periodic(0,1,n+(k:=isqrt(n))+int(n>=k*(k+1)+1))[-1]).count(1) # Chai Wah Wu, Jul 20 2024
Comments