|
1 | 1 | packagecom.fishercoder.solutions;
|
2 | 2 |
|
3 |
| -/** |
4 |
| - * 1175. Prime Arrangements |
5 |
| - * |
6 |
| - * Return the number of permutations of 1 to n so that prime numbers are at prime indices (1-indexed.) |
7 |
| - * (Recall that an integer is prime if and only if it is greater than 1, |
8 |
| - * and cannot be written as a product of two positive integers both smaller than it.) |
9 |
| - * Since the answer may be large, return the answer modulo 10^9 + 7. |
10 |
| - * |
11 |
| - * Example 1: |
12 |
| - * Input: n = 5 |
13 |
| - * Output: 12 |
14 |
| - * Explanation: 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. |
15 |
| - * |
16 |
| - * Example 2: |
17 |
| - * Input: n = 100 |
18 |
| - * Output: 682289015 |
19 |
| - * |
20 |
| - * Constraints: |
21 |
| - * 1 <= n <= 100 |
22 |
| - * */ |
23 | 3 | publicclass_1175 {
|
24 | 4 | publicstaticclassSolution1 {
|
25 | 5 | publicintnumPrimeArrangements(intn) {
|
|