C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 10-01-2009, 07:36 PM   #1
Registered User
 
Join Date: Jan 2009
Posts: 65
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 !!
jack_carver is offline   Reply With Quote
Old 10-01-2009, 07:40 PM   #2
Woof, woof!
 
zacs7's Avatar
 
Join Date: Mar 2007
Location: Australia
Posts: 3,400
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).
__________________
My homepage | premake | vim

Last edited by zacs7; 10-01-2009 at 07:42 PM.
zacs7 is offline   Reply With Quote
Old 10-01-2009, 08:00 PM   #3
Registered User
 
Join Date: Jan 2009
Posts: 65
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 !
jack_carver is offline   Reply With Quote
Old 10-01-2009, 08:05 PM   #4
Woof, woof!
 
zacs7's Avatar
 
Join Date: Mar 2007
Location: Australia
Posts: 3,400
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).
__________________
My homepage | premake | vim
zacs7 is offline   Reply With Quote
Old 10-01-2009, 08:21 PM   #5
Registered User
 
Join Date: Jan 2009
Posts: 65
Re

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

Thread Tools
Display Modes

Forum Jump

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


All times are GMT -6. The time now is 12:17 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22