login
A037454
a(n) = Sum_{i=0..m} d(i)*6^i, where Sum_{i=0..m} d(i)*3^i is the base 3 representation of n.
6
0, 1, 2, 6, 7, 8, 12, 13, 14, 36, 37, 38, 42, 43, 44, 48, 49, 50, 72, 73, 74, 78, 79, 80, 84, 85, 86, 216, 217, 218, 222, 223, 224, 228, 229, 230, 252, 253, 254, 258, 259, 260, 264, 265, 266, 288, 289, 290, 294, 295, 296, 300, 301, 302, 432, 433, 434, 438
OFFSET
0,3
LINKS
FORMULA
From Peter Bala, Dec 01 2016: (Start)
a(n) = n + 1/2*Sum_{k >= 1} 6^k*floor(n/3^k). Cf. A037462, A007091 and A102491.
a(0) = 0; a(n) = 6*a(n/3) if n == 0 (mod 3) else a(n) = a(n-1) + 1. (End)
MAPLE
seq(n + (1/2)*add(6^k*floor(n/3^k), k = 1..floor(ln(n)/ln(3))), n = 1..100); # Peter Bala, Dec 01 2016
MATHEMATICA
t = Table[FromDigits[RealDigits[n, 3], 6], {n, 0, 100}]
(* Clark Kimberling, Aug 03 2012 *)
PROG
(Julia)
function a(n)
m, r, b = n, 0, 1
while m > 0
m, q = divrem(m, 3)
r += b * q
b *= 6
end
r end; [a(n) for n in 0:57] |> println # Peter Luschny, Jan 03 2021
CROSSREFS
KEYWORD
nonn,base,easy
EXTENSIONS
Offset changed to 0 by Clark Kimberling, Aug 03 2012
STATUS
approved