Pythagorean triples: Difference between revisions

m
m (→‎version 1: ptimatives -> primitives)
Line 1,785:
if @.a.b.c then iterate
trips=trips+1 /*eureka. */
prims=prims+1 /*count this primativeprimitive triple. */
 
do m=2; !a=a*m; !b=b*m; !c=c*m /*gen non-primativesprimitives.*/
if !a+!b+!c>N then leave /*is this multiple a triple ? */
trips=trips+1 /*yuppers, then we found another.*/
Line 1,798:
say 'max perimeter = 'N, /*show a single line of output. */
left('',7) "Pythagorean triples =" trips, /*left('',0) = 7 blanks.*/
left('',7) 'primativesprimitives =' prims
/*stick a fork in it, we're done.*/</lang>
'''output''' is identical to version 1.
2,301

edits