#P6788. 「EZEC-3」四月樱花

    ID: 5760 远端评测题 900ms 500MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>数学2020洛谷原创O2优化素数判断,质数,筛法洛谷月赛

「EZEC-3」四月樱花

Description

In April, when sakura are in full bloom, Muxii looked at the sakura falling all over the sky and asked ZZH beside him:

"Exactly how many sakura petals fall in this April?"

ZZH answered: "The number of fallen sakura, ss, and time tt satisfy the following relation:

$$s=\prod_{x=1}^t\prod_{y|x}\frac{y^{d(y)}}{\prod_{z|y}(z+1)^2}$$

where d(y)d(y) denotes the number of divisors of yy."

But as a liberal arts student beginner, Muxii obviously could not clearly know the exact value, so he had to keep asking ZZH for the answer to this question.

Since the value may be very large, you only need to tell Muxii the result of the answer modulo pp for ZZH.

Input Format

Two positive integers tt and pp, representing the time asked by Muxii and the modulus, respectively.

Output Format

Output a positive integer ss, representing the number of fallen sakura. Output the answer modulo pp.

4 998244353
648735108
10 1000000007
872041698

Hint

"Sample 1 Explanation"

By direct substitution, the answer is 12073600\frac1{2073600}. Since the modular inverse of 20736002073600 modulo 998244353998244353 is 648735108648735108, the final answer is 1×648735108mod998244353=6487351081×648735108\bmod998244353 = 648735108.

"Constraints and Notes"

The testdata guarantees that in the fraction in lowest terms of the answer, the denominator does not contain pp or any multiple of pp.

For all testdata, it is guaranteed that 1t2.5×1091\leq t\leq 2.5×10^9, 9.9×108<p<1.1×1099.9×10^8<p<1.1×10^9, and pp is a prime number. |Subtask ID|tt\leq|Score| |:-:|:-:|:-:| |11|10310^3|55| |22|10410^4|55| |33|2×1052×10^5|1010| |44|2×1062×10^6|2020| |55|10710^7|2020| |66|10810^8|2020| |77|2.5×1092.5×10^9|2020|

Note: This problem uses bundled judging, meaning you must pass all test points of a subtask to receive the score for that subtask.

Translated by ChatGPT 5