OFFSET
1,1
LINKS
Pierre CAMI, Table of n, a(n) for n = 1..10000
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