OFFSET
0,3
LINKS
Rémy Sigrist, Colored logarithmic scatterplot of the first 3^10 terms (where the color is function of A053735(n) + A081604(n))
FORMULA
EXAMPLE
The first terms, alongside the ternary representation of n and the binary representation of a(n), are:
n a(n) tern(n) bin(a(n))
-- ---- ------- ---------
0 0 0 0
1 1 1 1
2 3 2 11
3 2 10 10
4 5 11 101
5 11 12 1011
6 6 20 110
7 13 21 1101
8 27 22 11011
9 4 100 100
10 9 101 1001
11 19 102 10011
12 10 110 1010
PROG
(PARI) a(n) = if (n==0, 0, my (d=n%3); a(n\3) * 2^(d+1) + (2^d-1))
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Jun 13 2018
STATUS
approved