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.

A245516 The smallest odd number k such that k^n-2 is a prime number.

Original entry on oeis.org

5, 3, 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
Offset: 1

Views

Author

Lei Zhou, Jul 24 2014

Keywords

Examples

			n=1, 3-2=1 is not prime, 5-2=3 is a prime number.  So a(1) = 5.
n=2, 3^2-2=7 is a prime number.  So a(2) = 3.
n=10, for k=3, 5, ..., 19, k^10-2 are all composite.  21^10-2 = 16679880978199 is a prime number.  So a(10) = 21.
		

Crossrefs

Cf. A095303.

Programs

  • Maple
    A245516 := proc(n)
        for k from 1 by 2 do
            if isprime(k^n-2) then
                return k;
            end if;
        end do:
    end proc:
    seq(A245516(n),n=1..60) ;
  • Mathematica
    Table[n = 1;
    While[n = n + 2; cp = n^i - 2; ! PrimeQ[cp]]; n, {i, 1, 68}]