Skip to content
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

013-greatest_common_divisor does not guarantee that result is the gcd #48

Open
Tracked by #44
jesyspa opened this issue Oct 2, 2024 · 3 comments
Open
Tracked by #44
Labels
weak postcondition The postcondition is (much) weaker than what is specified in the prompt

Comments

@jesyspa
Copy link
Collaborator

jesyspa commented Oct 2, 2024

The postcondition does not relate the result to the inputs at all.

@jesyspa jesyspa added the weak postcondition The postcondition is (much) weaker than what is specified in the prompt label Oct 2, 2024
@alex28sh
Copy link
Collaborator

alex28sh commented Oct 4, 2024

We could prove that gcd divides both a and b, like that https://gist.github.com/alex28sh/fc2608027fdb923b1f524fe7ccfad5d9

@alex28sh
Copy link
Collaborator

alex28sh commented Oct 4, 2024

Though it requires some changes in code, it preserves the idea with modulo division

@jesyspa
Copy link
Collaborator Author

jesyspa commented Oct 5, 2024

I think that would be an improvement, though proving it's the greatest such number would also be interesting. I'm not sure whether it's best to express divisibility by this kind of existence statement, or by n % k == 0, by the way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
weak postcondition The postcondition is (much) weaker than what is specified in the prompt
Projects
None yet
Development

No branches or pull requests

2 participants