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.

This page as a plain text file.
%I A242518 #23 May 22 2025 10:21:38
%S A242518 201829,2739721,6108679,7883329,9260131,9309721,9917389,14488249,
%T A242518 15386491,15876481,16685299,16967191,18145279,20566969,20869129,
%U A242518 21150991,23194909,25510189,28406929,34669909,35039311,36795169,37912141,39083521,39805639
%N A242518 Primes p for which p^n - 2 is prime for n = 1, 3, 5 and 7.
%C A242518 This is a subsequence of A242517.
%H A242518 Harvey P. Dale, <a href="/A242518/b242518.txt">Table of n, a(n) for n = 1..150</a> (first 100 terms from Abhiram R Davesh)
%e A242518 p = 201829  (prime)
%e A242518 p - 2 = 201827 (prime)
%e A242518 p^3 - 2 = 8221493263045787 (prime)
%e A242518 p^5 - 2 = 334902077869420623790640147 (prime)
%e A242518 p^7 - 2 = 13642217803107967058507788317851080907 (prime)
%t A242518 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 *)
%o A242518 (Python)
%o A242518 import sympy
%o A242518 n=2
%o A242518 while n>1:
%o A242518     n1=n-2
%o A242518     n2=((n**3)-2)
%o A242518     n3=((n**5)-2)
%o A242518     n4=((n**7)-2)
%o A242518     ##.Check if n1, n2, n3 and n4 are also primes
%o A242518     if sympy.ntheory.isprime(n1)== True and sympy.ntheory.isprime(n2)== True and sympy.ntheory.isprime(n3)== True and sympy.ntheory.isprime(n4)== True:
%o A242518         print(n, " , " , n1, " , ", n2, " , ", n3, " , ", n4)
%o A242518     n=sympy.ntheory.nextprime(n)
%Y A242518 Cf. A242517, A240126, A001359, A006512.
%K A242518 nonn
%O A242518 1,1
%A A242518 _Abhiram R Devesh_, May 17 2014