OFFSET
0,8
COMMENTS
Leading 0's are taken into account.
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..10010
FORMULA
EXAMPLE
Array A(n, k) begins:
n\k| 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
---+-----------------------------------------------------------
0| 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1| 0 1 2 1 4 1 2 1 8 1 2 1 4 1 2 1
2| 0 2 2 2 4 2 2 2 8 2 2 2 4 2 2 2
3| 0 1 2 3 4 5 6 3 8 9 10 3 12 5 6 3
4| 0 4 4 4 4 4 4 4 8 4 4 4 4 4 4 4
5| 0 1 2 5 4 5 6 5 8 9 10 5 12 5 6 5
6| 0 2 2 6 4 6 6 6 8 10 10 6 12 6 6 6
7| 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 7
8| 0 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
9| 0 1 2 9 4 9 10 9 8 9 10 9 12 9 10 9
10| 0 2 2 10 4 10 10 10 8 10 10 10 12 10 10 10
.
For n = 876 and k = 425:
- the corresponding binary expansions and pairings of 0's are as follows (stars indicate least positions of 0's):
* * *
876 ... 0 0 0 1 1 0 1 1 0 1 1 0 0
\ \ \ \ | / /
425 ... 0 0 0 0 1 1 0 1 0 1 0 0 1
* * * * * *
-----------------------------
428 ... 0 0 0 0 1 1 0 1 0 1 1 0 0
- so A(876, 425) = 428.
PROG
(PARI) A(n, k) = { my (v=0, zn=0, zk=0, w=1, b=1); while (n || k, if (n%2==0, zn++); if (k%2==0, zk++); if (max(zn, zk)==w, w++, v+=b); n\=2; k\=2; b*=2); v }
CROSSREFS
KEYWORD
AUTHOR
Rémy Sigrist, Jun 25 2022
STATUS
approved