New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect Code for Computing Special Pythagorean Triplet #95
Comments
Good one. Thanks for the report! We'll check it out. |
Perhaps change the final line from: |
The solution proposed by ngaywood works on my machine. In the companion script, prob009-gerdr-feeds.pl, commenting out the line |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Examples prob009-gerdr.pl and gerdr-feeds.pl give an incorrect answer.
The object is to find three numbers, a < b < c, such that (1) a ** 2 + b ** 2 = c ** 2; and, (2) a + b + c = 1000. The correct answer is 200 375 and 425, but each of the above mentioned scripts gives 31875000 (which is 200 * 375 * 425).
The attached file (adapted from prob009-gerdr.pl) gives the correct answer (thus indicating that the problem stems from using gather ... take).
find_Pythagorean_Triplet.txt
Edit: Full code in the above link is :
The text was updated successfully, but these errors were encountered: