G - Has Many Divisors 解説
by
Xterfusion
Editorial
This is an English translation of the official editorial.
For a positive integer \(n\) and a prime \(p\), let \(v_p(n)\) denote the largest integer \(k\) such that \(n\) is a multiple of \(p^k\).
We summarize the structure of the smallest optimal solution \(x\). Since \(x\) is not a multiple of \(D\), there exists a prime \(p\) such that \(v_p(x) < v_p(D)\). Once such a prime is fixed, for primes \(q, r\) different from \(p\), we have \(q < r \implies v_q(x) \ge v_r(x)\). This follows because, setting \(a := v_q(x)\) and \(b := v_r(x)\), if \(a < b\), then \(x\) and \(x(q/r)^{b-a}\) have the same number of divisors, and \(x > x(q/r)^{b-a}\), so the minimality of \(x\) implies the claim. Similarly, for a prime \(q < p\), it also follows that \(v_q(x) \ge v_p(x)\).
When actually enumerated, there are only \(281944\) integers \(x \le 10^{18}\) satisfying the above conditions, so exhaustive search is sufficiently fast. In implementation, it suffices to enumerate the positive integer sequences corresponding to the exponents, and the integers corresponding to them, such that the total product is at most \(10^{18}\), the sequence is non-increasing except for at most one element, and the excluded element, if it exists, is also at most the element immediately preceding it. By searching in this way, one can simultaneously compute the number of divisors of each enumerated integer.
Note that even if one does not use the condition \(v_q(x) \ge v_p(x)\) for primes \(q < p\), or fixes \(p\) and searches for the same integer from multiple primes \(p\), the number of searched items is still sufficiently small; many approaches similar to these are sufficiently fast under an appropriate implementation.
投稿日時:
最終更新:
