The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A100317 Numbers k such that exactly one of k - 1 and k + 1 is prime. 7
1, 2, 3, 8, 10, 14, 16, 20, 22, 24, 28, 32, 36, 38, 40, 44, 46, 48, 52, 54, 58, 62, 66, 68, 70, 74, 78, 80, 82, 84, 88, 90, 96, 98, 100, 104, 106, 110, 112, 114, 126, 128, 130, 132, 136, 140, 148, 152, 156, 158, 162, 164, 166, 168, 172, 174, 178, 182, 190, 194, 196, 200 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
Beginning with a(2) = 3, n such that exactly one of n - 1 and n + 1 is composite.
LINKS
EXAMPLE
3 is in the sequence because 2 is prime but 4 is composite.
4 is not in the sequence because both 3 and 5 are prime.
5 is not in the sequence either because both 4 and 6 are composite.
MATHEMATICA
Select[Range[250], Xor[PrimeQ[# - 1], PrimeQ[# + 1]] &] (* G. C. Greubel, Apr 25 2019 *)
Module[{nn=Table[If[PrimeQ[n], 1, 0], {n, 0, 220}], t1, t2}, t1=Mean/@ SequencePosition[ nn, {1, _, 0}]; t2=Mean/@SequencePosition[nn, {0, _, 1}]; Flatten[ Join[t1, t2]]//Sort]-1 (* Harvey P. Dale, Jul 13 2019 *)
PROG
(PARI) for(n=1, 250, if(isprime(n-1)+isprime(n+1)==1, print1(n, ", ")))
(Magma) [n: n in [1..250] | IsPrime(n-1) xor IsPrime(n+1) ]; // G. C. Greubel, Apr 25 2019
(Sage) [n for n in (1..250) if (is_prime(n-1) + is_prime(n+1) == 1)] # G. C. Greubel, Apr 25 2019
CROSSREFS
Cf. A100318 (at least one of n - 1 and n + 1 is composite).
Cf. A001477, A169546, A171689, A099049, A014574 (no intersection with this sequence).
Sequence in context: A132327 A281929 A286092 * A295030 A317655 A060697
KEYWORD
nonn
AUTHOR
Rick L. Shepherd, Nov 13 2004
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 13 09:03 EDT 2024. Contains 373383 sequences. (Running on oeis4.)