Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

Re: Finding the Number of Pythagorean Triples below a bound

  • To: mathgroup at smc.vnet.net
  • Subject: [mg68409] Re: Finding the Number of Pythagorean Triples below a bound
  • From: titus_piezas at yahoo.com
  • Date: Fri, 4 Aug 2006 03:59:22 -0400 (EDT)
  • References: <eaeqa3$53v$1@smc.vnet.net><eakfgm$rl6$1@smc.vnet.net> <200608020923.FAA28520@smc.vnet.net> <79C36C70-E091-4A82-8EC5-0EDC743D081D@mimuw.edu.pl> <easiva$fp3$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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