Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #6 Jul 05 2016 19:12:35
%S 10,10,12,14,18,20,24,25,28,35,36,44,48,49,52,58,65,66,74,77,78,85,88,
%T 94,104,108,110,114,115,118,133,136,143,144,155,156,162,169,172,178,
%U 185,186,198,200,203,204,216,230,234,235,238,245,246,256,262,268,275
%N The fifth nonprimes after the primes.
%C From _Robert Israel_, Jul 05 2016: (Start)
%C For n>1, there are the following cases:
%C If prime(n)+2 and prime(n)+4 are composite, then a(n) = prime(n)+5.
%C If exactly one of prime(n)+2 and prime(n)+4 is prime, and prime(n)+6 is composite, then a(n) = prime(n) + 6.
%C Otherwise, a(n) = prime(n) + 7. (End)
%H Robert Israel, <a href="/A175220/b175220.txt">Table of n, a(n) for n = 1..10000</a>
%p N:= 1000: # to get all entries <= N
%p Primes:= select(isprime, [2,seq(i,i=3..N+7,2)]):
%p nprimes:= nops(Primes):
%p A[1]:= 10:
%p A[2]:= 10:
%p for i from 3 to nprimes-1 do
%p p:= Primes[i];
%p if p + 5 > N then break fi;
%p if Primes[i+1] > p + 4 then A[i]:= p + 5
%p elif (i = nprimes-1 or Primes[i+2] <> p+6) and p+6 <= N then A[i]:= p + 6
%p elif p+7 <= N then A[i]:= p + 7
%p else break
%p fi
%p od:
%p seq(A[j],j=1..i-1); # _Robert Israel_, Jul 05 2016
%K nonn
%O 1,1
%A _Jaroslav Krizek_, Mar 06 2010