The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A256008 Self-inverse permutation of positive integers: 4k+1 is swapped with 4k+3, and 4k+2 with 4k+4. 6
3, 4, 1, 2, 7, 8, 5, 6, 11, 12, 9, 10, 15, 16, 13, 14, 19, 20, 17, 18, 23, 24, 21, 22, 27, 28, 25, 26, 31, 32, 29, 30, 35, 36, 33, 34, 39, 40, 37, 38, 43, 44, 41, 42, 47, 48, 45, 46, 51, 52, 49, 50, 55, 56, 53, 54, 59, 60, 57, 58, 63, 64, 61, 62, 67, 68, 65, 66, 71, 72, 69, 70, 75, 76, 73, 74, 79 (list; graph; refs; listen; history; text; internal format)
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
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.
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
A256008:=n->n-2*(-1)^((2*n+1-(-1)^n)/4): seq(A256008(n), n=1..100); # Wesley Ivan Hurt, Oct 13 2015
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
Sequence in context: A333454 A021971 A260822 * A171073 A021297 A124909
KEYWORD
nonn,easy
AUTHOR
Ivan Neretin, May 06 2015
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | 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 May 14 16:56 EDT 2024. Contains 372533 sequences. (Running on oeis4.)