| 23 | // itk::Math::{IsPrimt, GreatestPrimeFactor} |
| 24 | template<typename T> |
| 25 | inline bool isPrime(T n) { |
| 26 | if (n <= 1) return false; |
| 27 | |
| 28 | const T last{(T)std::sqrt((double)n)}; |
| 29 | for (T x{2}; x <= last; ++x) { |
| 30 | if (n % x == 0) return false; |
| 31 | } |
| 32 | |
| 33 | return true; |
| 34 | } |
| 35 | |
| 36 | template<typename T> |
| 37 | inline T greatestPrimeFactor(T n) { |
no test coverage detected