OFFSET
1,3
COMMENTS
Eigensequence of a triangle with nonnegative integers interlaced with zeros (1, 0, 2, 0, 3, ...) as the right and left borders, with the rest zeros. - Gary W. Adamson, Aug 01 2016
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
Index entries for linear recurrences with constant coefficients, signature (0,3,0,-3,0,1).
FORMULA
a(n) = ((((-1)^(n+1))+1)/4)(n+1) - ((((-1)^(n+1))-1)/8)n^2 - Sam Alexander
G.f.: (1+x-x^2+x^3)/((1-x)^3(1+x)^3).
a(n) = if(n mod 2, (n+1)/2, (n/2)^2). - Gerald Hillier, Sep 25 2008
a(n) = floor((n+1) / 2) ^ (2 - n mod 2). - Reinhard Zumkeller, Aug 15 2011
E.g.f.: (x + 2)*(sinh(x) + x*cosh(x))/4. - Ilya Gutkovskiy, Aug 02 2016
EXAMPLE
G.f. = x + x^2 + 2*x^3 + 4*x^4 + 3*x^5 + 9*x^6 + 4*x^7 + 16*x^8 + ...
MAPLE
seq(seq(n^k, k=1..2), n=1..36); # Zerinvary Lajos, Jun 29 2007
MATHEMATICA
Array[{#, #^2} &, 36, 0] // Flatten
Riffle[Range[40], Range[40]^2] (* Bruno Berselli, Jul 15 2013 *)
a[ n_] := If[ OddQ @ n, (n + 1) / 2, n^2 / 4]; (* Michael Somos, May 28 2014 *)
PROG
(Magma) &cat[ [ n, n^2 ]: n in [1..36] ]; // Klaus Brockhaus, Apr 20 2009
(Haskell)
a000463 n = a000463_list !! (n-1)
a000463_list = concatMap (\x -> [x, x^2]) [1..]
-- Reinhard Zumkeller, Apr 13 2011
(PARI) {a(n) = if( n%2, (n + 1) / 2, n^2 / 4)}; /* Michael Somos, May 28 2014 */
CROSSREFS
KEYWORD
AUTHOR
EXTENSIONS
Square of 14 corrected by Sean A. Irvine, Oct 25 2010
STATUS
approved