login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Odd nonprimes np such that np-2 is a prime number but np+2 is not.
5

%I #29 May 14 2023 16:55:27

%S 25,33,49,55,63,75,85,91,115,133,141,153,159,169,175,183,201,213,235,

%T 243,253,259,265,273,285,295,319,333,339,355,361,369,375,385,391,403,

%U 411,423,435,445,451,469,481,493,505,511,525,543,549,559,565,573,579

%N Odd nonprimes np such that np-2 is a prime number but np+2 is not.

%C Primes referred to in the example are found in A124582 (see A083370 and compare A124582).

%H Vincenzo Librandi, <a href="/A134099/b134099.txt">Table of n, a(n) for n = 1..1000</a>

%e a(1) = 25 because it is an odd nonprime preceded by the prime 23 and followed by the odd nonprime 27.

%t Select[Range[5,1000,2], !PrimeQ[#] && PrimeQ[#-2] && !PrimeQ[#+2]&] (* _Vladimir Joseph Stephan Orlovsky_, Feb 03 2012 *)

%t 2#-1&/@(Mean/@SequencePosition[Table[If[PrimeQ[n],1,0],{n,1,601,2}],{1,0,0}]) (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Jul 31 2020 *)

%t Select[Partition[Range[600],5,2],PrimeQ[#[[1]]]&&AllTrue[{#[[3]],#[[5]]},CompositeQ]&][[;;,3]] (* _Harvey P. Dale_, May 14 2023 *)

%o (UBASIC) 10 'primes using counters 20 N=3:print "2 ";:print "3 ";:C=2 30 A=3:S=sqrt(N) 40 B=N\A 50 if B*A=N then 55 55 Q=N+2:R=N-2: if Q<>prmdiv(Q) and N<>prmdiv(N) and R=prmdiv(R) then print Q;N;R;"-";:stop:else N=N+2:goto 30 60 A=A+2 70 if A<=sqrt(N) then 40:stop 81 C=C+1 100 N=N+2:goto 30

%Y Cf. A124582, A083370, A134100, A134101, A007510.

%K easy,nonn

%O 1,1

%A _Enoch Haga_, Oct 08 2007

%E Definition corrected by _Jens Voß_, Mar 12 2014

%E Definition modified by _Harvey P. Dale_, May 14 2023