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-4 of 4 results.

A087243 a(n) = n + A087242(n) or a(n)=0 if A087242(n)=0; the primes arising as n + A087242(n).

Original entry on oeis.org

3, 5, 5, 7, 7, 11, 0, 11, 11, 13, 13, 17, 0, 17, 17, 19, 19, 23, 0, 23, 23, 29, 0, 29, 0, 29, 29, 31, 31, 37, 0, 37, 0, 37, 37, 41, 0, 41, 41, 43, 43, 47, 0, 47, 47, 53, 0, 53, 0, 53, 53, 59, 0, 59, 0, 59, 59, 61, 61, 67, 0, 67, 0, 67, 67, 71, 0, 71, 71, 73, 73, 79, 0, 79, 0, 79, 79, 83, 0
Offset: 1

Views

Author

Labos Elemer, Sep 04 2003

Keywords

Comments

If n is odd, a(n) is either n+2 (if n+2 is prime) or 0; if n is even, a(n) is the least prime p such that p-n is prime. Polignac's conjecture implies that such a prime exists. - Robert Israel, Sep 29 2014

Examples

			a(n)=0, i.e., no solution exists if n is a special prime, namely n is not a lesser twin prime; e.g., if n=7, then neither 7+2=9 nor 7+(oddprime) is a prime, thus no p prime exists such that 7+p is also a prime.
If n is a lesser twin prime then a(n)=2 is a solution because n+a(n) = n+2 = greater twin prime satisfying the condition.
		

Crossrefs

Cf. A087242.

Programs

  • Maple
    N:= 1000: # to get the first N terms
    nToDo:= floor(N/2): OddPrimes[1]:= 3: A[1]:= 3:
    for i from 1 to floor(N/2) do A[2*i+1]:= 0 od:
    for j from 2 while nToDo > 0 do
       OddPrimes[j]:= nextprime(OddPrimes[j-1]);
       A[OddPrimes[j]-2]:= OddPrimes[j];
       for i from 1 to j-1 do
          d:= OddPrimes[j] - OddPrimes[i];
          if d <= N and not assigned(A[d]) then
             A[d]:= OddPrimes[j];
             nToDo:= nToDo-1;
          fi
        od
    od:
    seq(A[j], j=1..N); # Robert Israel, Sep 29 2014
  • PARI
    a(n) = {if (n % 2, if (isprime(n+2), p = 2, p = 0);, p = 2; while (!isprime(n+p), p = nextprime(p+1));); if (p, n + p, 0);} \\ Michel Marcus, Dec 26 2013

Formula

a(n) = n+Min{x prime; n+x is prime} or a(n)=0 if Min{} does not exist.

Extensions

Some corrections by Michel Marcus, Dec 26 2013

A124064 Table read by rows: T(d,k) (d >= 1, k >= 1) = smallest prime p of k (not necessarily consecutive) primes in arithmetic progression with common difference d.

Original entry on oeis.org

2, 2, 2, 3, 3, 2, 2, 2, 3, 3, 2, 2, 2, 5, 5, 5, 5, 2, 2, 3, 3, 2, 2, 2, 3, 3, 2, 2, 2, 5, 5, 5, 5, 2, 2, 3, 3, 2, 2, 2, 3, 2, 2, 2, 5, 5, 5, 2, 2, 3, 3, 2, 2, 2, 7, 2, 2, 5, 5, 59, 2, 2, 3, 2, 2, 2, 3, 3, 2, 2, 2, 7, 7, 7, 7, 7, 2, 2, 5, 2, 2, 3, 3, 2, 2, 2, 5, 7, 31, 2, 2, 3, 3, 2, 2, 2, 3, 3, 2, 2, 2, 5, 5, 5, 5
Offset: 1

Views

Author

R. J. Mathar, Nov 04 2006

Keywords

Examples

			Table begins:
d \k|..1..2..3..4..5..
----+-----------------
..1.|..2..2
..2.|..2..3..3
..3.|..2..2
..4.|..2..3..3
..5.|..2..2
..6.|..2..5..5..5..5
..7.|..2
..8.|..2..3..3
..9.|..2..2
.10.|..2..3..3
.11.|..2..2
.12.|..2..5..5..5..5
.13.|..2
.14.|..2..3..3
.15.|..2..2
.16.|..2..3
.17.|..2..2
.18.|..2..5..5..5
.19.|..2
.20.|..2..3..3
T(24,4) = 59 since (59,83,107,131) is the first A.P. of 4 primes with difference 24.
		

Crossrefs

Cf. A087242 (column k=2), A124570 (semiprimes analog), A249207.
Assuming the k-tuples conjecture, A123556 gives lengths of table rows.

