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.

A296422 Primes that can be represented in the form b^n+1 or b^n-1 where b >= 2 and n >= 2.

Original entry on oeis.org

3, 5, 7, 17, 31, 37, 101, 127, 197, 257, 401, 577, 677, 1297, 1601, 2917, 3137, 4357, 5477, 7057, 8101, 8191, 8837, 12101, 13457, 14401, 15377, 15877, 16901, 17957, 21317, 22501, 24337, 25601, 28901, 30977, 32401, 33857, 41617, 42437, 44101, 50177, 52901
Offset: 1

Views

Author

Nathaniel J. Strout, Dec 12 2017

Keywords

Comments

Union of A000668 and A121326. - Andrey Zabolotskiy, Dec 21 2017

Crossrefs

Cf. A000040 (primes), A001597 (perfect powers).
Cf. A000668 (Mersenne primes), A121326.

Programs

  • Maple
    N:= 10^5: # to get terms <= N
    R:= 3:
    for b from 2 while b^2+1 <= N do
      p:= 2:
      do
        p:= nextprime(p);
        if b^p-1 > N then break fi;
        if isprime(b^p-1) then R:= R, b^p-1 fi;
      od:
      p:= 1:
      do
        p:= 2*p;
        if b^p+1 > N then break fi;
        if isprime(b^p+1) then R:= R, b^p+1 fi;
      od;
    od:
    sort(convert({R},list)); # Robert Israel, Jan 08 2018
  • Mathematica
    Select[Prime@ Range[2, 10^4], AnyTrue[# + {-1, 1}, Or[# == 1, GCD @@ FactorInteger[#][[All, -1]] > 1] &] &] (* Michael De Vlieger, Dec 13 2017 *)
  • PARI
    lista(nn) = {forprime(p=2, nn, if ((p==2) || ispower(p+1) || ispower(p-1), print1(p, ", ")); ); } \\ Michel Marcus, Dec 13 2017