login
Primes prime(n) such that both of the numbers (prime(n+1)^2-prime(n)^2)/2 - 1 and (prime(n+1)^2-prime(n)^2)/2 + 1 are primes.
1

%I #6 Jun 03 2015 16:25:07

%S 5,13,29,43,103,163,167,421,547,557,587,631,659,691,701,809,823,883,

%T 919,977,1249,1367,1459,1499,1637,1663,1693,1747,1801,1889,1987,2129,

%U 2203,2549,2719,3089,3137,3221,3329,3389,3637,3881,4327,4507,4513,4663,4783

%N Primes prime(n) such that both of the numbers (prime(n+1)^2-prime(n)^2)/2 - 1 and (prime(n+1)^2-prime(n)^2)/2 + 1 are primes.

%H Harvey P. Dale, <a href="/A130066/b130066.txt">Table of n, a(n) for n = 1..1000</a>

%e a(1)=5 because (7^2 - 5^2)/2 - 1 = 11 and (7^2 - 5^2)/2 + 1 = 13 (11, 13 are both primes),

%e a(2)=13 because (17^2 - 13^2)/2 - 1 = 59 and (17^2 - 13^2)/2 + 1 = 61,

%e a(3)=29 because (31^2 - 29^2)/2 - 1 = 59 and (31^2 - 29^2)/2 + 1 = 61, ...

%p 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);

%t 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 *)

%Y Cf. A130761.

%K nonn

%O 1,1

%A _Jani Melik_, Aug 01 2007