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

sum-of-multiples: handle cardinailty > 3 correctly #1367

Closed
yawpitch opened this issue Oct 13, 2018 · 0 comments
Closed

sum-of-multiples: handle cardinailty > 3 correctly #1367

yawpitch opened this issue Oct 13, 2018 · 0 comments

Comments

@yawpitch
Copy link
Contributor

It is possible to approach this exercises using an entirely arithmetic approach instead of a container type. In this approach the total of the arithmetic series of each factor must be compensated for overlaps using the inclusion-exclusion principle; the current body of tests handle only up to a cardinality of 3, but it is quite easy to get something passing a cardinality of 3 without realizing it will fail with cardinality of 4 or more. A test with 5 prime factors will demonstrate the ability of the solution to handle the problem generally.

petertseng pushed a commit that referenced this issue Oct 16, 2018
It is possible to approach this exercises using an entirely arithmetic
approach instead of a container type. In this approach the total of
the arithmetic series of each factor must be compensated for overlaps
using the inclusion-exclusion principle; the current body of tests
handle only up to a cardinality of 3, but it is quite easy to get
something passing a cardinality of 3 without realizing it will fail
with cardinality of 4 or more. A test with 5 prime factors will
demonstrate the ability of the solution to handle the problem
generally.

Limit is 10000 to ensure 4-wise multiples are excluded and 5-wise are
included.

Closes #1367
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

No branches or pull requests

1 participant