-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Replace p with m notation #1013
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
p_i should only be used for primes, while CRT works for any coprime m_i (esp. case of prime powers p^e)
Visit the preview URL for this PR (for commit 8bf848e): https://cp-algorithms--preview-1013-drvxtt8m.web.app (expires 2023-01-22T04:14:18.506363056Z) |
|
||
## Garner's Algorithm | ||
|
||
Another consequence of the CRT is that we can represent big numbers using an array of small integers. For example, let $p$ be the product of the first $1000$ primes. From calculations we can see that $p$ has around $3000$ digits. | ||
Another consequence of the CRT is that we can represent big numbers using an array of small integers. For example, let $p$ be the product of the first $1000$ primes. From calculations we can see that $P$ has around $3000$ digits. |
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.
I wanted to use capital P here but avoid touching the rest of the Garner's Algorithm section (which I'm not sure how useful it is) by leaving the usage of p_i
Visit the preview URL for this PR (for commit 0b18053): https://cp-algorithms--preview-1013-drvxtt8m.web.app (expires 2023-01-22T14:18:12.206390573Z) |
Also is the Java code for Garner's algorithm useful? Wouldn't a bigint implementation in pure C++ be more useful for the vast majority of CPers? |
Visit the preview URL for this PR (for commit 1ecb5fa): https://cp-algorithms--preview-1013-drvxtt8m.web.app (expires 2023-01-22T15:23:27.202152721Z) |
I'm not sure Garner's algorithm is useful at all in competitive programming context... I would also probably prefer Python implementation. |
Do we want to get rid of that section or just leave it if it doesn't hurt anything |
@jxu |
Although I've never used Garner's algorithm itself (bad time complexity, complicated).
Years ago I wrote some explanation to it here: https://discuss.codechef.com/t/problem-in-understanding-chineese-remainder-theorem/15899/2?u=afaxnraner |
p_i should only be used for primes, while CRT works for any coprime m_i (esp. case of prime powers p^e)
Feel free to come up with a more informative commit msg. I'm tired