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-3 of 3 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

A171611 From Goldbach problem: number of decompositions of 2n into unordered sums of two primes > 3.

Original entry on oeis.org

0, 0, 0, 0, 1, 1, 1, 1, 2, 1, 2, 3, 2, 2, 3, 1, 3, 4, 2, 2, 4, 2, 3, 5, 3, 3, 5, 2, 4, 6, 2, 4, 6, 2, 4, 6, 4, 4, 7, 4, 4, 8, 4, 4, 9, 3, 5, 7, 3, 5, 8, 4, 5, 8, 5, 6, 10, 5, 6, 12, 4, 5, 10, 3, 6, 9, 5, 5, 8, 6, 7, 11, 6, 5, 12, 3, 7, 11, 5, 7, 10, 5, 5, 13, 8, 6, 11, 6, 7, 14, 5, 7, 13, 5, 8, 11, 6, 8, 13
Offset: 1

Views

Author

Juri-Stepan Gerasimov, Dec 13 2009

Keywords

Examples

			a(5)=1 because 2*5 = 5 + 5.
		

Crossrefs

Programs

  • Maple
    A171611 := proc(n) a := 0 ; for i from 3 do p := ithprime(i) ; q := 2*n-p ; if q < p then return a ; end if; if isprime(q) then a := a+1 ; end if; if q <= p then return a ; end if; end do: end proc:
    seq(A171611(n), n=1..120) ; # R. J. Mathar, May 22 2010
  • Mathematica
    Table[s = 2*n; ct = 0; p = 3; While[p = NextPrime[p]; p <= n, If[PrimeQ[s - p], ct++]]; ct, {n, 100}] (* Lei Zhou, Apr 10 2014 *)

Extensions

a(38) changed from 5 to 4 and a(79) and a(82) changed by R. J. Mathar, May 22 2010

A171387 The characteristic function of primes > 3: 1 if n is prime such that neither prime+-1 is prime else 0.

Original entry on oeis.org

0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0
Offset: 1

Views

Author

Juri-Stepan Gerasimov, Dec 07 2009

Keywords

Crossrefs

Formula

A010051(n) = a(n) + A171386(n).
If n > 3, a(n) = A010051(n), otherwise a(n) = 0. - Antti Karttunen, Oct 04 2017
Showing 1-3 of 3 results.