%I #42 Apr 28 2020 08:54:24
%S 2,5,19,17,43,41,79,83,127,131,199,197,283,281,379,389,499,509,643,
%T 641,809,809,983,971,1171,1163,1381,1373,1609,1607,1861,1861,2137,
%U 2137,2437,2441,2749,2767,3109,3109,3457,3457,3833,3847,4243,4241,4663,4679,5119
%N Smallest prime which is a sum of n distinct primes.
%C Conjectured terms a(50)-a(76): 5147, 5623, 5591, 6079, 6101, 6599, 6607, 7151, 7151, 7699, 7699, 8273, 8293, 8893, 8893, 9521, 9547, 10211, 10223, 10889, 10891, 11597, 11617, 12343, 12373, 13099, 13127. - _Jean-François Alcover_, Apr 22 2020
%D Shantanu Dey & Moloy De, Two conjectures on prime numbers, Journal of Recreational Mathematics, Vol. 36 (3), pp 205-206. Baywood Publ. Co, Amityville NY 2011.
%H Jean-François Alcover, <a href="/A068873/a068873.txt">Conjectured terms up to a(200).</a>
%F Min(a(n), A073619(n)) = A007504(n) for n > 1. - _Jonathan Sondow_, Jul 10 2012
%e a(3) = 19 as 19 is the smallest prime which can be expressed as the sum of three primes as 19 = 3 + 5 + 11. a(4) = 17= 2+3+5+7. a(2)=A038609(1). a(3)=A124867(7). Further examples in A102330.
%p # Number of ways to write n as a sum of k distinct primes, the smallest
%p # being smalp
%p sumkprims := proc(n,k,smalp)
%p option remember;
%p local a,res,pn;
%p res := n-smalp ;
%p if res < 0 then
%p return 0;
%p elif res > 0 and k <=0 then
%p return 0;
%p elif res = 0 and k = 1 then
%p return 1;
%p else
%p pn := nextprime(smalp) ;
%p a := 0 ;
%p while pn <= res do
%p a := a+procname(res,k-1,pn) ;
%p pn := nextprime(pn) ;
%p end do:
%p a ;
%p end if;
%p end proc:
%p # Number of ways of writing n as a sum of k distinct primes
%p A000586k := proc(n,k)
%p local a,i,smalp ;
%p a := 0 ;
%p for i from 1 do
%p smalp := ithprime(i) ;
%p if k*smalp > n then
%p return a;
%p end if;
%p a := a+sumkprims(n,k,smalp) ;
%p end do:
%p end proc:
%p # Smallest prime which is a sum of n distinct primes
%p A068873 := proc(n)
%p local a,i;
%p a := A007504(n) ;
%p a := nextprime(a-1) ;
%p for i from 1 do
%p if A000586k(a,n) > 0 then
%p return a;
%p end if;
%p a := nextprime(a) ;
%p end do:
%p end proc: # _R. J. Mathar_, May 04 2014
%o (PARI) a(n)=
%o {
%o my(P=primes(n),k=n,t);
%o while(1,
%o forvec(v=vector(n-1,i,[1,k-1]),
%o t=sum(i=1,n-1,P[v[i]])+P[k];
%o if(isprime(t),return(t))
%o ,
%o 2 \\ flag: only strictly increasing vectors v
%o );
%o P=concat(P,nextprime(P[k]+1));
%o k++
%o );
%o } \\ _Charles R Greathouse IV_, Sep 19 2015
%Y Cf. A102330, A013918, A007504.
%K nonn
%O 1,1
%A _Amarnath Murthy_, Mar 19 2002
%E More terms from _Sascha Kurz_, Feb 03 2003
%E Corrected by _Ray Chandler_, Feb 02 2005