abc mod m = abc mod n mod m, where n = φ(m) Euler’s totient function.
If m is prime, then n = m-1.
Edit: as Nabb pointed out, this only holds if a is coprime to m. So you would have to check this first.
More Related Contents:
- Custom Weighted Scale [closed]
- Sum a number with divisors to get another number
- How to create the most compact mapping n → isprime(n) up to a limit N?
- Mapping two integers to one, in a unique and deterministic way
- How to calculate an angle from three points? [closed]
- Least common multiple for 3 or more numbers
- Select k random elements from a list whose elements have weights
- Is it possible to express “t” variable from Cubic Bezier Curve equation?
- Choosing n numbers with fixed sum
- Fast way to calculate n! mod m where m is prime?
- Need help in mod 1000000007 questions
- Check if one integer is an integer power of another
- Modulus power of big numbers
- Puzzle: Find largest rectangle (maximal rectangle problem)
- How can I calculate the age of a person in year, month, days?
- 3D Least Squares Plane
- Shortest distance between points algorithm
- The Sieve of Atkin
- Determining if two line segments intersect? [duplicate]
- Fastest algorithm for circle shift N sized array for M position
- How do you find a point at a given perpendicular distance from a line?
- How to find distance from the latitude and longitude of two locations?
- Reverse complex 2D lookup table
- How do I determine whether my calculation of pi is accurate?
- JavaScript: Calculate the nth root of a number
- Given Prime Number N, Compute the Next Prime?
- Find out which combinations of numbers in a set add up to a given total
- Calculating phi(k) for 1
- How to generate a power set of a given set?
- Location of highest density on a sphere