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.

A242518 Primes p for which p^n - 2 is prime for n = 1, 3, 5 and 7.

Original entry on oeis.org

201829, 2739721, 6108679, 7883329, 9260131, 9309721, 9917389, 14488249, 15386491, 15876481, 16685299, 16967191, 18145279, 20566969, 20869129, 21150991, 23194909, 25510189, 28406929, 34669909, 35039311, 36795169, 37912141, 39083521, 39805639
Offset: 1

Views

Author

Abhiram R Devesh, May 17 2014

Keywords

Comments

This is a subsequence of A242517.

Examples

			p = 201829  (prime)
p - 2 = 201827 (prime)
p^3 - 2 = 8221493263045787 (prime)
p^5 - 2 = 334902077869420623790640147 (prime)
p^7 - 2 = 13642217803107967058507788317851080907 (prime)
		

Crossrefs

Programs

  • Mathematica
    Select[Prime[Range[25*10^5]],AllTrue[#^{1,3,5,7}-2,PrimeQ]&] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Dec 26 2015 *)
  • Python
    import sympy
    n=2
    while n>1:
        n1=n-2
        n2=((n**3)-2)
        n3=((n**5)-2)
        n4=((n**7)-2)
        ##.Check if n1, n2, n3 and n4 are also primes
        if sympy.ntheory.isprime(n1)== True and sympy.ntheory.isprime(n2)== True and sympy.ntheory.isprime(n3)== True and sympy.ntheory.isprime(n4)== True:
            print(n, " , " , n1, " , ", n2, " , ", n3, " , ", n4)
        n=sympy.ntheory.nextprime(n)