OFFSET
1,2
COMMENTS
Obviously if n is prime then a(n) = n. However, there are composite values of n such that a(n) = n, such as 10 and 155. - Alonso del Arte, May 30 2017
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..20000
Erich Friedman, What's Special About This Number? Entry for 155.
FORMULA
Given p prime and k > 0, a(p^k) = p. - Alonso del Arte, May 30 2017
EXAMPLE
a(14) = 17 because 14 = 2 * 7 and 2 + 3 + 5 + 7 = 17.
MAPLE
f:=proc(n) local i, t1, t2, t3, t4, t5, t6; if n<=1 then RETURN(0) else
t1:=ifactors(n); t2:=t1[2]; t3:=nops(t2); t4:=0; t5:=pi(t2[1][1]); t6:=pi(t2[t3][1]);
for i from t5 to t6 do t4:=t4+ithprime(i); od; RETURN(t4); fi; end; # N. J. A. Sloane, May 24 2010
# second Maple program:
s:= proc(n) option remember; `if`(n<1, 0, ithprime(n)+s(n-1)) end:
a:= proc(n) option remember; uses numtheory; `if`(n<2, 0, (m->
s(pi(max(m)))-s(pi(min(m))-1))(factorset(n)))
end:
seq(a(n), n=1..100); # Alois P. Heinz, Nov 24 2021
MATHEMATICA
sp[n_]:=With[{fi=FactorInteger[n][[All, 1]]}, Total[Prime[Range[ PrimePi[ fi[[1]]], PrimePi[fi[[-1]]]]]]]; Join[{0}, Array[sp, 80, 2]] (* Harvey P. Dale, Dec 22 2017 *)
PROG
(PARI) a(n) = if (n==1, 0, my(f = factor(n), s = 0); forprime(p=f[1, 1], f[#f~, 1], s += p); s); \\ Michel Marcus, May 31 2017
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Jason Earls, Sep 15 2002
STATUS
approved