# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a071296 Showing 1-1 of 1 %I A071296 #20 Mar 22 2023 08:15:06 %S A071296 3,0,7,13,0,58,135,0,819,2081,0,13834,35955,0,244647,639389,0,4374866, %T A071296 11448871,0,78439683,205337953,0,1407271538,3684200835,0,25251313255, %U A071296 66108441037,0,453111560266,1186259960295,0,8130736409715,21286537898177,0 %N A071296 a(n) is the least m such that a period of the continued fraction expansion of sqrt(m) is 1,1,1,...,1,1,1,Z and there are n ones in the period (Z is 2*floor(sqrt(m))). If no such m exists, a(n) = 0. %H A071296 T. D. Noe, Table of n, a(n) for n = 1..500 %F A071296 Let F(n) = n-th Fibonacci number (A000045). If n == 2 mod 3 then F(n+1) is even and there's no such m. Otherwise, let x = (F(n+1) + 1) / 2. Then a(n) = x^2 + (F(n-1) + 2*x*F(n))/F(n+1). %e A071296 a(3) = 7 because sqrt(7)'s continued fraction is [2;1,1,1,4,...]; the period has 3 ones (and only one other number). %t A071296 Table[If[Mod[n, 3] == 2, 0, x = (Fibonacci[n + 1] + 1)/2; x^2 + (Fibonacci[n - 1] + 2*x*Fibonacci[n])/Fibonacci[n + 1]], {n, 50}] (* _T. D. Noe_, Apr 07 2014 *) %o A071296 (Python) %o A071296 from gmpy2 import fib2 %o A071296 def A071296(n): %o A071296 if n%3==2: return 0 %o A071296 f, g = fib2(n) %o A071296 return int(f*(f + (g<<1) + 6) + g*(g + 2) + 5>>2) # _Chai Wah Wu_, Mar 21 2023 %Y A071296 Cf. A000045, A010342, A060215. %K A071296 nonn %O A071296 1,1 %A A071296 _Lekraj Beedassy_, Jun 11 2002 %E A071296 Edited by _Don Reble_, Jun 06 2003 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE