login
A064455
a(2n) = 3n, a(2n-1) = n.
19
1, 3, 2, 6, 3, 9, 4, 12, 5, 15, 6, 18, 7, 21, 8, 24, 9, 27, 10, 30, 11, 33, 12, 36, 13, 39, 14, 42, 15, 45, 16, 48, 17, 51, 18, 54, 19, 57, 20, 60, 21, 63, 22, 66, 23, 69, 24, 72, 25, 75, 26, 78, 27, 81, 28, 84, 29, 87, 30, 90, 31, 93, 32, 96, 33, 99, 34, 102, 35, 105, 36, 108
OFFSET
1,2
COMMENTS
Also number of 1's in n-th row of triangle in A071030. - Hans Havermann, May 26 2002
Number of ON cells at generation n of 1-D CA defined by Rule 54. - N. J. A. Sloane, Aug 09 2014
a(n)*A098557(n) equals the second right hand column of A167556. - Johannes W. Meijer, Nov 12 2009
Given a(1) = 1, for all n > 1, a(n) is the least positive integer not equal to a(n-1) such that the arithmetic mean of the first n terms is an integer. The sequence of arithmetic means of the first 1, 2, 3, ..., terms is 1, 2, 2, 3, 3, 4, 4, ... (A004526 disregarding its first three terms). - Rick L. Shepherd, Aug 20 2013
FORMULA
a(n) = (1/2)*n*(-1)^n + n + (1/4)*(-1)^(n+1) + 1/4. - Stephen Crowley, Aug 10 2009
G.f.: x*(1+3*x) / ( (x-1)^2*(1+x)^2 ). - R. J. Mathar, Mar 30 2011
From Jaroslav Krizek, Mar 22 2011: (Start)
a(n) = n - A123684(n-1) for odd n.
a(n) = n + a(n-1) for even n.
a(n) = A123684(n) + A137501(n).
Abs( a(n) - A123684(n) ) = A052928(n). (End)
a(n) = Sum_{i=n..2*n} i*(-1)^i. - Bruno Berselli, Jun 05 2013
a(n) = n + floor(n/2)*(-1)^(n mod 2). - Bruno Berselli, Dec 14 2015
a(n) = (n^2-3n+2) mod (2n-1) for n>2. - Jim Singh, Oct 31 2018
EXAMPLE
a(13) = a(2*7 - 1) = 7, a(14) = a(2*7) = 21.
a(8) = 8-9+10-11+12-13+14-15+16 = 12. - Bruno Berselli, Jun 05 2013
MAPLE
A064455 := proc(n)
if type(n, 'even') then
3*n/2 ;
else
(n+1)/2 ;
end if;
end proc: # R. J. Mathar, Aug 03 2015
MATHEMATICA
Table[ If[ EvenQ[n], 3n/2, (n + 1)/2], {n, 1, 70} ]
PROG
(ARIBAS): maxarg := 75; for n := 1 to maxarg do if n mod 2 = 1 then write((n+1) div 2, " ") else write((n div 2)*3, " "); end; end; .
(PARI) { for (n=1, 1000, if (n%2, a=(n + 1)/2, a=3*n/2); write("b064455.txt", n, " ", a) ) } \\ Harry J. Smith, Sep 14 2009
(PARI) a(n)=if(n<3, 2*n-1, ((n-1)*(n-2))%(2*n-1)) \\ Jim Singh, Oct 14 2018
(Haskell)
import Data.List (transpose)
a064455 n = n + if m == 0 then n' else - n' where (n', m) = divMod n 2
a064455_list = concat $ transpose [[1 ..], [3, 6 ..]]
-- Reinhard Zumkeller, Oct 12 2013
(Magma) [(1/2)*n*(-1)^n+n+(1/4)*(-1)^(n+1)+1/4: n in [1..80]]; // Vincenzo Librandi, Aug 10 2014
(GAP) a:=[];; for n in [1..75] do if n mod 2 = 0 then Add(a, 3*n/2); else Add(a, (n+1)/2); fi; od; a; # Muniru A Asiru, Oct 28 2018
CROSSREFS
Interleaving of A000027 and A008585 (without first term).
Sequence in context: A245676 A341516 A060992 * A141619 A270143 A363278
KEYWORD
nonn,easy
AUTHOR
N. J. A. Sloane, Oct 02 2001
STATUS
approved