Class Solution
java.lang.Object
g1101_1200.s1175_prime_arrangements.Solution
1175 - Prime Arrangements.<p>Easy</p>
<p>Return the number of permutations of 1 to <code>n</code> so that prime numbers are at prime indices (1-indexed.)</p>
<p><em>(Recall that an integer is prime if and only if it is greater than 1, and cannot be written as a product of two positive integers both smaller than it.)</em></p>
<p>Since the answer may be large, return the answer **modulo <code>10^9 + 7</code> **.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> n = 5</p>
<p><strong>Output:</strong> 12</p>
<p><strong>Explanation:</strong> For example [1,2,5,4,3] is a valid permutation, but [5,2,3,4,1] is not because the prime number 5 is at index 1.</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> n = 100</p>
<p><strong>Output:</strong> 682289015</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= n <= 100</code></li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
numPrimeArrangements
public int numPrimeArrangements(int n)
-