Count Solutions Of ax ≡ b (mod m)

Computer Mathematics Hard 3 views
Back to Questions

Problem Description

Count how many x in [0..m-1] satisfy ax ≡ b (mod m).

Input Format

Three integers a b m.

Output Format

One integer count.

Sample Test Case

Input:
4 2 6
Output:
2

Constraints

m>0

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev