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!)
A048724 Write n and 2n in binary and add them mod 2. 60

%I #55 Jan 19 2022 11:16:15

%S 0,3,6,5,12,15,10,9,24,27,30,29,20,23,18,17,48,51,54,53,60,63,58,57,

%T 40,43,46,45,36,39,34,33,96,99,102,101,108,111,106,105,120,123,126,

%U 125,116,119,114,113,80,83,86,85,92,95,90,89,72,75,78,77,68,71,66,65,192

%N Write n and 2n in binary and add them mod 2.

%C Reversing binary representation of -n. Converting sum of powers of 2 in binary representation of a(n) to alternating sum gives -n. Note that the alternation is applied only to the nonzero bits and does not depend on the exponent of two. All integers have a unique reversing binary representation (see cited exercise for proof). Complement of A065621. - _Marc LeBrun_, Nov 07 2001

%C A permutation of the "evil" numbers A001969. - _Marc LeBrun_, Nov 07 2001

%C A048725(n) = a(a(n)). - _Reinhard Zumkeller_, Nov 12 2004

%D D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, 1969, Vol. 2, p. 178, (exercise 4.1. Nr. 27)

%H T. D. Noe, <a href="/A048724/b048724.txt">Table of n, a(n) for n = 0..1023</a>

%H P. Mathonet, M. Rigo, M. Stipulanti and N. Zénaïdi, <a href="https://arxiv.org/abs/2201.06636">On digital sequences associated with Pascal's triangle</a>, arXiv:2201.06636 [math.NT], 2022.

%H H. D. Nguyen, <a href="http://www.rowan.edu/colleges/csm/departments/math/facultystaff/nguyen/papers/mixing-ptm-rademacher.pdf">A mixing of Prouhet-Thue-Morse sequences and Rademacher functions</a>, 2014. See Example 20. - _N. J. A. Sloane_, May 24 2014

%H Ralf Stephan, <a href="/somedcgf.html">Some divide-and-conquer sequences ...</a>

%H Ralf Stephan, <a href="/A079944/a079944.ps">Table of generating functions</a>

%F a(n) = Xmult(n, 3) (or n XOR (n<<1)).

%F a(n) = A065621(-n).

%F a(2n) = 2a(n), a(2n+1) = 2a(n) + 2(-1)^n + 1.

%F G.f. 1/(1-x) * sum(k>=0, 2^k*(3t-t^3)/(1+t)/(1+t^2), t=x^2^k). - _Ralf Stephan_, Sep 08 2003

%F a(n) = sum(k=0, n, (1-(-1)^round(+n/2^k))/2*2^k). - _Benoit Cloitre_, Apr 27 2005

%F a(n) = A001969(A003188(n)). - _Philippe Deléham_, Apr 29 2005

%F a(n) = A106409(2*n) for n>0. - _Reinhard Zumkeller_, May 02 2005

%F a(n) = A142149(2*n). - _Reinhard Zumkeller_, Jul 15 2008

%e 12 = 1100 in binary, 24=11000 and their sum is 10100=20, so a(12)=20.

%e a(4) = 12 = + 8 + 4 -> - 8 + 4 = -4.

%p a:= n-> Bits[Xor](n, n+n):

%p seq(a(n), n=0..100); # _Alois P. Heinz_, Apr 06 2016

%t Table[ BitXor[2n, n], {n, 0, 65}] (* _Robert G. Wilson v_, Jul 06 2006 *)

%o (PARI) a(n)=bitxor(n,2*n) \\ _Charles R Greathouse IV_, Jan 04 2013

%o (Haskell)

%o import Data.Bits (xor, shiftL)

%o a048724 n = n `xor` shiftL n 1 :: Integer

%o -- _Reinhard Zumkeller_, Mar 06 2013

%o (Python)

%o def A048724(n): return n^(n<<1) # _Chai Wah Wu_, Apr 05 2021

%Y Cf. A048720, A048725, A048726, A048728.

%Y Bisection of A003188.

%Y See also A065620, A065621.

%Y Cf. A242399.

%K nonn,nice,look,easy,base

%O 0,2

%A _Antti Karttunen_, Apr 26 1999

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 20:08 EDT 2024. Contains 371963 sequences. (Running on oeis4.)