Largest prime factor: Difference between revisions
no edit summary
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
No edit summary |
||
Line 706:
6857
done...
</pre>
=={{header|Rust}}==
<syntaxhighlight lang="rust">
fn main( ) {
let mut current : i64 = 600851475143 ;
let mut latest_divisor : i64 = 2 ;
while current != 1 {
latest_divisor = 2 ;
while current % latest_divisor != 0 {
latest_divisor += 1 ;
}
current /= latest_divisor ;
}
println!("{}" , latest_divisor ) ;
}</syntaxhighlight>
{{out}}
<pre>
6857
</pre>
|