Given an integer X. Your task is to find out how many positive integers n ( 1 <= n <= X) satisfies the following condition:-
Constraints:
2 <= p <= 106,
1 <= a,b< p,
1 <= X <= 1012
I have no idea how to solve this question, any approach or proof will be highly helpful.
Thanks.