OFFSET
0,3
LINKS
Colin Barker, Table of n, a(n) for n = 0..1000
Eric Weisstein's World of Mathematics, d'Ocagne's Identity.
Index entries for linear recurrences with constant coefficients, signature (-1,3,3,-1,-1).
FORMULA
a(2n+1) = 1, and a(2n) = F(2n+2) - 1, and lim(a(2n+2)/a(2n)) = phi^2 by d'Ocagne's identity.
a(n) = F(n) * F(n+1) mod (F(n) + F(n+1)) since F(n+2) := F(n+1) + F(n).
From Colin Barker, Mar 28 2020: (Start)
G.f.: x*(1 + 3*x - x^3) / ((1 + x)*(1 + x - x^2)*(1 - x - x^2)).
a(n) = -a(n-1) + 3*a(n-2) + 3*a(n-3) - a(n-4) - a(n-5) for n>4.
(End)
EXAMPLE
a(0) = 0*1 mod 1 = 0;
a(1) = 1*1 mod 2 = 1;
a(2) = 1*2 mod 3 = 2;
a(3) = 2*3 mod 5 = 1;
a(4) = 3*5 mod 8 = 7.
MATHEMATICA
With[{f = Fibonacci}, Table[Mod[f[n] * f[n+1], f[n+2]], {n, 0, 50}]] (* Amiram Eldar, Mar 28 2020 *)
PROG
(Python)
def a(n):
f1 = 0
f2 = 1
for i in range(n):
f = f1 + f2
f1 = f2
f2 = f
return (f1 * f2) % (f1 + f2)
(PARI) a(n) = if (n % 2, 1, fibonacci(n+2) - 1); \\ Michel Marcus, Mar 29 2020
(PARI) concat(0, Vec(x*(1 + 3*x - x^3) / ((1 + x)*(1 + x - x^2)*(1 - x - x^2)) + O(x^45))) \\ Colin Barker, Mar 29 2020
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Adnan Baysal, Mar 28 2020
STATUS
approved