%I #14 May 13 2013 01:54:08
%S 9,10,21,34,51,58,77,106,129,166,201,262,287,334,381,454,501,586,669,
%T 718,791,922,989,1082,1167,1282,1371,1486,1623,1754,1851,2018,2127,
%U 2326,2427,2638,2747,2974,3093,3274,3459,3694,3831,4034,4227,4534,4661,4894,5123,5366
%N Smallest semiprime equal to the sum of n distinct primes.
%C The sequence is monotonic for its first million terms. Does there exist n with a(n) < a(n-1)? [_Charles R Greathouse IV_, Aug 24 2011]
%H Charles R Greathouse IV, <a href="/A104646/b104646.txt">Table of n, a(n) for n = 2..10000</a>
%e a(2) = 9 because 9 = 2+7=9 = 3*3;
%e a(3) = 10 because 10 = 2+3+5 = 2*5;
%e a(4) = 21 because 21 = 2+3+5+11 = 3*7.
%o (PARI) issemi(n)=bigomega(n)==2
%o a(n)={
%o my(v=primes(n+3),s=sum(i=1,n+1,v[i]),m,t,t1);
%o m=s+v[n+2]-5;
%o forstep(i=n+1,1,-1,
%o t=s-v[i];
%o if(t >= m, break);
%o if(issemi(t),return(t))
%o );
%o s+=v[n+2];
%o m=s+v[n+3]-10;
%o for(i=2,n+2,
%o t=s-v[i];
%o for(j=1,i-1,
%o t1=t-v[j];
%o if(t1 >= m, break);
%o if(issemi(t1),m=t1)
%o )
%o );
%o if(issemi(m), return(m));
%o error("could not find a("n")")
%o }; \\ _Charles R Greathouse IV_, Aug 24 2011
%K nonn
%O 2,1
%A _Giovanni Teofilatto_, Apr 21 2005
%E a(6) corrected, a(7)-a(50) by _Charles R Greathouse IV_, Aug 24 2011