login
A102696
Number of positive even integers that can be written as the sum of 2 of the first n odd primes (not necessarily distinct).
2
1, 3, 5, 8, 11, 14, 17, 20, 23, 28, 32, 37, 40, 44, 47, 50, 57, 61, 66, 70, 73, 78, 83, 89, 94, 99, 103, 107, 110, 117, 122, 127, 134, 139, 144, 150, 154, 160, 165, 170, 177, 181, 187, 192, 196, 202, 207, 215, 220, 227, 231, 236, 242, 247, 250, 253, 261, 269, 274, 278
OFFSET
1,2
COMMENTS
A105047(n+2) = a(n+1) - a(n). - Reinhard Zumkeller, Aug 11 2015
LINKS
EXAMPLE
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.
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.
MAPLE
N:= 1000: # to get first N terms
Primes:= {seq(ithprime(i), i=2..N+1)}:
S:= {}:
for n from 1 to N do
S:= S union map(`+`, Primes[1..n], Primes[n]);
A[n]:= nops(S);
od:
seq(A[n], n=1..N); # Robert Israel, Sep 03 2014
MATHEMATICA
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 *)
PROG
(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
(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
(Haskell)
import Data.List (nub)
a102696 n = length $ nub
[p + q | p <- take n a065091_list, q <- takeWhile (<= p) a065091_list]
-- Reinhard Zumkeller, Aug 11 2015
CROSSREFS
Cf. A105047 (first differences).
Sequence in context: A076829 A084505 A084555 * A130262 A094228 A278586
KEYWORD
easy,nonn
AUTHOR
Gabriel Cunningham (gcasey(AT)mit.edu), Feb 04 2005
EXTENSIONS
More terms from Robert G. Wilson v, Feb 05 2005
STATUS
approved