3233. Find the Count of Numbers Which Are Not Special Medium

@problem@discussion
#Array#Math#Number Theory



1/**
2 * [3233] Find the Count of Numbers Which Are Not Special
3 *
4 * You are given 2 positive integers l and r. For any number x, all positive divisors of x except x are called the proper divisors of x.
5 * A number is called special if it has exactly 2 proper divisors. For example:
6 * 
7 * 	The number 4 is special because it has proper divisors 1 and 2.
8 * 	The number 6 is not special because it has proper divisors 1, 2, and 3.
9 * 
10 * Return the count of numbers in the range [l, r] that are not special.
11 *  
12 * <strong class="example">Example 1:
13 * <div class="example-block">
14 * Input: <span class="example-io">l = 5, r = 7</span>
15 * Output: <span class="example-io">3</span>
16 * Explanation:
17 * There are no special numbers in the range [5, 7].
18 * </div>
19 * <strong class="example">Example 2:
20 * <div class="example-block">
21 * Input: <span class="example-io">l = 4, r = 16</span>
22 * Output: <span class="example-io">11</span>
23 * Explanation:
24 * The special numbers in the range [4, 16] are 4 and 9.
25 * </div>
26 *  
27 * Constraints:
28 * 
29 * 	1 <= l <= r <= 10^9
30 * 
31 */
32pub struct Solution {}
33
34// problem: https://leetcode.com/problems/find-the-count-of-numbers-which-are-not-special/
35// discuss: https://leetcode.com/problems/find-the-count-of-numbers-which-are-not-special/discuss/?currentPage=1&orderBy=most_votes&query=
36
37// submission codes start here
38
39impl Solution {
40    pub fn non_special_count(l: i32, r: i32) -> i32 {
41        0
42    }
43}
44
45// submission codes end
46
47#[cfg(test)]
48mod tests {
49    use super::*;
50
51    #[test]
52    fn test_3233() {
53    }
54}
55


Back
© 2025 bowen.ge All Rights Reserved.