Formula

T(n,1) = 2.
lim n->inf (a(n)/n) = SUM(p prime; (p-1)/(#(p-1)) = 2.92005097731613471209+

Extensions

Edited by David W. Wilson, Nov 05 2006 and Nov 25 2006

A087238 First differences of A057809.

Original entry on oeis.org

2, 2, 2, 19, 3, 3, 63, 4, 20, 210, 5, 5, 10, 5, 5, 648, 72, 12, 24, 6, 6, 6, 1925, 7, 7, 7, 7, 7, 5314, 16, 16, 16, 8, 8, 15054, 9, 765, 40240, 40, 30, 10, 30, 40, 10, 10, 10, 110477, 305655, 12, 144, 12, 12, 12, 12, 12, 12, 12, 204, 60, 12, 36, 12, 12, 12, 12, 823046, 13
Offset: 2

Views

Author

Labos Elemer, Sep 04 2003

Keywords

Examples

			Large differences arise between max term in a cluster and least one in the next cluster of A057809. While small entries obtained as differences inside a cluster.
E.g.:...,21,6467079011,198,22,110,132,22,242,66,17541629593,23,... shows by first differences the transition from the 21st cluster to 23rd solution-set over the 22nd-set with multiples of 22.
First cluster is empty, while 11th contains one term (see A038227).
		

Crossrefs

Programs

  • Mathematica
    Differences[Select[Range[2,1500000],Divisible[#,PrimePi[#]]&]] (* Harvey P. Dale, Aug 13 2012 *)

Formula

a(n)=A057809(n+1)-A057809(n)

A300817 Smallest prime p such that p + n^2 is prime, or 0 if no such prime exists.

Original entry on oeis.org

2, 2, 3, 2, 3, 0, 5, 0, 3, 2, 3, 0, 5, 0, 3, 2, 7, 0, 7, 0, 19, 2, 3, 0, 11, 0, 7, 0, 3, 0, 7, 0, 7, 2, 7, 0, 5, 0, 3, 2, 7, 0, 13, 0, 13, 2, 13, 0, 5, 0, 3, 0, 3, 0, 11, 0, 31, 2, 7, 0, 7, 0, 3, 0, 3, 0, 7, 0, 13, 0, 3, 0, 5, 0, 3, 0, 3, 0, 5, 0, 73, 2, 13, 0, 13, 0, 37, 0, 13, 0
Offset: 0

Views

Author

Bruno Berselli, Mar 13 2018

Keywords

Comments

a(n) = 0 if n is a member of A106571.

Examples

			For n = 16:
2 + 16^2 is not prime;
3 + 16^2 = 7*37 is not prime;
5 + 16^2 = 3*87 is not prime;
7 + 16^2 = 263 is prime, therefore a(16) = 7.
		

Crossrefs

Cf. A087242: smallest prime p such that p + n is prime.
Cf. A174960: smallest prime p such that p + n*(n+1)/2 is prime.
Cf. A106571.

Programs

  • Julia
    using Primes
    function A300817(n) p, q = 2, n * n
        n % 2 == 1 && return isprime(p + q) ? 2 : 0
        while !isprime(p + q) p = nextprime(p + 1) end
    p end
    [A300817(n) for n in 0:89] |> println # Peter Luschny, Mar 13 2018
    
  • Maple
    A300817 := proc(n) local p, n2; p := 2; n2 := n^2;
        if irem(n2, 2) = 1 and numtheory:-invphi(n2+1) = [] then return 0 fi;
        do if isprime(p + n2) then return p fi; p := nextprime(p) od;
    end: seq(A300817(n), n = 0..89); # Peter Luschny, Mar 13 2018
  • Mathematica
    a[n_] := Block[{p=2}, If[OddQ[n], If[PrimeQ[n^2 + 2], 2, 0], While[! PrimeQ[n^2 + p], p = NextPrime[p]]; p]]; a /@ Range[0, 89] (* Giovanni Resta, Mar 13 2018 *)
  • PARI
    A300817(n)={if(bittest(n,0), n=n^2; forprime(p=2,, isprime(2+n)&&return(p)), isprime(2+n^2)*2)} \\ M. F. Hasler, Mar 14 2018
  • Python
    from sympy import nextprime, isprime
    def A300817(n):
        p, n2 = 2, n**2
        if n % 2:
            return 2 if isprime(2+n2) else 0
        while not isprime(p+n2):
            p = nextprime(p)
        return p # Chai Wah Wu, Mar 14 2018
    
Showing 1-4 of 4 results.