OFFSET
1,1
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
EXAMPLE
a(1)=5 because (7^2 - 5^2)/2 - 1 = 11 and (7^2 - 5^2)/2 + 1 = 13 (11, 13 are both primes),
a(2)=13 because (17^2 - 13^2)/2 - 1 = 59 and (17^2 - 13^2)/2 + 1 = 61,
a(3)=29 because (31^2 - 29^2)/2 - 1 = 59 and (31^2 - 29^2)/2 + 1 = 61, ...
MAPLE
ts_p3_1:=proc(n) local a, b, i, ans; ans := [ ]: for i from 2 by 1 to n do a := (ithprime(i+1)^(2)-ithprime(i)^(2))/2-1: b := (ithprime(i+1)^(2)-ithprime(i)^(2))/2+1: if (isprime(a)=true and isprime(b)=true) then ans := [ op(ans), ithprime(i) ]: fi od; RETURN(ans) end: ts_p3_1(2000);
MATHEMATICA
Transpose[Select[Partition[Prime[Range[1000]], 2, 1], AllTrue[(#[[2]]^2- #[[1]]^2)/2+ {1, -1}, PrimeQ]&]][[1]] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Jun 03 2015 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Jani Melik, Aug 01 2007
STATUS
approved