login
A341335
For any number n with binary expansion (b_1, ..., b_k), the binary expansion of a(n), say (c_1, ..., c_k) satisfies c_m = Sum_{d | m} b_d mod 2 for m = 1..k.
3
0, 1, 3, 2, 7, 6, 5, 4, 15, 14, 13, 12, 10, 11, 8, 9, 31, 30, 29, 28, 27, 26, 25, 24, 21, 20, 23, 22, 17, 16, 19, 18, 63, 62, 61, 60, 59, 58, 57, 56, 54, 55, 52, 53, 50, 51, 48, 49, 42, 43, 40, 41, 46, 47, 44, 45, 35, 34, 33, 32, 39, 38, 37, 36, 127, 126, 125
OFFSET
0,3
COMMENTS
This sequence is a permutation of the nonnegative integers with inverse A341336.
This sequence operates on binary expansions in the same way as the XOR-Moebius transform described in A295901.
This sequence has only two fixed points: a(0) = 0, a(1) = 1.
FORMULA
a(n) < 2^k for any n < 2^k.
a(floor(n/2)) = floor(a(n)/2).
a(2^k) = 2^(k+1) - 1 for any k >= 0.
EXAMPLE
For n = 42:
- the binary expansion of 42 is (1, 0, 1, 0, 1, 0),
- the binary expansion of a(42) has 6 digits:
- the 1st digit = 1 mod 2 = 1,
- the 2nd digit = 1 + 0 mod 2 = 1,
- the 3rd digit = 1 + 1 mod 2 = 0,
- the 4th digit = 1 + 0 + 0 mod 2 = 1,
- the 5th digit = 1 + 1 mod 2 = 0,
- the 6th digit = 1 + 0 + 1 + 0 mod 2 = 0,
- so the binary expansion of a(42) is "110100",
- and a(42) = 52.
PROG
(PARI) a(n) = { my (b=binary(n), c=vector(#b)); for (m=1, #b, fordiv (m, d, c[m]=(c[m] + b[d])%2)); fromdigits(c, 2) }
CROSSREFS
Sequence in context: A341336 A276344 A334727 * A276343 A054429 A269398
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Apr 25 2021
STATUS
approved