Warning: Parameter 3 to processSchemeCodeTag() expected to be a reference, value given in /Users/gambit/Sites/wiki/includes/parser/Parser.php on line 3333
Script:Math:primitive-pythagorean-triples.scm - Gambit wiki

Script:Math:primitive-pythagorean-triples.scm

From Gambit wiki

(Difference between revisions)
Jump to: navigation, search
(Script:Math:primitive-pythagorean-triples.scm)
 
Line 13: Line 13:
       for (int j=i; j<n; j++)
       for (int j=i; j<n; j++)
         {
         {
-
           int x = sqrt(i*i + j*j);
+
           double x = sqrt(i*i + j*j);
           if (x == floor(x) && gcd(i,j) == 1)
           if (x == floor(x) && gcd(i,j) == 1)
             println(i,"^2 + ",j,"^2 = ",x,"^2");
             println(i,"^2 + ",j,"^2 = ",x,"^2");

Latest revision as of 15:01, 28 July 2011

Personal tools
documentation