OFFSET
1,2
COMMENTS
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..10000
Index entries for linear recurrences with constant coefficients, signature (0,2,0,-1).
FORMULA
a(n) = 2n-1 if n is 1 or an even number;
a(n) = 6n-7 if n is an odd number other than 1.
G.f.: x*(1 + 3*x + 9*x^2 + x^3 + 2*x^4)/((1+x)^2*(1-x)^2). - Klaus Brockhaus, Oct 15 2009
a(n) = 4*(n-1) - (2*n-3)*(-1)^n for n>1, a(1)=1. - Bruno Berselli, Sep 14 2011
EXAMPLE
a(1) = 1;
a(2) = 2^2 - a(1) = 4 - 1 = 3;
a(3) = 3^2 + a(2) - a(1) = 9 + 3 - 1 = 11;
a(4) = 4^2 - 11 + 3 - 1 = 7;
a(5) = 25 + 7 - 11 + 3 - 1 = 23;
a(6) = 36 - 23 + 7 - 11 + 3 - 1 = 11; etc.
PROG
(Magma) S:=[ 1 ]; for n in [2..61] do Append(~S, n^2 + &+[ (-1)^j*S[j]: j in [1..n-1] ]); end for; S; // Klaus Brockhaus, Jan 04 2009
(Scheme) (define (A153285 n) (cond ((= 1 n) n) ((even? n) (+ n n -1)) (else (+ (* 6 n) -7)))) ;; Antti Karttunen, Aug 10 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Walter Carlini, Dec 23 2008
EXTENSIONS
Extended beyond a(30) by Klaus Brockhaus, Jan 04 2009
STATUS
approved