MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Finding the Number of Pythagorean Triples below a bound


Hello Andrzej,

The code I used was this:

c1=Sqrt[N[a^2+b^2-k]];

countTriples[m_]:=Block[{a,b,i=0},For[a=1,a<(10^m/Sqrt[2]),a++,
For[b=a,b<10^m,b++,If[c1==Round[c1]&&c1<10^m,i++]]];i]

though m=3 takes about 50 sec (in an old comp) while m=4 will prolly be

around 5000 sec (83 mins). 


-Titus


  • Prev by Date: returning a variable's name, rather than the variable's contents
  • Next by Date: AuthorTools/MakeContents
  • Previous by thread: Re: Re: Re: Re: Finding the Number of Pythagorean Triples below a bound
  • Next by thread: Re: Re: Finding the Number of Pythagorean Triples below a bound