login
Sum of the primes from the smallest prime factor of n to the largest prime factor of n.
8

%I #19 Nov 24 2021 19:32:03

%S 0,2,3,2,5,5,7,2,3,10,11,5,13,17,8,2,17,5,19,10,15,28,23,5,5,41,3,17,

%T 29,10,31,2,26,58,12,5,37,77,39,10,41,17,43,28,8,100,47,5,7,10,56,41,

%U 53,5,23,17,75,129,59,10,61,160,15,2,36,28,67,58,98,17,71,5,73,197,8

%N Sum of the primes from the smallest prime factor of n to the largest prime factor of n.

%C 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

%H Alois P. Heinz, <a href="/A074036/b074036.txt">Table of n, a(n) for n = 1..20000</a>

%H Erich Friedman, <a href="https://erich-friedman.github.io/numbers.html">What's Special About This Number?</a> Entry for 155.

%F Given p prime and k > 0, a(p^k) = p. - _Alonso del Arte_, May 30 2017

%e a(14) = 17 because 14 = 2 * 7 and 2 + 3 + 5 + 7 = 17.

%p f:=proc(n) local i,t1,t2,t3,t4,t5,t6; if n<=1 then RETURN(0) else

%p t1:=ifactors(n); t2:=t1[2]; t3:=nops(t2); t4:=0; t5:=pi(t2[1][1]); t6:=pi(t2[t3][1]);

%p for i from t5 to t6 do t4:=t4+ithprime(i); od; RETURN(t4); fi; end; # _N. J. A. Sloane_, May 24 2010

%p # second Maple program:

%p s:= proc(n) option remember; `if`(n<1, 0, ithprime(n)+s(n-1)) end:

%p a:= proc(n) option remember; uses numtheory; `if`(n<2, 0, (m->

%p s(pi(max(m)))-s(pi(min(m))-1))(factorset(n)))

%p end:

%p seq(a(n), n=1..100); # _Alois P. Heinz_, Nov 24 2021

%t 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 *)

%o (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

%Y Cf. A055233, A169802, A169804.

%K easy,nonn

%O 1,2

%A _Jason Earls_, Sep 15 2002