Largest prime factor: Difference between revisions

Added Easylang
(add RPL)
(Added Easylang)
 
(One intermediate revision by one other user not shown)
Line 478:
</pre>
 
 
=={{header|EasyLang}}==
<syntaxhighlight>
n = 600851475143
i = 2
while n > i
if n mod i = 0
n = n div i
.
i += 1
.
print n
</syntaxhighlight>
{{out}}
<pre>
6857
</pre>
 
=={{header|Elixir}}==
Line 505 ⟶ 522:
The largest prime factor of 600,851,475,143 is 6857
</pre>
 
=={{header|Erlang}}==
Uses a factorization wheel, but without builtin lazy lists, it's rather awkward for a functional language.
Line 994 ⟶ 1,012:
=={{header|Wren}}==
Without using any library functions at all (it's a one-liner otherwise):
<syntaxhighlight lang="ecmascriptwren">var largestPrimeFactor = Fn.new { |n|
if (!n.isInteger || n < 2) return 1
var inc = [4, 2, 4, 2, 4, 6, 2, 6]
2,060

edits