P952
projecteuler.net

Order Modulo Factorial

ℹ️Published on Sunday, 29th June 2025, 02:00 am; Solved by 296;
Difficulty level: 15

Given a prime $p$ and a positive integer $n \lt p$, let $R(p, n)$ be the multiplicative order of $p$ modulo $n!$.
In other words, $R(p, n)$ is the minimal positive integer $r$ such that

$$p^r \equiv 1 \pmod{n!}$$

For example, $R(7, 4) = 2$ and $R(10^9 + 7, 12) = 17280$.

Find $R(10^9 + 7, 10^7)$. Give your answer modulo $10^9 + 7$.



Soluzione

Last modified: February 25, 2026. Website built with Franklin.jl and the lovely Julia programming language.