login
a(n) = n if n is odd, a(n) = 3*n/2 if n is even.
36

%I #60 Jan 01 2024 09:08:44

%S 1,3,3,6,5,9,7,12,9,15,11,18,13,21,15,24,17,27,19,30,21,33,23,36,25,

%T 39,27,42,29,45,31,48,33,51,35,54,37,57,39,60,41,63,43,66,45,69,47,72,

%U 49,75,51,78,53,81,55,84,57,87,59,90,61,93,63,96,65,99,67,102

%N a(n) = n if n is odd, a(n) = 3*n/2 if n is even.

%C First differences of the generalized heptagonal numbers A085787. - _Omar E. Pol_, Sep 10 2011

%C Last term in n-th row of A080511.

%C Also A005408 and positive terms of A008585 interleaved. - _Omar E. Pol_, May 28 2012

%C a(n) is also the length of the n-th line segment of the rectangular spiral whose vertices are the generalized heptagonal numbers. - _Omar E. Pol_, Jul 27 2018

%H Vincenzo Librandi, <a href="/A080512/b080512.txt">Table of n, a(n) for n = 1..10000</a>

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

%F a(n) = n if n is odd, a(n) = 3*n/2 if n is even.

%F a(n)*a(n+3) = -3 + a(n+1)*a(n+2).

%F From _Paul Barry_, Sep 04 2003: (Start)

%F G.f.: (1+3*x+x^2)/((1-x^2)^2);

%F a(n) = n*(5 + (-1)^n)/4. (End)

%F Multiplicative with a(2^e) = 3*2^(e-1), a(p^e) = p^e otherwise. - _Christian G. Bower_, May 17 2005

%F Equals A126988 * (1, 1, 0, 0, 0, ...) - _Gary W. Adamson_, Apr 17 2007

%F Dirichlet g.f.: zeta(s-1) * (1 + 1/2^s). - _Amiram Eldar_, Oct 25 2023

%F Sum_{d divides n} mu(n/d)*a(d) = A126246(n), where mu(n) = A008683(n) is the Möbius function. - _Peter Bala_, Dec 31 2023

%t Table[If[EvenQ[n],3n/2,n],{n,68}] (* _Jayanta Basu_, May 20 2013 *)

%o (Magma) [n*(5+(-1)^n)/4: n in [1..60]]; // _Vincenzo Librandi_, Sep 11 2011

%o (Haskell)

%o import Data.List (transpose)

%o a080512 n = if m == 0 then 3 * n' else n where (n', m) = divMod n 2

%o a080512_list = concat $ transpose [[1, 3 ..], [3, 6 ..]]

%o -- _Reinhard Zumkeller_, Apr 06 2015

%Y Cf. A080511, A008619, A126988.

%Y Cf. A005408, A008585, A064455, A085787, A126246

%K nonn,easy,mult

%O 1,2

%A _Amarnath Murthy_, Mar 20 2003