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

A095304 Smallest prime of the form k^n-2.

Original entry on oeis.org

2, 2, 727, 79, 241, 727, 823541, 5764799, 19681, 16679880978199, 31381059607, 13841287199, 42052983462257057, 6103515623, 4747561509941, 28644003124274380508351359, 98526125335693359373, 136753052840548005895349735207879, 22168378200531005859373
Offset: 1

Views

Author

Hugo Pfoertner, Jun 01 2004

Keywords

Examples

			a(7)=7^7-2=823541 is prime whereas 3^7-2=2185 and 5^7-2=78123 are composite.
		

Crossrefs

Cf. A095303 (smallest k such that k^n-2 is prime), A087576 (smallest k such that k^n+2 is prime), A095302 (corresponding primes).

Programs

  • Mathematica
    Table[k = 2; While[p = k^n - 2; ! PrimeQ[p], k++]; p, {n, 20}] (* T. D. Noe, Apr 03 2012 *)

Extensions

a(2) corrected by Zak Seidov, Apr 03 2012

A095303 Smallest number k such that k^n - 2 is prime.

Original entry on oeis.org

4, 2, 9, 3, 3, 3, 7, 7, 3, 21, 9, 7, 19, 5, 7, 39, 15, 61, 15, 19, 21, 3, 19, 17, 21, 5, 21, 7, 85, 17, 7, 21, 511, 27, 27, 59, 3, 19, 91, 45, 3, 29, 321, 65, 9, 379, 69, 125, 49, 5, 9, 45, 289, 341, 61, 89, 171, 171, 139, 21, 139, 75, 25, 49, 15, 51, 57, 175, 31, 137, 147, 25, 441
Offset: 1

Views

Author

Hugo Pfoertner, Jun 01 2004

Keywords

Comments

The Bunyakovsky conjecture implies a(n) exists for all n. - Robert Israel, Jul 15 2018
Some of the results were computed using the PrimeFormGW (PFGW) primality-testing program. - Hugo Pfoertner, Nov 16 2019

Examples

			a(1) = 4 because 4^1 - 2 = 2 is prime, a(3) = 9 because 3^3 - 2 = 25, 5^3 - 2 = 123 and 7^3 - 2 = 341 = 11 * 31 are composite, whereas 9^3 - 2 = 727 is prime.
		

Crossrefs

Cf. A095304 (corresponding primes), A087576 (smallest k such that k^n+2 is prime), A095302 (corresponding primes).
Cf. A014224.

Programs

  • Maple
    f:= proc(n) local k;
      for k from 3 by 2 do
        if isprime(k^n-2) then return k fi
      od
    end proc:
    f(1):= 4: f(2):= 2:
    map(f, [$1..100]); # Robert Israel, Jul 15 2018
  • Mathematica
    a095303[n_] := For[k = 1, True, k++, If[PrimeQ[k^n - 2], Return[k]]]; Array[a095303, 100] (* Jean-François Alcover, Mar 01 2019 *)
  • PARI
    for (n=1,73,for(k=1,oo,if(isprime(k^n-2),print1(k,", ");break))) \\ Hugo Pfoertner, Oct 28 2018

Extensions

a(2) and a(46) corrected by T. D. Noe, Apr 03 2012

A095302 Smallest prime of the form k^n+2 with k>1.

Original entry on oeis.org

3, 5, 11, 29, 83, 59051, 3518743763, 4782971, 6563, 2357947693, 59051, 8649755859377, 282429536483, 2541865828331, 4782971, 14348909, 6568408355712890627, 762939453127, 150094635296999123, 15398217140735709790332844752065729, 332525673007965087890627
Offset: 0

Views

Author

Hugo Pfoertner, Jun 01 2004

Keywords

Examples

			a(5) = 59051 because 9^5+2 is prime whereas 3^5+2 = 5*7^2, 5^5+2 = 53*59 and 7^5+2 = 3*13*431 are composite.
		

Crossrefs

Cf. A087576 (corresponding k).
Cf. A095303 and A095304 (for k^n-2).

Programs

  • Mathematica
    sp[n_]:=Module[{k=2},While[!PrimeQ[k^n+2],k++];k^n+2]; Array[sp,30,0] (* Harvey P. Dale, Feb 22 2012 *)

Extensions

More terms from Harvey P. Dale, Feb 22 2012

A087577 Smallest number k such that k^n + 3 is a prime.

Original entry on oeis.org

2, 2, 2, 2, 8, 2, 2, 4, 4, 8, 10, 2, 20, 4, 2, 2, 10, 2, 124, 46, 16, 20, 190, 14, 68, 50, 152, 2, 34, 2, 34, 122, 130, 208, 374, 46, 68, 64, 10, 28, 248, 4, 106, 230, 34, 208, 52, 34, 154, 230, 116, 302, 656, 38, 2, 10, 16, 34, 140, 140, 20, 232, 140, 28, 64, 328, 2, 98, 28, 818
Offset: 1

Views

Author

Amarnath Murthy, Sep 17 2003

Keywords

Examples

			a(5) = 8 as 8^5 + 3= 32771 is prime, while 2^5 +3, 4^5+3 and 6^5 +3 are composite.
		

Crossrefs

Cf. A087576.

Programs

  • Mathematica
    snk[n_]:=Module[{k=1},While[!PrimeQ[k^n+3],k++];k]; Array[snk,70] (* Harvey P. Dale, Mar 08 2014 *)
  • PARI
    for(j=1,50, for (i=1,150,if(isprime(i^j+3),print1(i,",");break())))

Extensions

More terms from Mohammed Bouayoun (bouyao(AT)wanadoo.fr), Mar 14 2004
More terms from David Wasserman, Jun 08 2005

A359396 a(n) is the least k such that k^j+2 is prime for j = 1 to n but not n+1.

Original entry on oeis.org

5, 9, 105, 3, 909, 4995825, 28212939
Offset: 1

Views

Author

Robert Israel, Dec 29 2022

Keywords

Comments

All terms are odd, and all except a(1) = 5 are divisible by 3.
The generalized Bunyakovsky conjecture implies that a(n) exists for all n.
a(8) > 10^10.
a(8) > 10^11. - Lucas A. Brown, Jan 11 2023

Examples

			a(4) = 3 because 3^1 + 2 = 5, 3^2 + 2 = 11, and 3^3 + 2 = 29 and 3^4 + 2 = 83 are prime but 3^5 + 2 = 245 is not.
		

Crossrefs

Cf. A087576.

Programs

  • Maple
    f:= proc(n) local j;
     for j from 1 do
         if not isprime(n^j+2) then return j-1 fi
     od
    end proc:
    V:= Vector(7): V[1]:= 5: count:= 1:
    for k from 3 by 6 while count < 7 do
     v:= f(k);
     if v > 0 and V[v] = 0 then V[v]:= k; count:= count+1 fi
    od:
    convert(V,list);
  • Python
    from sympy import isprime
    from itertools import count, islice
    def f(k):
        j = 1
        while isprime(k**j + 2): j += 1
        return j-1
    def agen():
        adict, n = dict(), 1
        for k in count(2):
            v = f(k)
            if v not in adict: adict[v] = k
            while n in adict: yield adict[n]; n += 1
    print(list(islice(agen(), 5))) # Michael S. Branicky, Jan 09 2023
Showing 1-5 of 5 results.