login
A352417
Inverse permutation to A352416.
2
0, 1, 3, 4, 2, 9, 10, 12, 13, 5, 6, 7, 27, 28, 30, 31, 11, 36, 37, 39, 40, 14, 15, 16, 18, 19, 21, 22, 8, 81, 82, 84, 85, 29, 90, 91, 93, 94, 32, 33, 34, 108, 109, 111, 112, 38, 117, 118, 120, 121, 41, 42, 43, 45, 46, 48, 49, 17, 54, 55, 57, 58, 20, 63, 64, 66
OFFSET
0,3
EXAMPLE
A352416(7) = 11, so a(11) = 7.
PROG
(PARI) a(n) = { my (p=[1, 2]); for (k=2, oo, if (n<=p[k], my (v=0, d); while (n, v+=3^k*d=n\p[k]; if (d==2, v/=3); n-=d*p[k]; k--); return (v/3), p = concat(p, 2*p[k]+p[k-1]))) }
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Mar 15 2022
STATUS
approved