MCPcopy Create free account
hub / github.com/StudyRust/leetcode_rust / is_three

Function is_three

1952-three-divisors.rs:1–15  ·  view source on GitHub ↗
(n: i32)

Source from the content-addressed store, hash-verified

1pub fn is_three(n: i32) -> bool {
2 if n < 3 {
3 return false;
4 }
5 let mut count = 0;
6 for i in 2..n {
7 if n % i == 0 {
8 count += 1;
9 }
10 if count > 1 {
11 return false;
12 }
13 }
14 count == 1
15}
16
17fn main() {
18 println!("{:?}", is_three(4));

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected