1175. Prime Arrangements Easy

@problem@discussion
#Math



1/**
2 * [1175] Prime Arrangements
3 *
4 * Return the number of permutations of 1 to n so that prime numbers are at prime indices (1-indexed.)
5 * (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.)
6 * Since the answer may be large, return the answer modulo 10^9 + 7.
7 *  
8 * Example 1:
9 * 
10 * Input: n = 5
11 * Output: 12
12 * 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.
13 * 
14 * Example 2:
15 * 
16 * Input: n = 100
17 * Output: 682289015
18 * 
19 *  
20 * Constraints:
21 * 
22 * 	1 <= n <= 100
23 * 
24 */
25pub struct Solution {}
26
27// problem: https://leetcode.com/problems/prime-arrangements/
28// discuss: https://leetcode.com/problems/prime-arrangements/discuss/?currentPage=1&orderBy=most_votes&query=
29
30// submission codes start here
31
32impl Solution {
33    pub fn num_prime_arrangements(n: i32) -> i32 {
34        0
35    }
36}
37
38// submission codes end
39
40#[cfg(test)]
41mod tests {
42    use super::*;
43
44    #[test]
45    fn test_1175() {
46    }
47}
48


Back
© 2025 bowen.ge All Rights Reserved.