login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A371974
For any positive integer n with binary expansion (b_1, ..., b_w) (where b_1 = 1), the binary expansion of a(n) is (c_1, ..., c_w) with c_k = (Sum_{i = 1 mod (w+1-k)} b_i) mod 2 for k = 1..w; a(0) = 0.
3
0, 1, 3, 2, 7, 4, 6, 5, 15, 10, 12, 9, 14, 11, 13, 8, 31, 20, 26, 17, 28, 23, 25, 18, 30, 21, 27, 16, 29, 22, 24, 19, 63, 46, 52, 37, 58, 43, 49, 32, 60, 45, 55, 38, 57, 40, 50, 35, 62, 47, 53, 36, 59, 42, 48, 33, 61, 44, 54, 39, 56, 41, 51, 34, 127, 88, 110
OFFSET
0,3
COMMENTS
This sequence is a permutation of the nonnegative integers with inverse A371975.
FORMULA
A070939(a(n)) = A070939(n).
a(n) mod 2 = A010060(n).
EXAMPLE
For n = 42: the binary expansion of 42 is "101010":
b_1 b_2 b_3 b_4 b_5 b_6
1 0 1 0 1 0
c_1 = 1 = 1 mod 2
c_2 = 1 + 0 = 1 mod 2
c_3 = 1 + 1 = 0 mod 2
c_4 = 1 + 0 = 1 mod 2
c_5 = 1 + 1 + 1 = 1 mod 2
c_6 = 1 + 0 + 1 + 0 + 1 + 0 = 1 mod 2
- so the binary expansion of a(42) is "110111", and a(42) = 55.
PROG
(PARI) a(n) = { my (b = binary(n), c = vector(#b)); for (k = 1, #c, forstep (i = 1, #b, #b+1-k, c[k] += b[i]; ); ); fromdigits(c % 2, 2); }
CROSSREFS
See A341335 and A371976 for similar sequences.
Cf. A010060, A070939, A371975 (inverse).
Sequence in context: A341911 A341916 A360960 * A344878 A344875 A178910
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Apr 14 2024
STATUS
approved