A Math Contest P16 - Morbius vs. Suibom

View as PDF

Submit solution

Points: 25
Time limit: 2.0s
Memory limit: 512M

Author:
Problem type

Let f(x,y) be the lowest common multiple of x and y and g(x,y) be the greatest common divisor of x and y. Determine x=1Ny=1Nf(x,y)×g(x,y)2 modulo a prime number, K.

Input Specification

The only line will contain two space-separated integers, N (1N1010) and K (2K2×109).

Output Specification

Output x=1Ny=1Nf(x,y)×g(x,y)2 modulo K.

Sample Input

Copy
10 131

Sample Output

Copy
64

Comments

There are no comments at the moment.