-
-
Notifications
You must be signed in to change notification settings - Fork 555
pythagorean-triplet: Describe problem with variable sum N #1395
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
Conversation
@@ -17,6 +17,6 @@ For example, | |||
3**2 + 4**2 = 9 + 16 = 25 = 5**2. | |||
``` | |||
|
|||
There exists exactly one Pythagorean triplet for which a + b + c = 1000. | |||
Given an input integer N, find all Pythagorean triplets for which `a + b + c = N`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debatable: whether to explicitly note here that "none" is a possible answer. For example:
all Pythagorean triplets for which
a + b + c = N
(possibly zero triplets)
I chose not to since…
- The additional clarification is not necessary for this to be a true statement. Zero triplets is a valid result for the word "all".
- Even if a student were to miss the possibility of zero triplets, it is highly unlikely to be a fatal error requiring a rewrite of the entire implementation upon discovery. The student has already been dealing with a variable number of triplets because the test case for zero triplets comes after the test cases for multiple triplets. Even in a language whose type system prevents the return type from having zero elements, in the only such language I know, making that change is a mere one-character change (change a + to a *)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the only such language I know
Well, today I learned about http://hackage.haskell.org/package/base-4.12.0.0/docs/Data-List-NonEmpty.html . But perhaps I can say that this is likely not the default thing that the student will reach for. So I will stand by the judgment of not explicitly saying "possibly zero"
This is as described in exercism/problem-specifications#1395 The current README will really confuse non math-savvy students, as it asked to find `a*b*c`, while the tests actually check for the triplets. Change it to asks for the triplet explicitly. Give the answer for N = 1000 as it's also spoiled in the test file ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks entirely reasonable. It's been open for a week without discussion. Is there any reason not to merge this immediately?
Given it's been a week, everyone else has missed the boat if they wanted to get on at all. |
This is as described in exercism/problem-specifications#1395 The current README will really confuse non math-savvy students, as it asked to find `a*b*c`, while the tests actually check for the triplets. Change it to asks for the triplet explicitly. Give the answer for N = 1000 as it's also spoiled in the test file ;)
…754) This is as described in exercism/problem-specifications#1395 The current README will really confuse non math-savvy students, as it asked to find `a*b*c`, while the tests actually check for the triplets. Change it to ask for the triplet explicitly. Give the answer for N = 1000 as it's also spoiled in the test file ;)
This form of the problem was ratified in the canonical data
#1332
Closes #1211