OFFSET
1,2
LINKS
David Applegate and N. J. A. Sloane, Table of n, a(n) for n = 1..10000
EXAMPLE
If n = 8 = 2^3, a(n) = (largest prime <= 3+1) = 3.
If n = 480 = 2^5*3*5, a(n) = (largest prime <= 1 + max{5,1,1}) = 5.
MAPLE
# if n = prod_p p^e_p, then
# pp = largest prime <= 1 + max e_p
with(numtheory):
pp := proc(n) local f, m; option remember;
if (n = 1) then
return 1;
end if;
m := 1:
for f in op(2..-1, ifactors(n)) do
if (f[2] > m) then
m := f[2]:
end if;
end do;
prevprime(m+2);
end proc;
MATHEMATICA
{1}~Join~Array[Prime@PrimePi[1 + Max@FactorInteger[#][[All, -1]]] &, 105, 2] (* Michael De Vlieger, Nov 13 2018 *)
PROG
(PARI) a(n) = if (n==1, 1, precprime(1 + vecmax(factor(n)[, 2]~))); \\ Michel Marcus, Nov 14 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
David Applegate and N. J. A. Sloane, Sep 15 2008
STATUS
approved