A215090 a(n) = Sum_{i=0..m} d(i)*3^i, where Sum_{i=0..m} d(i)*4^i is the base-4 representation of n.
0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 17, 18, 18, 19, 20, 21, 18, 19, 20, 21, 21, 22, 23, 24, 24, 25, 26, 27, 27, 28, 29, 30, 27, 28, 29, 30, 30, 31, 32, 33, 33, 34, 35, 36, 36, 37, 38, 39, 27, 28, 29, 30, 30, 31, 32
Offset: 0
Links
- Seiichi Manyama, Table of n, a(n) for n = 0..10000 (terms 0..1000 from Clark Kimberling)
Crossrefs
Cf. A023717.
Programs
-
Julia
function a(n) m, r, b = n, 0, 1 while m > 0 m, q = divrem(m, 4) r += b * q b *= 3 end r end; [a(n) for n in 0:70] |> println # Peter Luschny, Jan 03 2021
-
Mathematica
t = Table[FromDigits[RealDigits[n, 4], 3], {n, 0, 100}]
-
PARI
a(n) = fromdigits(digits(n, 4), 3); \\ Michel Marcus, May 02 2018
Formula
a(n) = 3*a(n/4) if n == 0 (mod 4); otherwise a(n) = a(n-1)+1.