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

Modified Code #4

Open
GaryAvc opened this issue May 4, 2020 · 0 comments
Open

Modified Code #4

GaryAvc opened this issue May 4, 2020 · 0 comments

Comments

@GaryAvc
Copy link

GaryAvc commented May 4, 2020

you could modify this code by changing

modulos.add((int) ((
modulos.get( i ) % m +
modulos.get(i + 1) % m ) % m));

to

modulos.add((int) ((
modulos.get( i ) +
modulos.get(i + 1) ) % m));

it work correctly,
since what you add before is the remainder of m, it have to be smaller than m
So the step of modulos.get(i) %m is useless and meaningless, since modulos.get(i) always <=m
which means
modulos.get(i)%m equal to modulos.get(i)

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