login
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.
4
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,3
LINKS
Seiichi Manyama, Table of n, a(n) for n = 0..10000 (terms 0..1000 from Clark Kimberling)
FORMULA
a(n) = 3*a(n/4) if n == 0 (mod 4); otherwise a(n) = a(n-1)+1.
MATHEMATICA
t = Table[FromDigits[RealDigits[n, 4], 3], {n, 0, 100}]
PROG
(PARI) a(n) = fromdigits(digits(n, 4), 3); \\ Michel Marcus, May 02 2018
(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
CROSSREFS
Cf. A023717.
Sequence in context: A248231 A120503 A215781 * A083544 A367328 A057353
KEYWORD
nonn,base,easy
AUTHOR
Clark Kimberling, Aug 03 2012
STATUS
approved