login
A248825
a(n) = n^2 + 1 - (-1)^n.
1
0, 3, 4, 11, 16, 27, 36, 51, 64, 83, 100, 123, 144, 171, 196, 227, 256, 291, 324, 363, 400, 443, 484, 531, 576, 627, 676, 731, 784, 843, 900, 963, 1024, 1091, 1156, 1227, 1296, 1371, 1444, 1523, 1600, 1683, 1764, 1851, 1936, 2027, 2116
OFFSET
0,2
COMMENTS
Also, A016742 and A164897 interleaved.
See the spiral in Example field of A054552: after 0, the sequence is given by the terms of the semidiagonals 4, 16, 36, 64, 100, ... and 3, 11, 27, 51, 83, ... sorted into ascending order.
Primes of the sequence are in A056899.
FORMULA
a(n) = a(-n) = 2*a(n-1) - 2*(n-3) + a(n-4).
a(n) = n^2 + A010673(n) = (n+1)^2 - A168277(n+1).
a(n+1) = A248800(n) + A042963(n+1) = a(n) + A166519(n).
a(n+2) = a(n) + 4*n.
a(n+5) = a(n-5) + A008602(n).
G.f.: x*(3 - 2*x + 3*x^2)/((1 + x)*(1 - x)^3). - Bruno Berselli, Oct 15 2014
Sum_{n>=1} 1/a(n) = Pi^2/24 + tanh(Pi/sqrt(2))*Pi/(4*sqrt(2)). - Amiram Eldar, Aug 21 2022
MATHEMATICA
Table[n^2 + 1 - (-1)^n, {n, 0, 60}] (* Vincenzo Librandi, Oct 16 2014 *)
LinearRecurrence[{2, 0, -2, 1}, {0, 3, 4, 11}, 60] (* Harvey P. Dale, Jun 30 2019 *)
PROG
(PARI) vector(100, n, (n-1)^2+1+(-1)^n) \\ Derek Orr, Oct 15 2014
(Magma) [n^2+1-(-1)^n: n in [0..60]]; // Vincenzo Librandi, Oct 16 2014
(Sage) [n^2+1-(-1)^n for n in (0..60)] # Bruno Berselli, Oct 16 2014
KEYWORD
nonn,easy
AUTHOR
Paul Curtz, Oct 15 2014
EXTENSIONS
Edited by Bruno Berselli, Oct 16 2014
STATUS
approved