%I #12 May 10 2019 21:51:52
%S 3,5,15,21,24,28,36,41,59,64,89,100,101,120,131,132,141,153,155,168,
%T 180,203,204,208,209,215,220,231,244,280,288,300,309,315,336,341,348,
%U 351,395,405,408,429,448,453,455,495,520,540,551,567,568,580,592,636,648
%N Short legs of primitive Pythagorean triples which have a perimeter which is the average of a twin prime pair.
%e Triples (a,b,c) which satisfy the rules are (3,4,5), (5,12,13), (15,112,113), (21,220,221), (24,143,145), (28,195,197), (36,77,85), (41,840,841), (59,1740,1741), (64,1023,1025), (89,3960,3961), (100,2499,2501), ... 3+4+5=12 -> 11 and 13 are primes, 5+12+13=30 -> 29 and 31 are primes, ...
%p isA014574 := proc(n)
%p return ( isprime(n-1) and isprime(n+1) ) ;
%p end proc:
%p isA165260 := proc(n)
%p local d,bplc,b,c ;
%p for d in numtheory[divisors](n^2) do
%p bplc := n^2/d ;
%p c := (d+bplc)/2 ;
%p b := (bplc-d)/2 ;
%p if type(c,'integer') and type(b,'integer') then
%p if c > b and b >= n then
%p if igcd(n,b,c) = 1 and isA014574(n+b+c) then
%p return true;
%p end if;
%p end if;
%p end if;
%p end do:
%p return false;
%p end proc:
%p for n from 3 to 600 do
%p if isA165260(n) then
%p printf("%d,",n);
%p end if;
%p end do: # _R. J. Mathar_, Oct 29 2011
%t amax=10^4;lst={};k=0;q=12!;Do[If[(e=((n+1)^2-n^2))>amax,Break[]];Do[If[GCD[m,n]==1,a=m^2-n^2;b=2*m*n;If[GCD[a,b]==1,If[a>b,{a,b}={b,a}];If[a>amax,Break[]];c=m^2+n^2;x=a+b+c;If[PrimeQ[x-1]&&PrimeQ[x+1],k++;AppendTo[lst,a]]]],{m,n+1,12!,2}],{n,1,q,1}];Union@lst
%Y Cf. A020884, A014574, A009004, A165261, A165262.
%K nonn
%O 1,1
%A _Vladimir Joseph Stephan Orlovsky_, Sep 11 2009
|