OFFSET
0,3
LINKS
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