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

A353829
Inverse permutation to A353828.
2
0, 1, 2, 3, 4, 7, 6, 5, 8, 9, 10, 11, 12, 13, 22, 21, 20, 19, 18, 17, 14, 15, 16, 25, 24, 23, 26, 27, 28, 29, 30, 31, 34, 33, 32, 35, 36, 37, 38, 39, 40, 67, 66, 65, 64, 63, 62, 59, 60, 61, 58, 57, 56, 55, 54, 53, 50, 51, 52, 43, 42, 41, 44, 45, 46, 47, 48, 49
OFFSET
0,3
EXAMPLE
A353828(7) = 5, so a(5) = 7.
PROG
(PARI) a(n) = {
my (d=[], t, p=1);
while (n, d=concat(t=[0, 1, -1][1+n%3], d); n=(n-t)/3);
for (k=1, #d, if (d[k], p*=d[k]=p*d[k]));
fromdigits(d, 3);
}
CROSSREFS
Cf. A353828.
Sequence in context: A222246 A353828 A321726 * A267299 A077223 A265369
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, May 08 2022
STATUS
approved