Given an integer p > 1, find the smallest integer q > p such that the list of exponents in the prime factorization of q is the same of that of p, no matter the order or the value of the prime factors.
Examples
The prime factorization of p = 20 is 22 x 51. The smallest integer greater than p with identical exponents in its prime factorization is q = 28 = 22 x 71.
The prime factorization of p = 2500 is 22 x 54. The smallest integer greater than p with identical exponents in its prime factorization is q = 2704 = 24 x 132.
Rules
- The input is guaranteed to be an integer greater than 1.
- This is code-golf, so the shortest answer in bytes wins.
Test cases
Input | Output
------+-------
2 | 3
20 | 28
103 | 107
256 | 6561
768 | 1280
2500 | 2704
4494 | 4510
46552 | 46584
75600 | 105840