login
a(n) = a(n-1) + Sum_{k=1..n-1}(a(k) mod 2), a(1) = 1.
9

%I #41 Sep 23 2022 03:11:39

%S 1,2,3,5,8,11,15,20,25,31,38,45,53,62,71,81,92,103,115,128,141,155,

%T 170,185,201,218,235,253,272,291,311,332,353,375,398,421,445,470,495,

%U 521,548,575,603,632,661,691,722,753,785,818,851,885,920,955,991,1028

%N a(n) = a(n-1) + Sum_{k=1..n-1}(a(k) mod 2), a(1) = 1.

%C 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

%C A016789 and A032766 give positions where even and odd terms occur; a(3*n)=A056106(n); a(3*n-1)=A077588(n); a(3*n-2)=A056108(n). - _Reinhard Zumkeller_, Dec 29 2007

%H Reinhard Zumkeller, <a href="/A096777/b096777.txt">Table of n, a(n) for n = 1..10000</a>

%H J.-L. Baril, T. Mansour, A. Petrossian, <a href="http://jl.baril.u-bourgogne.fr/equival.pdf">Equivalence classes of permutations modulo excedances</a>, 2014.

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/OddNumber.html">Odd Number</a>

%H <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (2,-1,1,-2,1).

%F a(n+1) - a(n) = A004396(n).

%F 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

%F a(n) = floor((n-2)^2/3) + n. - _Christopher Hunt Gribble_, Mar 06 2014

%F G.f.: -x*(x^4+1) / ((x-1)^3*(x^2+x+1)). - _Colin Barker_, Mar 07 2014

%F Euler transform of finite sequence [2, 0, 1, 1, 0, 0, 0, -1]. - _Michael Somos_, Apr 18 2020

%F a(n) = (10 + 3*n*(n - 1) - A061347(n+1))/9. - _Stefano Spezia_, Sep 22 2022

%e 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

%p A096777:=n->n + floor((n-2)^2/3); seq(A096777(n), n=1..100); # _Wesley Ivan Hurt_, Mar 06 2014

%t Table[n + Floor[(n-2)^2/3], {n, 100}] (* _Wesley Ivan Hurt_, Mar 06 2014 *)

%o (PARI) a(n)=(n-2)^2\3+n \\ _Charles R Greathouse IV_, Mar 06 2014

%o (Haskell)

%o a096777 n = a096777_list !! (n-1)

%o a096777_list = 1 : zipWith (+) a096777_list

%o (scanl1 (+) (map (`mod` 2) a096777_list))

%o -- _Reinhard Zumkeller_, Mar 11 2014

%o (Magma) [Floor((n-2)^2/3)+n: n in [1..60]]; // _Vincenzo Librandi_, Dec 27 2015

%Y Cf. A004396, A007980, A016789, A032766, A056106, A056108, A061347, A077588, A097602, A131093.

%K nonn,easy

%O 1,2

%A _Reinhard Zumkeller_, Jul 09 2004