cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-2 of 2 results.

A100317 Numbers k such that exactly one of k - 1 and k + 1 is prime.

Original entry on oeis.org

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
Offset: 1

Views

Author

Rick L. Shepherd, Nov 13 2004

Keywords

Comments

Beginning with a(2) = 3, n such that exactly one of n - 1 and n + 1 is composite.

Examples

			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.
		

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

Programs

  • Magma
    [n: n in [1..250] | IsPrime(n-1) xor IsPrime(n+1) ]; // G. C. Greubel, Apr 25 2019
    
  • 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 *)
  • PARI
    for(n=1,250,if(isprime(n-1)+isprime(n+1)==1,print1(n,",")))
    
  • Sage
    [n for n in (1..250) if (is_prime(n-1) + is_prime(n+1) == 1)] # G. C. Greubel, Apr 25 2019

A100319 Even numbers m such that at least one of m-1 and m+1 is composite.

Original entry on oeis.org

8, 10, 14, 16, 20, 22, 24, 26, 28, 32, 34, 36, 38, 40, 44, 46, 48, 50, 52, 54, 56, 58, 62, 64, 66, 68, 70, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 104, 106, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 140, 142, 144, 146, 148
Offset: 1

Views

Author

Rick L. Shepherd, Nov 13 2004

Keywords

Comments

Subsequence of A100318. For each k >= 0, a(k+1) = a(k) + 2 unless a(k) + 1 and a(k) + 3 are twin primes, in which case a(k+1) = a(k) + 4 (as a(k) - 1 and a(k) + 5 are divisible by 3).
The even nonisolated primes(n+1). - Juri-Stepan Gerasimov, Nov 09 2009

Crossrefs

Cf. A100318 (supersequence containing odd and even n), A045718 (n such that at least one of n-1 and n+1 is prime).
Cf. A167692(the even nonisolated nonprimes). - Juri-Stepan Gerasimov, Nov 09 2009
Complement of A014574 (average of twin prime pairs) w.r.t. A005843 (even numbers), except for missing term 2.

Programs

  • Mathematica
    Select[2*Range[100], CompositeQ[#-1] || CompositeQ[#+1] &]  (* G. C. Greubel, Mar 09 2019 *)
  • PARI
    forstep(n=4,300,2,if(isprime(n-1)+isprime(n+1)<=1,print1(n,",")))
    
  • Sage
    [n for n in (3..250) if mod(n,2)==0 and (is_prime(n-1) + is_prime(n+1)) < 2] # G. C. Greubel, Mar 09 2019

Formula

a(n) = A167692(n+1). - Juri-Stepan Gerasimov, Nov 09 2009
Showing 1-2 of 2 results.