login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 


A215098
a(0)=0, a(1)=1, a(n) = n*(n-1) - a(n-2).
3
0, 1, 2, 5, 10, 15, 20, 27, 36, 45, 54, 65, 78, 91, 104, 119, 136, 153, 170, 189, 210, 231, 252, 275, 300, 325, 350, 377, 406, 435, 464, 495, 528, 561, 594, 629, 666, 703, 740, 779, 820, 861, 902, 945, 990, 1035, 1080, 1127, 1176, 1225, 1274, 1325, 1378, 1431
OFFSET
0,3
COMMENTS
Same seed, b(n) = n*(n+1) - b(n-2) : 0, 1, 6, 11, 14, 19, 28, 37, 44, 53, 66, 79, 90, 103, 120, 137, 152, 169, 190, 211, 230, 251, 276, 301, 324, 349, 378, 407, 434, 463, 496, 529, 560, 593, ...
b(n) = a(n+1) - 1 if (n mod 4) < 2, otherwise b(n) = a(n+1) + 1.
FORMULA
G.f.: x*(1-x+3*x^2-x^3)/(1-3*x+4*x^2-4*x^3+3*x^4-x^5). - David Scambler, Aug 06 2012
a(n) = (n^2 +n -1 +cos(pi*n/2) +sin(pi*n/2))/2. - Vaclav Kotesovec, Aug 11 2012
MATHEMATICA
CoefficientList[Series[(x -x^2 +3x^3 -x^4)/(1 -3x +4x^2 -4x^3 +3x^4 -x^5), {x, 0, 70}], x] (* Vincenzo Librandi, Jul 18 2013 *)
RecurrenceTable[{a[0]==0, a[1]==1, a[n]==n(n-1)-a[n-2]}, a, {n, 60}] (* or *) LinearRecurrence[{3, -4, 4, -3, 1}, {0, 1, 2, 5, 10}, 60] (* Harvey P. Dale, May 15 2016 *)
PROG
(Python)
prpr = 0
prev = 1
for n in range(2, 77):
print prpr,
curr = n*(n-1) - prpr
prpr = prev
prev = curr
(Magma) [n le 2 select n-1 else 2*Binomial(n-1, 2) -Self(n-2): n in [1..81]]; // G. C. Greubel, Nov 25 2022
(SageMath)
def A215098(n):
if (n<2): return n
else: return 2*binomial(n, 2) - A215098(n-2)
[A215098(n) for n in range(81)] # G. C. Greubel, Nov 25 2022
CROSSREFS
Cf. A007590 (a(0)=0, a(n) = n*(n-1) - a(n-1)).
Cf. A178218 (a(1)=1, a(n) = n*(n+1) - a(n-1)).
Sequence in context: A190459 A135042 A109666 * A024390 A125622 A080551
KEYWORD
nonn,easy
AUTHOR
Alex Ratushnyak, Aug 03 2012
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 21 12:44 EDT 2024. Contains 376084 sequences. (Running on oeis4.)