editing
approved
editing
approved
(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
approved
editing
proposed
approved
editing
proposed
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
proposed
editing
editing
proposed
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. - _Peter Bala_, Dec 01 2016
a(0) = 0; a(n) = 6*a(n/3) if n == 0 (mod 3) else a(n) = a(n-1) + 1. (End)
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
a(n) = Sum_{i=0..m} d(i)*6^i: i=0,1,...,m}, , where Sum_{i=0..m} d(i)*3^i: i=0,1,...,m} is the base 3 representation of n.
a(n) = n + 1/2*Sum_{k >= 1} 6^k*floor(n/3^k). Cf. A037462, A007091 and A102491. - Peter Bala, Dec 01 2016
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
nonn,base,easy
approved
editing
proposed
approved
editing
proposed