Heronian triangles: Difference between revisions

→‎{{header|REXX}}: added check for: if side A is even, sides B and C must be odd. This decreased execution time by around 1/3.
m (→‎{{header|REXX}}: aligned statement and a comment.)
(→‎{{header|REXX}}: added check for: if side A is even, sides B and C must be odd. This decreased execution time by around 1/3.)
Line 695:
Heron: @.=.; y=' '; minP=9e9; maxP=0; minA=9e9; maxA=0; Ln=length(N)
#=0; #.=0; #.2=1 #.3=1; #.7=1; #.8=1 /*¬good √.*/
do a=3 to N; ev=\(a//2) /*start at a minimum side length.*/
inc=1+ev do b=a to N; ab=a+b /*AB:if A is usedeven, B & C formust summingbe below.odd*/
do do cb=ba+ev to N; p=ab+c; by inc; sab=p/2 a+b /*calculateAB: theis Perimeterused andfor summing Sbelow.*/
do c=b to N by inc; p=ab+c; s=p/2 /*calc Perimeter, S*/
_=s*(s-a)*(s-b)*(s-c); if _<=0 then iterate /*_ isn't positive.*/
if pos(.,_)\==0 then iterate /*not an integer. */