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!)
A256078 Write n in binary, exchange digits '0' <-> '1'. 10

%I #21 Dec 21 2022 20:12:34

%S 1,0,1,0,11,10,1,0,111,110,101,100,11,10,1,0,1111,1110,1101,1100,1011,

%T 1010,1001,1000,111,110,101,100,11,10,1,0,11111,11110,11101,11100,

%U 11011,11010,11001,11000,10111,10110,10101,10100,10011,10010,10001,10000

%N Write n in binary, exchange digits '0' <-> '1'.

%C Binary representation of A035327.

%C A base-2 analog of A048379.

%t Table[FromDigits[IntegerDigits[n, 2] /. {0 -> 1, 1 -> 0}], {n, 0, 47}] (* or *)

%t Table[FromDigits@ IntegerDigits[BitXor[n, 2^IntegerPart[Log[2, n] + 1] - 1], 2], {n, 0, 47}] (* _Michael De Vlieger_, Mar 22 2015, the latter based on _Alonso del Arte_ at A035327 *)

%o (PARI) A256078(n)=!n+eval(Strchr(apply(d->49-d,binary(n))))

%o (Python)

%o def a(n): return int(bin(1 if n==0 else n^((1 << n.bit_length())-1))[2:])

%o print([a(n) for n in range(48)]) # _Michael S. Branicky_, Dec 21 2022

%Y Cf. A035327, A048379.

%K nonn,base,easy

%O 0,5

%A _M. F. Hasler_, Mar 22 2015

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 June 2 17:45 EDT 2024. Contains 373045 sequences. (Running on oeis4.)