OFFSET
1,1
COMMENTS
Equivalently, a(n) is the largest p such that p is the 2nd smallest prime dividing n or the smallest prime not dividing n.
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10000
FORMULA
EXAMPLE
Let p be the second least prime factor of n or 1 if n is a prime power, and let q be the smallest prime that does not divide n.
a(1) = 2 since max(p, q) = max(1, 2) = 2.
a(2) = 3 since max(p, q) = max(1, 3) = 3.
a(4) = 3 since max(p, q) = max(1, 3) = 3.
a(6) = 5 since max(p, q) = max(3, 5) = 5.
a(9) = 2 since max(p, q) = max(1, 2) = 2.
a(15) = 5 since max(p, q) = max(5, 2) = 5.
a(36) = 5 since max(p, q) = max(3, 5) = 5.
Generally,
a(n) = 2 for n in A061345 = union of {1} and sequences { m*p : prime p > 2, rad(m) | p }.
a(n) = 3 for n in A000079 = { 2*m : rad(m) | 2 }.
a(n) = 5 for k in { k = m*d : rad(m) | d, d in {6, 10, 15} }.
a(n) = 7 for k in { k = m*d : rad(m) | d, d in {14, 21, 30, 35} }.
a(n) = 11 for k in { k = m*d : rad(m) | d, d in {22, 33, 55, 77, 210} }, etc.
MATHEMATICA
{2}~Join~Array[If[PrimePowerQ[#],
q = 2; While[Divisible[#, q], q = NextPrime[q]]; q,
q = 2; While[Divisible[#, q], q = NextPrime[q]];
Max[FactorInteger[#][[2, 1]], q]] &, 120, 2]
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Peter Munn and Michael De Vlieger, Feb 18 2024
STATUS
approved