%I #50 Oct 12 2018 20:18:47
%S 1,3,5,8,11,14,17,20,23,28,32,37,40,44,47,50,57,61,66,70,73,78,83,89,
%T 94,99,103,107,110,117,122,127,134,139,144,150,154,160,165,170,177,
%U 181,187,192,196,202,207,215,220,227,231,236,242,247,250,253,261,269,274,278
%N Number of positive even integers that can be written as the sum of 2 of the first n odd primes (not necessarily distinct).
%C A105047(n+2) = a(n+1) - a(n). - _Reinhard Zumkeller_, Aug 11 2015
%H Robert Israel, <a href="/A102696/b102696.txt">Table of n, a(n) for n = 1..10000</a>
%e a(3) = 5 because with the primes {3, 5, 7} one can write 6 = 3+3, 8 = 3+5, 10 = 5+5, 12 = 5+7 and 14 = 7+7, for a total of 5 even numbers.
%e a(3) = 5 because with the primes {3, 5, 7} one can write 6 = 3+3, 8 = 3+5, 10 = 5+5 & 3+7, 12 = 5+7 and 14 = 7+7, for a total of 5 even numbers.
%p N:= 1000: # to get first N terms
%p Primes:= {seq(ithprime(i),i=2..N+1)}:
%p S:= {}:
%p for n from 1 to N do
%p S:= S union map(`+`,Primes[1..n],Primes[n]);
%p A[n]:= nops(S);
%p od:
%p seq(A[n],n=1..N); # _Robert Israel_, Sep 03 2014
%t f[n_] := Block[{tp = Table[ Prime[i], {i, 2, n + 1}]}, Length[ Union[ Flatten[ Table[tp[[i]] + tp[[j]], {i, n}, {j, i}]] ]]]; Table[ f[n], {n, 60}] (* _Robert G. Wilson v_, Feb 05 2005 *)
%o (PARI) a(n)=my(P=prime(n+1),s); forstep(k=6,2*P,2, forprime(p=max(k-P,3), min(P,k/2), if(isprime(k-p), s++; break))); s \\ _Charles R Greathouse IV_, Sep 04 2014
%o (PARI) list(n)=my(P=prime(n+1),u=vectorsmall(P),v=vector(n),k); forprime(p=3,P, forprime(q=3,p,u[(p+q)/2]=1); v[k++]=sum(i=1,p,u[i])); v \\ _Charles R Greathouse IV_, Sep 04 2014
%o (Haskell)
%o import Data.List (nub)
%o a102696 n = length $ nub
%o [p + q | p <- take n a065091_list, q <- takeWhile (<= p) a065091_list]
%o -- _Reinhard Zumkeller_, Aug 11 2015
%Y Cf. A105047 (first differences).
%K easy,nonn
%O 1,2
%A Gabriel Cunningham (gcasey(AT)mit.edu), Feb 04 2005
%E More terms from _Robert G. Wilson v_, Feb 05 2005
|