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”).

A171845
Numbers n >= 0 such that n-1 and n+1 are both primes or both nonprimes, but excluding primes.
1
0, 4, 6, 9, 12, 15, 18, 21, 25, 26, 27, 30, 33, 34, 35, 39, 42, 45, 49, 50, 51, 55, 56, 57, 60, 63, 64, 65, 69, 72, 75, 76, 77, 81, 85, 86, 87, 91, 92, 93, 94, 95, 99, 102, 105, 108, 111, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 129, 133, 134, 135, 138
OFFSET
1,2
LINKS
MAPLE
a:=[];
for k from 0 to 5000 do
if not isprime(k) then
if (isprime(k-1) and isprime(k+1)) or
(not isprime(k-1) and not isprime(k+1)) then a:=[op(a), k]; fi; fi; od:
a; # N. J. A. Sloane, Sep 23 2019
MATHEMATICA
bpQ[n_]:=!PrimeQ[n]&&EvenQ[Total[If[PrimeQ[#], 1, 0]&/@{n-1, n+1}]]; Select[ Range[ 0, 150], bpQ] (* Harvey P. Dale, Sep 23 2019 *)
CROSSREFS
Sequence in context: A007074 A054087 A079255 * A157124 A162735 A024675
KEYWORD
nonn,easy
AUTHOR
EXTENSIONS
Edited by Charles R Greathouse IV, Mar 23 2010
Definition and data corrected by N. J. A. Sloane, Sep 23 2019. Thanks to Harvey P. Dale for pointing that there were errors. - N. J. A. Sloane, Sep 23 2019
STATUS
approved