Maximize Number of Nice Divisors

You are given a positive integer primeFactors. You are asked to construct a positive integer n that satisfies the following conditions:

  • The number of prime factors of n (not necessarily distinct) is at most primeFactors.
  • The number of nice divisors of n is maximized. A divisor of n is nice if it is divisible by every prime factor of n.

Return the number of nice divisors of n. Since that number can be too large, return it modulo 10^9 + 7.

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 are a list of prime numbers such that their product equals n.

Example 1
InputprimeFactors = 5
Output6
200 is valid with 5 prime factors [2, 2, 2, 5, 5] and has 6 nice divisors, which is the maximum possible.
Example 2
InputprimeFactors = 8
Output18
The maximum possible number of nice divisors using at most 8 prime factors is 18.

Constraints

  • 1 <= primeFactors <= 10^9

Asked at 1 companies

</>

Your Solution

(Ctrl/Cmd + Enter)

Switching Language

Loading template...

Loading...

Sign in to save your progress

AI code evaluation

Get a correctness verdict, missed edge cases, and complexity analysis of your solution.

Sign in to evaluate