OFFSET
0,1
COMMENTS
Note that the first composite value is a(12) = 65 = 5 * 13, since 5 and 13 are first two primes sieved out of the sequence. Similarly, the second composite value is a(17) = 95 = 5 * 19, since 5 and 19 are first and third primes sieved out of the sequence. - Jonathan Vos Post, Jul 27 2008
LINKS
Nathaniel Johnston, Table of n, a(n) for n = 0..10000
PROG
(C) void sieve(){ const int first = 2; const int max = 10000; bool member[max]; for(int i = first; i < max; ++i){ member[i] = true; } for(int i = first; i < max; ++i){ if(member[i]){ for(int x = i + i; x < max; x += i){ member[x] = false; } for(int j = first; j < i; ++j){ if(member[j] && i + j < max){ member[i + j] = false; } } } } int num = 0; for(int i = first; i < max; ++i){ if(member[i]){ printf("%i, ", i); num += 1; } } printf(" num = %i ", num); }
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Russell Y. Webb (r.webb(AT)elec.canterbury.ac.nz), Jul 22 2008
STATUS
approved