OFFSET
0,4
COMMENTS
This sequence is a variant of A342697; here we deal with bit triples in a "cyclic" binary representation of n.
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 1 10 1
3 3 11 11
4 0 100 0
5 7 101 111
6 7 110 111
7 7 111 111
8 0 1000 0
9 9 1001 1001
10 5 1010 101
11 15 1011 1111
12 12 1100 1100
13 15 1101 1111
14 15 1110 1111
15 15 1111 1111
PROG
(PARI) a(n) = my (w=#binary(n)); sum(k=0, w-1, ((bittest(n, (k-1)%w)+bittest(n, k%w)+bittest(n, (k+1)%w))>=2) * 2^k)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Mar 18 2021
STATUS
approved