OFFSET
1,2
COMMENTS
Largest term of A004612 that divides n.
FORMULA
Completely multiplicative with a(p) = p if p is of the form 3k-1, otherwise a(p) = 1.
For k >= 1, a(n) = a(k*n) / gcd(k, a(k*n)).
EXAMPLE
n = 60 has prime factorization 60 = 2 * 2 * 3 * 5. Factors 2 = 3*1 - 1 and 5 = 3*2 - 1 have form 3k-1, whereas 3 does not (having form 3k). Multiplying the factors of form 3k-1, we get 2 * 2 * 5 = 20. So a(60) = 20.
MATHEMATICA
f[p_, e_] := If[Mod[p, 3] == 2, p^e, 1]; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Jun 11 2021 *)
PROG
(PARI) a(n) = {my(f = factor(n)); for (i=1, #f~, if ((f[i, 1] + 1) % 3, f[i, 1] = 1); ); factorback(f); } \\ after Michel Marcus at A248909
(Python)
from math import prod
from sympy import factorint
def A343430(n): return prod(p**e for p, e in factorint(n).items() if p%3==2) # Chai Wah Wu, Dec 23 2022
CROSSREFS
KEYWORD
nonn,easy,mult
AUTHOR
Peter Munn, Jun 08 2021
STATUS
approved