login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A245639
Prime numbers P such that 8*P^2-1 is also prime.
4
2, 3, 5, 11, 17, 19, 23, 31, 59, 67, 79, 89, 103, 107, 137, 173, 193, 229, 233, 241, 257, 263, 271, 311, 317, 353, 359, 383, 409, 431, 479, 509, 521, 523, 541, 563, 569, 577, 593, 599, 613, 641, 709, 739, 751, 787, 829, 887, 907, 919, 947, 971, 983, 1033
OFFSET
1,1
EXAMPLE
8*2^2-1=31 prime so a(1)=2.
8*3^2-1=71 prime so a(2)=3.
8*5^2-1=199 prime so a(3)=5.
8*7^2-1=391 composite.
8*11^2-1=967 prime so a(4)=11.
MATHEMATICA
Reap[Do[p = Prime[n]; If[PrimeQ[8*p^2-1], Sow[p]], {n, 1, 200}]][[2, 1]] (* Jean-François Alcover, Jul 28 2014 *)
Select[Prime[Range[200]], PrimeQ[8 #^2 - 1] &] (* Vincenzo Librandi, Sep 07 2014 *)
PROG
(PFGW & SCRIPT)
SCRIPT
DIM n, 0
DIMS t
OPENFILEOUT myf, a(n).txt
LABEL loop1
SET n, n+1
SETS t, %d, %d\,; n; p(n)
PRP 8*p(n)^2-1, t
IF ISPRP THEN GOTO a
GOTO loop1
LABEL a
WRITE myf, t
GOTO loop1
(PARI) select(p->isprime(8*p^2-1), primes(300)) \\ Colin Barker, Jul 28 2014
(Python)
import sympy
from sympy import isprime
from sympy import prime
for n in range(1, 10**3):
..p = prime(n)
..if isprime(8*p**2-1):
....print(p, end=', ')
# Derek Orr, Aug 13 2014
(Magma) [p: p in PrimesUpTo(1500)| IsPrime(8*p^2-1)]; // Vincenzo Librandi, Sep 07 2014
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Pierre CAMI, Jul 28 2014
STATUS
approved