OFFSET
1,1
LINKS
T. D. Noe, Table of n, a(n) for n = 1..500
FORMULA
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).
EXAMPLE
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).
MATHEMATICA
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 *)
PROG
(Python)
from gmpy2 import fib2
def A071296(n):
if n%3==2: return 0
f, g = fib2(n)
return int(f*(f + (g<<1) + 6) + g*(g + 2) + 5>>2) # Chai Wah Wu, Mar 21 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Lekraj Beedassy, Jun 11 2002
EXTENSIONS
Edited by Don Reble, Jun 06 2003
STATUS
approved