login
This site is supported by donations to The OEIS Foundation.

 

Logo

"Email this user" was broken Aug 14 to 9am Aug 16. If you sent someone a message in this period, please send it again.

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A004442 Natural numbers, pairs reversed: a(n) = n + (-1)^n; also Nimsum n + 1. 45
1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, 17, 16, 19, 18, 21, 20, 23, 22, 25, 24, 27, 26, 29, 28, 31, 30, 33, 32, 35, 34, 37, 36, 39, 38, 41, 40, 43, 42, 45, 44, 47, 46, 49, 48, 51, 50, 53, 52, 55, 54, 57, 56, 59, 58, 61, 60, 63, 62, 65, 64, 67, 66, 69 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,3

COMMENTS

A self-inverse permutation of the natural numbers.

Nonnegative numbers rearranged with least disturbance to maintain a(n) not equal to n. - Amarnath Murthy, Sep 13 2002

Essentially lodumo_2 of A059841 . [Philippe Deléham, Apr 26 2009]

a(n) = A180176(n) for n >= 20. [Reinhard Zumkeller, Aug 15 2010]

REFERENCES

E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Academic Press, NY, 2 vols., 1982, see p. 60.

J. H. Conway, On Numbers and Games. Academic Press, NY, 1976, pp. 51-53.

LINKS

Table of n, a(n) for n=0..68.

Index entries for sequences related to Nim-sums

Index entries for sequences that are permutations of the natural numbers

FORMULA

a(n) = n XOR 1. - Odimar Fabeny, Sep 05 2004

G.f.: (1-x+2x^2)/((1-x)*(1-x^2)). - Mitchell Harris, Jan 10 2005

a(n+1)= lod_2(A059841(n)). [Philippe Deléham, Apr 26 2009]

a(n) = 2*n-a(n-1)-1 with n>0, a(0)=1. [Vincenzo Librandi, Nov 18 2010]

a(n) = sum(k=1..n-1, (-1)^(n-1-k)*C(n+1,k)). [Mircea Merca, Feb 07 2013]

For n > 1, a(n)^a(n) == 1 (mod n). - Thomas Ordowski, Jan 04 2016

MAPLE

a[0]:=1:a[1]:=0:for n from 2 to 70 do a[n]:=a[n-2]+2 od: seq(a[n], n=0..68); # Zerinvary Lajos, Feb 19 2008

MATHEMATICA

Table[n + (-1)^n, {n, 0, 72}] (* or *)

CoefficientList[Series[(1 - x + 2x^2)/((1 - x)(1 - x^2)), {x, 0, 72}], x] (* Robert G. Wilson v, Jun 16 2006 *)

PROG

(Haskell)

import Data.List (transpose)

import Data.Bits (xor)

a004442 = xor 1 :: Integer -> Integer

a004442_list = concat $ transpose [a005408_list, a005843_list]

-- Reinhard Zumkeller, Jun 23 2013, Feb 01 2013, Oct 20 2011

(PARI) a(n)=n+(-1)^n \\ Charles R Greathouse IV, Nov 20 2012

(PARI) Vec((1-x+2*x^2)/((1-x)*(1-x^2)) + O(x^100)) \\ Altug Alkan, Feb 04 2016

CROSSREFS

Cf. A003987, A004443, A004444. Equals A014681 - 1.

Cf. A005843, A005408.

Sequence in context: A066250 A066251 A114882 * A065190 A152208 A282650

Adjacent sequences:  A004439 A004440 A004441 * A004443 A004444 A004445

KEYWORD

nonn,easy,nice

AUTHOR

N. J. A. Sloane.

EXTENSIONS

Offset adjusted by Reinhard Zumkeller, Mar 05 2010

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy .

Last modified August 20 20:09 EDT 2017. Contains 290837 sequences.