Function returning a vec with prime factors of number See code below and my comment with questions:
pub fn factors(n: u64) -&gt; Vec&lt;u64&gt; {
    let mut m = n; // is it possible to convert n to a mutable type without using another variable?
    let mut a:Vec&lt;u64&gt; = Vec::new();
    while m % 2 == 0 {
        m /= 2;
        a.push(2);
    }
    // in C we can just write for (int i = 3; i &lt;= sqrt(m); i+= 2) ... just saying... and C is not even as fast as python to code... am I really doing it right??
    for i in (3..((m as f64).sqrt() as usize + 1usize)).step_by(2) { 
        while m % i as u64 == 0 { // is there a way to avoid all the casts to u64
            a.push(i as u64);
            m /= i as u64;
        }
    }
    if m &gt; 2 {
        a.push(m);
    }
    return a;
}


Is it possible to convert n to a mutable type without using another variable?
The C equivalent of the main loop use twice less ink. Is Rust so verbose by design?
Is there a way to avoid all the casts to u64
any other insight welcome
pub fn factors(n: u64) -&gt; Vec&lt;u64&gt; {
    let mut m = n; // is it possible to convert n to a mutable type without using another variable?

use pub fn factors(mut n: u64) to allow the parameter to be mutable
    let mut a:Vec&lt;u64&gt; = Vec::new();

You don't need : Vec&lt;u64&gt;, rust will infer it.
    while m % 2 == 0 {
        m /= 2;
        a.push(2);
    }


    // in C we can just write for (int i = 3; i &lt;= sqrt(m); i+= 2) ... just saying... and C is not even as fast as python to code... am I really doing it right??
    for i in (3..((m as f64).sqrt() as usize + 1usize)).step_by(2) { 

Generally speaking, Rust is less verbose than C, but you've hit one of the major exceptions. Rust is pickier about types, it won't let you mix and match different numeric types. But we can make some improvements here.

You don't need 1usize just use 1.
You can also use 3 ..= (m as f64).sqrt() as usize (..= includes the end)

Alternatively, you could reverse the check:
for index in (3..).step_by(2).take_while(|i| i * i &lt;= m)

I'm not sure if that's better or not.
        while m % i as u64 == 0 { // is there a way to avoid all the casts to u64
            a.push(i as u64);
            m /= i as u64;
        }

You need casts because you are being inconsistent about your types. If you change the usize in the for loop to u64 there will be no need for casts.
    }
    if m &gt; 2 {
        a.push(m);
    }
    return a;
}