cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

This page as a plain text file.
%I A256078 #26 Sep 18 2024 08:43:18
%S A256078 1,0,1,0,11,10,1,0,111,110,101,100,11,10,1,0,1111,1110,1101,1100,1011,
%T A256078 1010,1001,1000,111,110,101,100,11,10,1,0,11111,11110,11101,11100,
%U A256078 11011,11010,11001,11000,10111,10110,10101,10100,10011,10010,10001,10000
%N A256078 Write n in binary, exchange digits '0' <-> '1'.
%C A256078 Binary representation of A035327.
%C A256078 A base-2 analog of A048379.
%H A256078 Robert Israel, <a href="/A256078/b256078.txt">Table of n, a(n) for n = 0..10000</a>
%p A256078 f:= proc(n) local L,i;
%p A256078   L:= convert(n,base,2);
%p A256078   add((1-L[i])*10^(i-1),i=1..nops(L))
%p A256078 end proc:
%p A256078 map(f, [$0..100]); # _Robert Israel_, Sep 17 2024
%t A256078 Table[FromDigits[IntegerDigits[n, 2] /. {0 -> 1, 1 -> 0}], {n, 0, 47}] (* or *)
%t A256078 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 A256078 (PARI) A256078(n)=!n+eval(Strchr(apply(d->49-d,binary(n))))
%o A256078 (Python)
%o A256078 def a(n): return int(bin(1 if n==0 else n^((1 << n.bit_length())-1))[2:])
%o A256078 print([a(n) for n in range(48)]) # _Michael S. Branicky_, Dec 21 2022
%Y A256078 Cf. A035327, A048379.
%K A256078 nonn,base,easy
%O A256078 0,5
%A A256078 _M. F. Hasler_, Mar 22 2015