OFFSET
0,3
LINKS
Seiichi Manyama, Table of n, a(n) for n = 0..10000
EXAMPLE
13 = 23_5, so a(13) = 2*4 + 3 = 11.
14 = 24_5, so a(14) = 2*4 + 4 = 12.
15 = 30_5, so a(15) = 3*4 + 0 = 12.
16 = 31_5, so a(16) = 3*4 + 1 = 13.
PROG
(Ruby)
def f(k, ary)
(0..ary.size - 1).inject(0){|s, i| s + ary[i] * k ** i}
end
def A(k, n)
(0..n).map{|i| f(k, i.to_s(k + 1).split('').map(&:to_i).reverse)}
end
p A(4, 100)
(PARI) a(n) = fromdigits(digits(n, 5), 4); \\ Michel Marcus, May 02 2018
(Julia)
function a(n)
m, r, b = n, 0, 1
while m > 0
m, q = divrem(m, 5)
r += b * q
b *= 4
end
r end; [a(n) for n in 0:73] |> println # Peter Luschny, Jan 03 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Seiichi Manyama, Apr 30 2018
STATUS
approved