Thread: pythagorean triples

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    71

    pythagorean triples

    Is there any way to generate all pythagorean triples given its hypotenuse other that brute force ??
    ex: given 25 as hypotenuse
    ans :
    7,24,25
    15 20 25

    Thank u !!

  2. #2
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Formulas for generating Pythagorean triples - Wikipedia, the free encyclopedia
    Sure all 12 ways might not apply... but it's a start. Hint: Take a look at number 10 (X).
    Last edited by zacs7; 10-01-2009 at 07:42 PM.

  3. #3
    Registered User
    Join Date
    Jan 2009
    Posts
    71

    Re

    Using III i can only get the starting primitive triple .
    unfortunately rest all dont apply (and or ) are difficult to code

    Thank you for your reply !

  4. #4
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Quote Originally Posted by jack_carver View Post
    Using III i can only get the starting primitive triple .
    unfortunately rest all dont apply (and or ) are difficult to code

    Thank you for your reply !
    Well that's usually how it works when you don't want to use the brute force method. I don't see what's hard about X (10).

  5. #5
    Registered User
    Join Date
    Jan 2009
    Posts
    71

    Re

    The thing is c can be very large ~ 10^18 !
    so cant brute force all of it !

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Pythagorean Numbers
    By NightLightSky in forum C++ Programming
    Replies: 4
    Last Post: 09-15-2009, 09:34 PM
  2. Pythagorean Theorem Program Comment, criticize, or whatever
    By Sshakey6791 in forum C++ Programming
    Replies: 7
    Last Post: 02-13-2009, 02:48 AM
  3. Problem with Pythagorean triple etc.
    By -Prime- in forum C Programming
    Replies: 10
    Last Post: 10-14-2006, 01:50 AM
  4. Pythagorean Programming
    By mikeprogram in forum C++ Programming
    Replies: 3
    Last Post: 10-30-2005, 01:29 PM
  5. Brute Force
    By Wiz_Nil in forum C++ Programming
    Replies: 13
    Last Post: 02-15-2002, 01:28 PM