OFFSET
0,5
LINKS
Robert Israel, Table of n, a(n) for n = 0..10000
MAPLE
f:= proc(n) local L, i;
L:= convert(n, base, 2);
add((1-L[i])*10^(i-1), i=1..nops(L))
end proc:
map(f, [$0..100]); # Robert Israel, Sep 17 2024
MATHEMATICA
Table[FromDigits[IntegerDigits[n, 2] /. {0 -> 1, 1 -> 0}], {n, 0, 47}] (* or *)
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 *)
PROG
(PARI) A256078(n)=!n+eval(Strchr(apply(d->49-d, binary(n))))
(Python)
def a(n): return int(bin(1 if n==0 else n^((1 << n.bit_length())-1))[2:])
print([a(n) for n in range(48)]) # Michael S. Branicky, Dec 21 2022
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
M. F. Hasler, Mar 22 2015
STATUS
approved