1808. Maximize Number of Nice Divisors Hard
1/**
2 * [1808] Maximize Number of Nice Divisors
3 *
4 * You are given a positive integer primeFactors. You are asked to construct a positive integer n that satisfies the following conditions:
5 *
6 *
7 * The number of prime factors of n (not necessarily distinct) is at most primeFactors.
8 * The number of nice divisors of n is maximized. Note that a divisor of n is nice if it is divisible by every prime factor of n. For example, if n = 12, then its prime factors are [2,2,3], then 6 and 12 are nice divisors, while 3 and 4 are not.
9 *
10 *
11 * Return the number of nice divisors of n. Since that number can be too large, return it modulo 10^9 + 7.
12 *
13 * Note that a prime number is a natural number greater than 1 that is not a product of two smaller natural numbers. The prime factors of a number n is a list of prime numbers such that their product equals n.
14 *
15 *
16 * Example 1:
17 *
18 *
19 * Input: primeFactors = 5
20 * Output: 6
21 * Explanation: 200 is a valid value of n.
22 * It has 5 prime factors: [2,2,2,5,5], and it has 6 nice divisors: [10,20,40,50,100,200].
23 * There is not other value of n that has at most 5 prime factors and more nice divisors.
24 *
25 *
26 * Example 2:
27 *
28 *
29 * Input: primeFactors = 8
30 * Output: 18
31 *
32 *
33 *
34 * Constraints:
35 *
36 *
37 * 1 <= primeFactors <= 10^9
38 *
39 */
40pub struct Solution {}
41
42// problem: https://leetcode.com/problems/maximize-number-of-nice-divisors/
43// discuss: https://leetcode.com/problems/maximize-number-of-nice-divisors/discuss/?currentPage=1&orderBy=most_votes&query=
44
45// submission codes start here
46
47impl Solution {
48 pub fn max_nice_divisors(prime_factors: i32) -> i32 {
49 0
50 }
51}
52
53// submission codes end
54
55#[cfg(test)]
56mod tests {
57 use super::*;
58
59 #[test]
60 fn test_1808() {
61 }
62}
63
Back
© 2025 bowen.ge All Rights Reserved.