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.

A020483 Least prime p such that p+2n is also prime.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

It is conjectured that a(n) always exists. a(n) has been computed for n < 5 * 10^11, with largest value a(248281210271) = 3307. - Jens Kruse Andersen, Nov 28 2004
If a(n) = a(n+1) = k, then 2*n + k and 2*(n+1) + k are twin primes. - Ya-Ping Lu, Sep 22 2020

Examples

			Given n = 2, we see that 2 + 2n = 6 = 2 * 3, but 3 + 2n = 7, which is prime, so a(2) = 3.
Given n = 3, we see that 2 + 2n = 8 = 2^3 and 3 + 2n = 9 = 3^2, but 5 + 2n = 11, which is prime, so a(3) = 5.
		

Crossrefs

Cf. A101045, A239392 (record values).
It is likely that A054906 is an identical sequence, although this seems to have not yet been proved. - N. J. A. Sloane, Feb 06 2017

Programs

  • GAP
    P:=Filtered([1..10000],IsPrime);;
    a:=List(List([0..110],n->Filtered(P,i->IsPrime(i+2*n))),Minimum); # Muniru A Asiru, Mar 26 2018
  • Haskell
    a020483 n = head [p | p <- a000040_list, a010051' (p + 2 * n) == 1]
    -- Reinhard Zumkeller, Nov 29 2014
    
  • Maple
    A020483 := proc(n)
        local p;
        p := 2;
        while true do
            if isprime(p+2*n) then
                return p;
            end if;
            p := nextprime(p) ;
        end do:
    end proc:
    seq(A020483(n),n=0..40); # R. J. Mathar, Sep 23 2016
  • Mathematica
    Table[j = 1; found = False; While[!found, j++; found = PrimeQ[Prime[j] + 2i]]; Prime[j], {i, 200}]
    leastPrimep2n[n_] := Block[{k = 1, p, q = 2 n}, While[p = Prime@k; !PrimeQ[p + q], k++]; p]; Array[leastPrimep2n, 102] (* Robert G. Wilson v, Mar 26 2008 *)
  • PARI
    a(n)=forprime(p=2,,if(isprime(p+2*n), return(p))) \\ Charles R Greathouse IV, Mar 19 2014
    

Formula

If a(n) exists, a(n) < 2n, which of course is a great overestimate. - T. D. Noe, Jul 16 2002
a(n) = A087711(n) - n. - Zak Seidov, Nov 28 2007
a(n) = A020484(n) - 2n. - Zak Seidov, May 29 2014
a(n) = 2 if and only if n = 0. - Alonso del Arte, Mar 14 2018

Extensions

a(0)=2 added by N. J. A. Sloane, Apr 25 2015

A370998 2*a(n) = m is the least even number m such that all sums m + prime(k), k=1..n are composite.

Original entry on oeis.org

1, 3, 11, 44, 44, 56, 56, 101, 101, 101, 359, 359, 359, 664, 664, 821, 821, 821, 866, 866, 866, 2623, 2623, 2623, 2623, 2944, 2944, 2944, 2944, 2944, 2944, 2944, 2944, 2944, 5171, 5171, 12839, 18833, 18833, 18833, 18833, 29947, 29947, 29947, 38002, 38002, 38002, 38002, 51551
Offset: 1

Views

Author

Hugo Pfoertner, Mar 09 2024

Keywords

Examples

			a(1) = 1: prime(1) = 2; 2 + 2*a(1) = 4 is the first composite.
a(2) = 3: m = 6; since all sums prime(1) + 2*x are even, any x can be chosen. prime(2) = 3, 3 + 6 = 9, whereas 3 + 1*2 and 3 + 2*2 are prime.
a(3) = 11: m = 22; for any even m < 22 at least one of 3 + m or 5 + m would be prime, e.g., 3+2=5, 3+4=7, 5+6=11, 3+8=11, 5+12=17, 5+14=19, 3+16=19, 5+18=23, 3+20=23, but 3+22=25 and 5+22 are composite.
		

Crossrefs

Cf. A239392 (records).

Programs

  • Maple
    R:= 1: P:= [2]: r:= 1:
    for n from 2 to 100 do
      P:= [op(P), ithprime(n)];
      for k from r while ormap(isprime,P +~ 2*k) do od:
      R:= R, k; r:= k;
    od:
    R; # Robert Israel, Mar 09 2025
  • Python
    from itertools import count
    from sympy import prime, isprime
    def A370998(n):
        ptuple = tuple(prime(k) for k in range(1,n+1))
        return next(filter(lambda m:not any(isprime(p+m) for p in ptuple),count(2,2)))>>1 # Chai Wah Wu, Mar 21 2024

A371069 Positions of records in A370998.

Original entry on oeis.org

1, 2, 3, 4, 6, 8, 11, 14, 16, 19, 22, 26, 35, 37, 38, 42, 45, 49, 63, 70, 75, 80, 83, 114, 115, 121, 125, 133, 134, 141, 145, 183, 187, 199, 207, 224, 231, 234, 242, 244, 249, 274, 288, 333, 338, 340, 354, 363, 385, 387, 394, 407, 435, 465
Offset: 1

Views

Author

Hugo Pfoertner, Mar 10 2024

Keywords

Crossrefs

Cf. A239392 (records), A370998.

Formula

A370998(a(n)) = A239392(n).

Extensions

a(39)-a(54) from Martin Ehrenstein, Mar 11 2024
Showing 1-3 of 3 results.