OFFSET
0,3
COMMENTS
Leading zeros are ignored.
This sequence has similarities with A343049; here we scan the binary representations from left to right, there from right to left.
LINKS
EXAMPLE
The first terms, in decimal and in binary, are:
n a(n) bin(n) bin(a(n))
-- ---- ------ ---------
0 0 0 0
1 1 1 1
2 2 10 10
3 3 11 11
4 4 100 100
5 5 101 101
6 7 110 111
7 7 111 111
8 8 1000 1000
9 9 1001 1001
10 10 1010 1010
11 11 1011 1011
12 14 1100 1110
13 15 1101 1111
14 15 1110 1111
15 15 1111 1111
PROG
(PARI) a(n, base=2) = { my (d=digits(n, base), f=vector(base), t); for (k=1, #d, f[1+d[k]]++; if (f[1+d[k]]==vecmax(f), t=d[k], d[k]=t)); fromdigits(d, base) }
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Apr 10 2021
STATUS
approved