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!)
A004443 Nimsum n + 2. 13

%I #72 Aug 08 2023 04:14:32

%S 2,3,0,1,6,7,4,5,10,11,8,9,14,15,12,13,18,19,16,17,22,23,20,21,26,27,

%T 24,25,30,31,28,29,34,35,32,33,38,39,36,37,42,43,40,41,46,47,44,45,50,

%U 51,48,49,54,55,52,53,58,59,56,57,62,63,60,61,66,67,64,65

%N Nimsum n + 2.

%C A self-inverse permutation of the natural numbers. - _Philippe Deléham_, Nov 22 2016

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

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

%H N. J. A. Sloane, <a href="/A004443/b004443.txt">Table of n, a(n) for n = 0..20000</a>

%H F. Michel Dekking, Jeffrey Shallit, and N. J. A. Sloane, <a href="https://doi.org/10.37236/8905">Queens in exile: non-attacking queens on infinite chess boards</a>, Electronic J. Combin., 27:1 (2020), #P1.52.

%H <a href="/index/Ni#Nimsums">Index entries for sequences related to Nim-sums</a>

%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (2,-2,2,-1).

%F a(n) = n XOR 2. - _Joerg Arndt_, Feb 07 2013

%F G.f.: (2-x-2x^2+3x^3)/((1-x)^2(1+x^2)). - _Ralf Stephan_, Apr 24 2004

%F The sequences 'Nimsum n + m' seem to have the general o.g.f. p(x)/q(x) with p, q polynomials and q(x) = (1-x)^2*Product_{k>=0} (1+x^(2^e(k))), with Sum_{k>=0} 2^e(k) = m. - _Ralf Stephan_, Apr 24 2004

%F a(n) = n + 2(-1)^floor(n/2). - Mitchell Harris, Jan 10 2005

%F a(n) = OR(n,2) - AND(n,2). - _Gary Detlefs_, Feb 06 2013

%F E.g.f.: 2*(sin(x) + cos(x)) + x*exp(x). - _Ilya Gutkovskiy_, Jul 01 2016

%F Sum_{n>=0,n<>2} (-1)^n/a(n) = -log(2) = -A002162. - _Peter McNair_, Aug 07 2023

%p nimsum := proc(a,b) local t1,t2,t3,t4,l; t1 := convert(a+2^200,base,2); t2 := convert(b+2^200,base,2); t3 := evalm(t1+t2); map(x->x mod 2, t3); t4 := convert(evalm(%),list); l := convert(t4,base,2,10); sum(l[k]*10^(k-1), k=1..nops(l)); end;

%p f := n -> n + 2*(-1)^floor(n/2); # _N. J. A. Sloane_, Jul 06 2019

%t Table[BitXor[n, 2], {n, 0, 100}] (* _T. D. Noe_, Feb 09 2013 *)

%o (PARI) a(n)=bitxor(n,2) \\ _Charles R Greathouse IV_, Oct 07 2015

%o (Python) for n in range(20): print(2^n) # _Oliver Knill_, Feb 16 2020

%Y Cf. A003987, A004442, A269526.

%Y Essentially the same as A256008 - 1.

%Y Also the second column of A274528.

%Y Cf. A002162.

%K nonn,easy

%O 0,1

%A _N. J. A. Sloane_

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 April 24 00:30 EDT 2024. Contains 371917 sequences. (Running on oeis4.)