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 : u32) -> bool {
if n < 2 {
return false;
Line 2,999:
}
 
fn is_left_truncatable(p : u32) -> bool {
let mut n = 10;
let mut q = p;
Line 3,011:
true
}
 
fn is_right_truncatable(p : u32) -> bool {
let mut q = p / 10;
while q > 0 {
if !is_prime(q) {
1,777

edits