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.

Previous Showing 11-13 of 13 results.

A381041 Smallest prime p such that 3^n + p + 1 is prime.

Original entry on oeis.org

3, 3, 3, 3, 7, 7, 3, 19, 7, 3, 3, 19, 79, 7, 7, 43, 67, 139, 127, 103, 7, 97, 3, 31, 31, 13, 379, 61, 109, 433, 3, 79, 127, 79, 67, 139, 127, 229, 7, 109, 271, 313, 3, 151, 7, 103, 67, 283, 421, 67, 43, 373, 97, 97, 97, 19, 61, 3, 157, 331, 127, 37, 139, 439, 421
Offset: 0

Views

Author

James S. DeArmon, Apr 20 2025

Keywords

Examples

			a(0) = 3, since 3 + (3^0+1) = 5 is prime and 2 + (3^0+1) = 4 is not.
a(1) = 3, since 3 + (3^1+1) = 7 is prime and 2 + (3^1+1) = 6 is not.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local t,p;
     p:= 1: t:= 3^n+1;
     do
       p:= nextprime(p);
       if isprime(p+t) then return p fi
     od;
    end proc:
    map(f, [$0..100]); # Robert Israel, Jun 19 2025
  • Mathematica
    a[n_]:=Module[{p=2},While[!PrimeQ[p+3^n+1], p=NextPrime[p]]; p]; Array[a,65,0] (* Stefano Spezia, Apr 25 2025 *)
  • PARI
    a(n) = my(p=2, x=3^n+1); while (!isprime(p+x), p=nextprime(p+1)); p; \\ Michel Marcus, Apr 24 2025
  • Python
    from sympy import isprime, nextprime
    def a(n):
        p, b = 2, 3**n+1
        while not isprime(p+b):
            p = nextprime(p)
        return p
    print([a(n) for n in range(65)]) # Michael S. Branicky, Apr 23 2025
    
  • Python
    from sympy import nextprime, isprime
    def A381041(n):
        p = 3**n+1
        q = nextprime(p)
        while not isprime(q-p):
            q = nextprime(q)
        return q-p # Chai Wah Wu, May 01 2025
    

Formula

a(n) = A020483(A007051(n)). - Robert Israel, Jun 19 2025

Extensions

More terms from Michael S. Branicky, Apr 23 2025

A071781 Primes p with p-2^e and p+2^e prime for some exponent e.

Original entry on oeis.org

5, 7, 11, 67, 32771
Offset: 1

Views

Author

Rick L. Shepherd, Jun 05 2002

Keywords

Comments

For each n, p-2^e,p,p+2^e is thus an arithmetic progression of primes with difference 2^e. Note that for each n=1,2,3,4,5, only one such e exists and p-2^e=3. There are no other terms up to 20000000.
For all terms, p-2^e must, in fact, be 3 (as one of p-2^e, p and p+2^e is divisible by 3). Each corresponding arithmetic progression of primes has length 3 (p+2^(e+1) is also divisible by 3). Any additional term is too large to include here. Equivalently, this sequence is primes of the form 3+2^e such that 3+2^(e+1) is also prime; i.e., 3+2^A057732(k) is a term iff A057732(k+1) = A057732(k) + 1. Thus much more efficient than the PARI program below is to extend A057732 and examine its terms. - Rick L. Shepherd, Jun 20 2008

Examples

			67 is a term because 67 is prime and there exists e=6 such that both 67-2^6=67-64=3 and 67+2^6=67+64=131 are primes. 32771 is a term because 32771 is prime and there exists e=15 such that both 32771-2^15=32771-32768=3 and 32771+2^15=32771+32768=65539 are primes. Thus 3,67,131 and 3,32771,65539 are two sequences of primes in arithmetic progression with differences 2^6 and 2^15, respectively.
		

Crossrefs

Programs

  • PARI
    for(p=5,20000000,if(isprime(p),e=1; while(p-2^e>1,if(isprime(p-2^e)&&isprime(p+2^e),print1(p,","); break,e++))))

A172183 a(n) is the smallest prime of the form p^q+n, where p and q are prime, or zero if no such prime exists.

Original entry on oeis.org

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

Views

Author

Cheng Zhang (cz1(AT)rice.edu), Jan 28 2010, Mar 02 2010

Keywords

Comments

If n mod 6 = 1, both p and q must be 2, and a(n)=0 if n + 4 is not a prime. The values of a(n) for n=257,297,353,383,557 are either greater than 176 000 or 0. Several large entries: a(87) = 2^25633 + 87, a(717) = 2^3217 + 717, a(773) = 2^2539 + 773, a(927) = 2^1117 + 927.

Examples

			a(1)=5 because 5=2^2+1 is the smallest prime of the form p^q+1. a(2)=11 because 11=3^2+2. a(3)=7, because 7=2^2+3. a(17)=8209, because 8209=2^13+17. a(31)=0, because p^q+31 cannot be a prime.
		

Crossrefs

Programs

  • Mathematica
    For[l = {}; n = 1, n <= 70, n++, found = False; If[Mod[n, 2] == 0, For[rm = Infinity; i = 1, i < 100, i++, For[j = 1, j < 100, j++, p = Prime[i]; q = Prime[j]; r = p^q + n; If[r >= rm, Break[], If[PrimeQ[r], rm = r; found = True]]; ]; ], (* if n is odd, r=2^q+n *) If[Mod[n, 6] == 1, r = 4 + n; If[PrimeQ[r], found = True], For[j = 1, j < 1000, j++, q = Prime[j]; r = 2^q + n; If[PrimeQ[r], found = True; rm = r; Break[]]; ]; ]; ]; If[ ! found, rm = 0]; l = Append[l, rm]; ]; l
Previous Showing 11-13 of 13 results.