Given a string str representing a large integer, the task is to find the result of N % 4.
Input: N = 81
Input: N = 46234624362346435768440
Approach: The remainder of division by 4 is dependent on only the last 2 digits of a number, so instead of dividing N we divide only the last two digits of N and find the remainder.
Below is the implementation of the above approach:
Time Complexity: O(1)
- Program to find remainder when large number is divided by 11
- Program to find remainder when large number is divided by r
- Remainder with 7 for large numbers
- Program to find remainder without using modulo or % operator
- Find remainder of array multiplication divided by n
- Find (a^b)%m where 'b' is very large
- Find (a^b)%m where 'a' is very large
- Find Last Digit of a^b for Large Numbers
- Find the value of XXXX.....(N times) % M where N is large
- Multiply large integers under large modulo
- Quotient - Remainder Sort
- Program for quotient and remainder of big number
- Using Chinese Remainder Theorem to Combine Modular equations
- Chinese Remainder Theorem | Set 2 (Inverse Modulo based Implementation)
- LCM of two large numbers
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.