OFFSET
1,2
COMMENTS
a(n) is a member of A140612. Proof: a(n) = n^2 + (n/2-1)^2 for even n, otherwise a(n) = (n-1)^2 + ((n+1)/2)^2; also, a(n) + 1 = (n-1)^2 + (n/2+1)^2 for even n, otherwise a(n) + 1 = n^2 + ((n-3)/2)^2. Therefore, both a(n) and a(n) + 1 belong to A001481.
Primes in sequence are listed in A245042.
Squares in sequence are listed in A081068.
LINKS
Colin Barker, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (1,2,-2,-1,1).
FORMULA
G.f.: x*(1 + x^2)*(1 + 3*x + x^2)/((1 - x)^3*(1 + x)^2).
a(n) = a(1-n) = a(n-1) + 2*a(n-2) - 2*a(n-3) - a(n-4) + a(n-5).
a(n) = (10*n*(n-1) + (2*n-1)*(-1)^n + 9)/8.
a(n) = A036666(n) + 1.
MATHEMATICA
Table[(10 n (n - 1) + (2 n - 1) (-1)^n + 9)/8, {n, 1, 60}]
LinearRecurrence[{1, 2, -2, -1, 1}, {1, 4, 8, 17, 25}, 60] (* Harvey P. Dale, Sep 16 2022 *)
PROG
(PARI) Vec((1+x^2)*(1+3*x+x^2)/((1-x)^3*(1+x)^2)+O(x^60))
(PARI) vector(60, n, nn; (10*n*(n-1)+(2*n-1)*(-1)^n+9)/8)
(Sage) [(10*n*(n-1)+(2*n-1)*(-1)^n+9)/8 for n in (1..60)]
(Maxima) makelist((10*n*(n-1)+(2*n-1)*(-1)^n+9)/8, n, 1, 60);
(Magma) [(10*n*(n-1)+(2*n-1)*(-1)^n+9)/8: n in [1..60]];
(GAP) List([1..60], n -> (10*n*(n-1)+(2*n-1)*(-1)^n+9)/8);
(Python) [(10*n*(n-1)+(2*n-1)*(-1)**n+9)/8 for n in range(1, 60)]
CROSSREFS
Cf. A195162: numbers k such that 5*k + 4 is a square.
KEYWORD
nonn,easy
AUTHOR
Bruno Berselli, Jan 30 2018
STATUS
approved