OFFSET
0,4
COMMENTS
In other words, we right pad the binary expansion of the lesser of n and k with zeros (provided it is positive) so that both numbers have the same number of binary digits, and then apply the bitwise XOR operator.
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..10010
Rémy Sigrist, Colored representation of the table for n, k < 2^10
FORMULA
EXAMPLE
Array T(n, k) begins:
n\k| 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
---+-------------------------------------------------------
0| 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1| 1 0 0 1 0 1 2 3 0 1 2 3 4 5 6 7
2| 2 0 0 1 0 1 2 3 0 1 2 3 4 5 6 7
3| 3 1 1 0 2 3 0 1 4 5 6 7 0 1 2 3
4| 4 0 0 2 0 1 2 3 0 1 2 3 4 5 6 7
5| 5 1 1 3 1 0 3 2 2 3 0 1 6 7 4 5
6| 6 2 2 0 2 3 0 1 4 5 6 7 0 1 2 3
7| 7 3 3 1 3 2 1 0 6 7 4 5 2 3 0 1
8| 8 0 0 4 0 2 4 6 0 1 2 3 4 5 6 7
9| 9 1 1 5 1 3 5 7 1 0 3 2 5 4 7 6
10| 10 2 2 6 2 0 6 4 2 3 0 1 6 7 4 5
11| 11 3 3 7 3 1 7 5 3 2 1 0 7 6 5 4
12| 12 4 4 0 4 6 0 2 4 5 6 7 0 1 2 3
13| 13 5 5 1 5 7 1 3 5 4 7 6 1 0 3 2
14| 14 6 6 2 6 4 2 0 6 7 4 5 2 3 0 1
15| 15 7 7 3 7 5 3 1 7 6 5 4 3 2 1 0
PROG
(PARI) T(n, k, op=bitxor, w=m->#binary(m)) = { op(n*2^max(0, w(k)-w(n)), k*2^max(0, w(n)-w(k))) }
CROSSREFS
KEYWORD
AUTHOR
Rémy Sigrist, May 29 2021
STATUS
approved