OFFSET
0,3
COMMENTS
a(n) = Sum_{i=0..m} d(i)*9^i, where Sum_{i=0..m} d(i)*3^i is the base-3 representation of n.
Numbers that can be written using only digits 0, 1 and 2 in base 9. Also, write n in base 3, read as base 9: (3) [n] (9) in base change notation. a(3n+k) = 9a(n)+k for k in {0,1,2}. - Franklin T. Adams-Watters, Jul 24 2006
Also, every term k corresponds to a unique pair i,j with k = a(i) + 3*a(j) (similarly to the Moser-de Bruijn sequence). - Luis Rato, May 02 2024
FORMULA
G.f. f(x) = Sum_{j>=0} 9^j*x^(3^j)*(1+x^(3^j)-2*x^(2*3^j))/((1-x)*(1-x^(3^(j+1)))) satisfies f(x) = 9*(x^2+x+1)*f(x^3) + x*(1+2*x)/(1-x^3). - Robert Israel, Apr 13 2015
MATHEMATICA
Table[FromDigits[RealDigits[n, 3], 9], {n, 1, 100}] (* Clark Kimberling, Aug 14 2012 *)
Select[Range[0, 1000], Total[IntegerDigits[#, 3]]==Total[IntegerDigits[#, 9]]&] (* Harvey P. Dale, Feb 17 2020 *)
PROG
(PARI) a(n) = {my(d = digits(n, 3)); subst(Pol(d), x, 9); } \\ Michel Marcus, Apr 09 2015
(Julia)
function a(n)
m, r, b = n, 0, 1
while m > 0
m, q = divrem(m, 3)
r += b * q
b *= 9
end
r end
[a(n) for n in 0:53] |> println # Peter Luschny, Jan 03 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
EXTENSIONS
Edited by N. J. A. Sloane at the suggestion of Andrew S. Plewe, Jun 08 2007
Offset changed to 0 by Clark Kimberling, Aug 14 2012
STATUS
approved