OFFSET
1,2
COMMENTS
a(n) = a(n-1) + (number of odd terms so far in the sequence). Example: 15 is 11 + 4 odd terms so far in the sequence (they are 1,3,5,11). See A007980 for the same construction with even integers. - Eric Angelini, Aug 05 2007
A016789 and A032766 give positions where even and odd terms occur. - Reinhard Zumkeller, Dec 29 2007
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
Jean-Luc Baril, Toufik Mansour, and Armen Petrossian, Equivalence classes of permutations modulo excedances, Journal of Combinatorics, Vol. 5, No. 4 (2014), pp. 453-469; alternative link.
Eric Weisstein's World of Mathematics, Odd Number.
Index entries for linear recurrences with constant coefficients, signature (2,-1,1,-2,1).
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
Sum_{n>=1} 1/a(n) = tanh(sqrt(5/3)*Pi/2)*Pi/sqrt(15) + 4*Pi*sinh(sqrt(11)*Pi/3)/((2*cosh(sqrt(11)*Pi/3) - 1)*sqrt(11)). - Amiram Eldar, Jun 19 2026
EXAMPLE
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
MAPLE
MATHEMATICA
Table[n + Floor[(n-2)^2/3], {n, 100}] (* Wesley Ivan Hurt, Mar 06 2014 *)
PROG
(PARI) a(n)=(n-2)^2\3+n \\ Charles R Greathouse IV, Mar 06 2014
(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
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Reinhard Zumkeller, Jul 09 2004
STATUS
approved
