Skip to content

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

Merged
merged 1 commit into from
Nov 20, 2018
Merged

pythagorean-triplet: Describe problem with variable sum N #1395

merged 1 commit into from
Nov 20, 2018

Conversation

petertseng
Copy link
Member

This form of the problem was ratified in the canonical data
#1332

Closes #1211

This form of the problem was ratified in the canonical data
#1332

Closes #1211
@@ -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`.
Copy link
Member Author

@petertseng petertseng Nov 12, 2018

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 *)

Copy link
Member Author

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"

fudanchii added a commit to fudanchii/rust that referenced this pull request Nov 20, 2018
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 ;)
Copy link
Member

@coriolinus coriolinus left a 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?

@petertseng
Copy link
Member Author

Given it's been a week, everyone else has missed the boat if they wanted to get on at all.

@petertseng petertseng merged commit 4599c2e into exercism:master Nov 20, 2018
@petertseng petertseng deleted the pytrip branch November 20, 2018 09:58
petertseng pushed a commit to fudanchii/rust that referenced this pull request Nov 20, 2018
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 ;)
petertseng pushed a commit to exercism/rust that referenced this pull request Nov 20, 2018
…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 ;)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants