A096777 a(n) = a(n-1) + Sum_{k=1..n-1}(a(k) mod 2), a(1) = 1.
1, 2, 3, 5, 8, 11, 15, 20, 25, 31, 38, 45, 53, 62, 71, 81, 92, 103, 115, 128, 141, 155, 170, 185, 201, 218, 235, 253, 272, 291, 311, 332, 353, 375, 398, 421, 445, 470, 495, 521, 548, 575, 603, 632, 661, 691, 722, 753, 785, 818, 851, 885, 920, 955, 991, 1028
Offset: 1
Examples
G.f. = x + 2*x^2 + 3*x^3 + 5*x^4 + 8*x^5 + 11*x^6 + 15*x^7 + 20*x^8 + ... - _Michael Somos_, Apr 18 2020
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
- J.-L. Baril, T. Mansour, A. Petrossian, Equivalence classes of permutations modulo excedances, 2014.
- Eric Weisstein's World of Mathematics, Odd Number
- Index entries for linear recurrences with constant coefficients, signature (2,-1,1,-2,1).
Crossrefs
Programs
-
Haskell
a096777 n = a096777_list !! (n-1) a096777_list = 1 : zipWith (+) a096777_list (scanl1 (+) (map (`mod` 2) a096777_list)) -- Reinhard Zumkeller, Mar 11 2014
-
Magma
[Floor((n-2)^2/3)+n: n in [1..60]]; // Vincenzo Librandi, Dec 27 2015
-
Maple
A096777:=n->n + floor((n-2)^2/3); seq(A096777(n), n=1..100); # Wesley Ivan Hurt, Mar 06 2014
-
Mathematica
Table[n + Floor[(n-2)^2/3], {n, 100}] (* Wesley Ivan Hurt, Mar 06 2014 *)
-
PARI
a(n)=(n-2)^2\3+n \\ Charles R Greathouse IV, Mar 06 2014
Formula
a(n+1) - a(n) = A004396(n).
a(n) = floor(n/3) * (3*floor(n/3) + 2*(n mod 3) - 1) + n mod 3 + 0^(n mod 3). - Reinhard Zumkeller, Dec 29 2007
a(n) = floor((n-2)^2/3) + n. - Christopher Hunt Gribble, Mar 06 2014
G.f.: -x*(x^4+1) / ((x-1)^3*(x^2+x+1)). - Colin Barker, Mar 07 2014
Euler transform of finite sequence [2, 0, 1, 1, 0, 0, 0, -1]. - Michael Somos, Apr 18 2020
a(n) = (10 + 3*n*(n - 1) - A061347(n+1))/9. - Stefano Spezia, Sep 22 2022
Comments