OFFSET
1,1
COMMENTS
A lexicographically minimal sequence of distinct positive integers such that a(n)*n + 1 is a square. The same condition without the requirement for a(n) to be distinct would produce A076942.
LINKS
Ivan Neretin, Table of n, a(n) for n = 1..10000
F. Michel Dekking, Jeffrey Shallit, and N. J. A. Sloane, Queens in exile: non-attacking queens on infinite chess boards, Electronic J. Combin., 27:1 (2020), #P1.52.
Index entries for linear recurrences with constant coefficients, signature (2,-2,2,-1).
FORMULA
From Wesley Ivan Hurt, Oct 13 2015: (Start)
G.f.: x*(3-2*x-x^2+2*x^3)/((x-1)^2*(x^2+1)).
a(n) = 2*a(n-1)-2*a(n-2)+2*a(n-3)-a(n-4) for n>4.
a(n) = n-2*(-1)^((2*n+1-(-1)^n)/4). (End)
a(n) = (-1+i)*((-i)^n+i*i^n)+n, where i = sqrt(-1). - Colin Barker, Oct 19 2015
a(n) = 1 + A004443(n-1). - Alois P. Heinz, Jan 23 2022
MAPLE
MATHEMATICA
Table[BitXor[n - 1, 2] + 1, {n, 77}]
CoefficientList[Series[(3 - 2*x - x^2 + 2*x^3)/((x - 1)^2*(x^2 + 1)), {x, 0, 100}], x] (* Wesley Ivan Hurt, Oct 13 2015 *)
LinearRecurrence[{2, -2, 2, -1}, {3, 4, 1, 2}, 80] (* Vincenzo Librandi, Oct 14 2015 *)
PROG
(PARI) a(n) = bitxor(n-1, 2)+1 \\ Charles R Greathouse IV, May 06 2015
(PARI) Vec(x*(3-2*x-x^2+2*x^3)/((x-1)^2*(x^2+1)) + O(x^100)) \\ Altug Alkan, Oct 13 2015
(PARI) a(n) = (-1+I)*((-I)^n+I*I^n)+n \\ Colin Barker, Oct 19 2015
(Magma) [n-2*(-1)^((2*n+1-(-1)^n) div 4): n in [1..100]]; // Wesley Ivan Hurt, Oct 13 2015
(Magma) I:=[3, 4, 1, 2]; [n le 4 select I[n] else 2*Self(n-1)-2*Self(n-2)+2*Self(n-3)-Self(n-4): n in [1..80]]; // Vincenzo Librandi, Oct 14 2015
(Magma) /* By definition: */ &cat[[4*k+3, 4*k+4, 4*k+1, 4*k+2]: k in [0..20]]; // Bruno Berselli, Oct 19 2015
(Python)
def a(n): return ((n-1)^2) + 1
print([a(n) for n in range(1, 81)]) # Michael S. Branicky, Mar 21 2023
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Ivan Neretin, May 06 2015
STATUS
approved