%I #12 Sep 23 2019 08:31:34
%S 0,4,6,9,12,15,18,21,25,26,27,30,33,34,35,39,42,45,49,50,51,55,56,57,
%T 60,63,64,65,69,72,75,76,77,81,85,86,87,91,92,93,94,95,99,102,105,108,
%U 111,115,116,117,118,119,120,121,122,123,124,125,129,133,134,135,138
%N Numbers n >= 0 such that n-1 and n+1 are both primes or both nonprimes, but excluding primes.
%H Harvey P. Dale, <a href="/A171845/b171845.txt">Table of n, a(n) for n = 1..2000</a>
%p a:=[];
%p for k from 0 to 5000 do
%p if not isprime(k) then
%p if (isprime(k-1) and isprime(k+1)) or
%p (not isprime(k-1) and not isprime(k+1)) then a:=[op(a),k]; fi; fi; od:
%p a; # _N. J. A. Sloane_, Sep 23 2019
%t 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 *)
%K nonn,easy
%O 1,2
%A _Juri-Stepan Gerasimov_, Jan 21 2010
%E Edited by _Charles R Greathouse IV_, Mar 23 2010
%E 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