OFFSET
1,2
COMMENTS
As well as being multiplicative, a(n) is a strong divisibility sequence, that is, gcd(a(n),a(m)) = a(gcd(n,m)) for n, m >= 1. In particular, a(n) is a divisibility sequence: if n divides m then a(n) divides a(m). - Peter Bala, Feb 21 2019
The largest divisor of n not divisible by 3. - Amiram Eldar, Sep 15 2020
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
FORMULA
Multiplicative with a(p^e) = 1 if p = 3, otherwise p^e. - Mitch Harris, Apr 19 2005
a(0) = 0, a(3*n) = a(n), a(3*n+1) = 3*n+1, a(3*n+2) = 3*n+2.
Dirichlet g.f. zeta(s-1)*(3^s-3)/(3^s-1). - R. J. Mathar, Feb 11 2011
From Peter Bala, Feb 21 2019: (Start)
a(n) = n/gcd(n,3^n).
O.g.f.: F(x) - 2*F(x^3) - 2*F(x^9) - 2*F(x^27) - ..., where F(x) = x/(1 - x)^2 is the generating function for the positive integers. More generally, for m >= 1,
Sum_{n >= 0} a(n)^m*x^n = F(m,x) - (3^m - 1)( F(m,x^3) + F(m,x^9) + F(m,x^27) + ... ), where F(m,x) = A(m,x)/(1 - x)^(m+1) with A(m,x) the m_th Eulerian polynomial: A(1,x) = x, A(2,x) = x*(1 + x), A(3,x) = x*(1 + 4*x + x^2) - see A008292.
Repeatedly applying the Euler operator x*d/dx or its inverse operator to the o.g.f. for the sequence produces generating functions for the sequences n^m*a(n), m in Z. Some examples are given below. (End)
Sum_{k=1..n} a(k) ~ (3/8) * n^2. - Amiram Eldar, Oct 29 2022
a(n) = n / A038500(n). - R. J. Mathar, Mar 13 2024
EXAMPLE
From Peter Bala, Feb 21 2019: (Start)
Sum_{n >= 1} n*a(n)*x^n = G(x) - (2*3)*G(x^3) - (2*9)*G(x^9) - (2*27)*G(x^27) - ..., where G(x) = x*(1 + x)/(1 - x)^3.
Sum_{n >= 1} (1/n)*a(n)*x^n = H(x) - (2/3)*H(x^3) - (2/9)*H(x^9) - (2/27)*H(x^27) - ..., where H(x) = x/(1 - x).
Sum_{n >= 1} (1/n^2)*a(n)*x^n = L(x) - (2/3^2)*L(x^3) - (2/9^2)*L(x^9) - (2/27^2)*L(x^27) - ..., where L(x) = Log(1/(1 - x)).
Also, Sum_{n >= 1} 1/a(n)*x^n = L(x) + (2/3)*L(x^3) + (2/3)*L(x^9) + (2/3)*L(x^27) + ... .
(End)
MATHEMATICA
f[n_] := Times @@ (First@#^Last@# & /@ Select[ FactorInteger@n, First@# != 3 &]); Array[f, 76] (* Robert G. Wilson v, Jul 31 2006 *)
Table[n/3^IntegerExponent[n, 3], {n, 100}] (* Amiram Eldar, Sep 15 2020 *)
PROG
(PARI) a(n)=if(n<1, 0, n/3^valuation(n, 3)) /* Michael Somos, Nov 10 2005 */
(Haskell)
a038502 n = if m > 0 then n else a038502 n' where (n', m) = divMod n 3
-- Reinhard Zumkeller, Jan 03 2011
(Magma) [n/3^Valuation(n, 3): n in [1..80]]; // Bruno Berselli, May 21 2013
CROSSREFS
KEYWORD
nonn,easy,mult
AUTHOR
STATUS
approved