reviewed
approved
reviewed
approved
proposed
reviewed
editing
proposed
a(n) = Sum_{j=0..floor(n/2)} Sum_{k=0..floor((n-j)/2)} binomial(n-j-2k, j-2k} ) for n>=0.
approved
editing
(MAGMAMagma) I:=[1, 1, 2, 3, 6, 9]; [n le 6 select I[n] else Self(n-1)+Self(n-2)+Self(n-4)-Self(n-5)-Self(n-6): n in [1..50]]; // Vincenzo Librandi, Jun 07 2015
proposed
approved
editing
proposed
(*f[n] is the Fibonacci sequence and a[n] is the sequence of A080239*) f[n_] := f[n] = f[n - 1] + f[n - 2]; f[1] = 1; f[2] = 1; a[n_] := Which[n == 1, 1, Mod[n, 4] == 2, f[(n + 2)/2]^2, Mod[n, 4] == 3, (f[(n + 5)/2]^2 - 2f[(n + 1)/2]^2 - 1)/3, Mod[n, 4] == 0, (f[(n + 4)/2]^2 + f[n/2]^2 - 1)/3, Mod[n, 4] == 1, (2f[(n + 3)/2]^2 - f[(n - 1)/2]^2 + 1)/3] (* Hiroshi Matsui and Ryohei Miyadera, Aug 08 2006 *)
f=Fibonacci; a2[n_] := Block[{m, s}, s = Mod[n, 4]; m = (n - s)/4;
Which[n == 1, 1, n == 2, 1, n == 3, 2, s == 0, 3 + Sum[f[4 i], {i, 2, m}], s == 1, 1 + Sum[f[4 i 4i+ 1], {i, 1, m}], s == 2, 1 + Sum[f[4 i 4i+ 2], {i, 1, m}], s == 3, 2 + Sum[f[4 i 4i+ 3], {i, 1, m}]]]; Table[a2[n], {n, 1, 3340}] (* Ryohei Miyadera, Apr 11 2014, minor update by Jean-François Alcover, Apr 29 2014 *)
LinearRecurrence[{1, 1, 0, 1, -1, -1}, {1, 1, 2, 3, 6, 9}, 5041] (* Vincenzo Librandi, Jun 07 2015 *)
(PARI) vector(40, n, f=fibonacci; sum(k=0, ((n-1)\4), f(n-4*k))) \\ G. C. Greubel, Jul 13 2019
(Sage) [sum(fibonacci(n-4*k) for k in (0..floor((n-1)/4))) for n in (1..40)] # G. C. Greubel, Jul 13 2019
(GAP) List([1..40], n-> Sum([0..Int((n-1)/4)], k-> Fibonacci(n-4*k) )); # G. C. Greubel, Jul 13 2019
approved
editing
proposed
approved
editing
proposed