

A014681


Fix 0; exchange even and odd numbers.


27



0, 2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15, 18, 17, 20, 19, 22, 21, 24, 23, 26, 25, 28, 27, 30, 29, 32, 31, 34, 33, 36, 35, 38, 37, 40, 39, 42, 41, 44, 43, 46, 45, 48, 47, 50, 49, 52, 51, 54, 53, 56, 55, 58, 57, 60, 59, 62, 61, 64, 63, 66, 65, 68, 67, 70
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,2


COMMENTS

A selfinverse permutation of the nonnegative numbers.
If we ignore the first term 0, then this can be obtained as: a(n) is the smallest number different from n, not occurring earlier and coprime to n.  Amarnath Murthy, Apr 16 2003 [Corrected by Alois P. Heinz, May 06 2015]
a(0)=0, a(1)=2, then repeatedly subtract 1 and then add 3.  Jon Perry, Aug 12 2014
The biggest term of the pair [a(n), a(n+1)] is always even. This is the lexicographically first sequence with this property starting with a(1) = 0 and always extented with the smallest integer not yet present.  Eric Angelini, Feb 20 2017


LINKS

Derek Orr, Table of n, a(n) for n = 0..10000
Index entries for sequences that are permutations of the natural numbers
Index entries for linear recurrences with constant coefficients, signature (1,1,1).


FORMULA

G.f.: (2x+x^2)/((1x)*(1x^2)). [ N. J. A. Sloane ]
a(n) = n(1)^n = a(n1)+a(n2)a(n3) = a(n2)+2.  Henry Bottomley, Mar 29 2000
a(0) = 0; a(2m+1) = 2m+2; for m > 0 a(2m) = 2m  1. [George E. Antoniou (george.antoniou(AT)montclair.edu), Dec 04 2001]
a(n) = n(1)^n+0^n for n>=0.  Bruno Berselli, Nov 16 2010


MATHEMATICA

Table[n  (1)^n, {n, 1, 60} ]
Join[{0}, LinearRecurrence[{1, 1, 1}, {2, 1, 4}, 69]] (* Ray Chandler, Sep 03 2015 *)


PROG

(PARI) a(n)=n  (1)^n \\ Charles R Greathouse IV, May 06 2015


CROSSREFS

Composing this permutation with A065190 gives A065164.
Equals 1 + A004442.
Cf. A103889.
Sequence in context: A167542 A167419 A114285 * A103889 A137805 A163501
Adjacent sequences: A014678 A014679 A014680 * A014682 A014683 A014684


KEYWORD

nonn,easy


AUTHOR

Mohammad K. Azarian


STATUS

approved



