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”).

A366389
Variant of bijective bit-reverse of n (A057889) for which it holds that a(n) == n (mod 3).
5
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 26, 12, 22, 14, 15, 16, 17, 18, 25, 20, 21, 13, 29, 24, 19, 11, 27, 28, 23, 30, 31, 32, 33, 34, 98, 36, 82, 50, 57, 40, 74, 42, 106, 104, 45, 58, 122, 48, 70, 38, 51, 88, 86, 54, 118, 56, 39, 46, 110, 60, 94, 62, 63, 64, 65, 66, 97, 68, 81, 49, 113, 72, 73, 41, 105, 100, 89, 114, 121
OFFSET
0,3
COMMENTS
Like A057889, also this is a self-inverse permutation of nonnegative integers.
FORMULA
If A057889(n) == n mod 3, then a(n) = A057889(n), otherwise a(n) = A073675(A057889(n)) = A057889(A073675(n)).
For all n >= 0, A010872(a(n)) = A010872(n).
PROG
(PARI)
A030101(n) = if(n<1, 0, subst(Polrev(binary(n)), x, 2));
A057889(n) = if(!n, n, A030101(n/(2^valuation(n, 2))) * (2^valuation(n, 2)));
A073675(n) = if(valuation(n, 2)%2, n/2, 2*n);
A366389(n) = { my(u=A057889(n)); if(!((u-n)%3), u, A073675(u)); };
CROSSREFS
Cf. A010872, A030101, A057889, A073675, A366378, A366379, A366390 (Dirichlet inverse), A366392.
Cf. also A118967.
Sequence in context: A106604 A095205 A344325 * A161978 A132579 A004850
KEYWORD
nonn,look
AUTHOR
Antti Karttunen, Oct 22 2023
STATUS
approved