login
A346511
a(n) = bitwise XOR of decimal digits of n.
2
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 2, 3, 0, 1, 6, 7, 4, 5, 10, 11, 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 5, 4, 7, 6, 1, 0, 3, 2, 13, 12, 6, 7, 4, 5, 2, 3, 0, 1, 14, 15, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 8, 9, 10
OFFSET
0,3
EXAMPLE
a(12) = 1 XOR 2 = 01_2 XOR 10_2 = 11_2 = 3.
MAPLE
b:= l-> `if`(l=[], 0, Bits[Xor](l[1], b(subsop(1=[][], l)))):
a:= n-> b(convert(n, base, 10)):
seq(a(n), n=0..82); # Alois P. Heinz, Jul 21 2021
MATHEMATICA
Table[BitXor @@ IntegerDigits[n], {n, 0, 100}] (* Amiram Eldar, Jul 21 2021 *)
PROG
(Sage)
def XOR(a, b):
return a ^^ b
[reduce(XOR, map(lambda x: int(x), str(n))) for n in (0..1000)]
(PARI) a(n) = my(d=digits(n), k=0); for (i=1, #d, k= bitxor(k, d[i])); k; \\ Michel Marcus, Jul 21 2021
CROSSREFS
Sequence in context: A247149 A330350 A222210 * A177894 A287877 A175398
KEYWORD
base,nonn
AUTHOR
Jeremias M. Gomes, Jul 21 2021
STATUS
approved