Truncatable primes: Difference between revisions
m
Rust - reformatted with rustfmt
m (C++ - renamed class) |
m (Rust - reformatted with rustfmt) |
||
Line 2,975:
=={{header|Rust}}==
<lang rust>fn is_prime(n
if n < 2 {
return false;
Line 2,999:
}
fn is_left_truncatable(p
let mut n = 10;
let mut q = p;
Line 3,011:
true
}
fn is_right_truncatable(p
let mut q = p / 10;
while q > 0 {
if !is_prime(q) {
|