OFFSET
0,2
LINKS
Colin Barker, Table of n, a(n) for n = 0..1000
A. W. Vyawahare and K. M. Purohit, Near pseudo Smarandache function, Smarandache Notions, 14 (2004), 42-61.
Index entries for linear recurrences with constant coefficients, signature (1,2,-2,-1,1).
FORMULA
a(0) = 0, a(2n) = a(2n-1) + n, a(2n-1) = a(2n-2) + 3n-1. - Amarnath Murthy, Jul 04 2004
From Colin Barker, Feb 03 2019: (Start)
G.f.: x*(2 + 2*x + x^2 - x^3) / ((1 - x)^3*(1 + x)^2).
a(n) = (n*(2 + n)) / 2 for n even.
a(n) = (n*(3 + n)) / 2 for n odd.
a(n) = a(n-1) + 2*a(n-2) - 2*a(n-3) - a(n-4) + a(n-5) for n>4.
(End)
MAPLE
seq(n*(1+ceil(n/2)), n=0..53); # Zerinvary Lajos and Klaus Brockhaus, Apr 10 2007
MATHEMATICA
{0}~Join~Array[Block[{k = 1}, While[GCD[#1, #2 + k] < #1, k++]; #2 + k] & @@ {#, (#^2 + #)/2} &, 53] (* or *)
CoefficientList[Series[x (2 + 2 x + x^2 - x^3)/((1 - x)^3*(1 + x)^2), {x, 0, 53}], x] (* Michael De Vlieger, Feb 03 2019 *)
LinearRecurrence[{1, 2, -2, -1, 1}, {0, 2, 4, 9, 12}, 60] (* Harvey P. Dale, Sep 21 2024 *)
PROG
(PARI) for(n=0, 53, print1(n*(1+ceil(n/2)), ", ")); \\ Klaus Brockhaus, Apr 10 2007
(PARI) concat(0, Vec(x*(2 + 2*x + x^2 - x^3) / ((1 - x)^3*(1 + x)^2) + O(x^40))) \\ Colin Barker, Feb 03 2019
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
N. J. A. Sloane, Apr 08 2004
STATUS
approved