Set 105Question 4

Fahim's Coprime Range Counter

Very hardWritten in CMust finish in 5 seconds

Fahim needs to count how many IDs in a huge range at a hospital's records desk are coprime to a fixed system modulus N.

What your program reads

Three integers N L R.

What your program prints

Count of integers in [L,R] coprime to N.

Limits

1 ≤ N ≤ 10^12

Example input

6 1 20

Expected output

7
main.c

Your work is saved in this browser as you type.

Loading editor…
Input for Run

Run tries your code on the input above and shows what it prints. Submit checks your output against every test, including hidden ones.

Shortcut: Ctrl + Enter sends it to the judge.

Fahim's Coprime Range Counter · DIU ContestHub