Frobenius numbers: Difference between revisions

Added Easylang
(add RPL)
(Added Easylang)
 
(2 intermediate revisions by one other user not shown)
Line 763:
</pre>
 
 
=={{header|EasyLang}}==
<syntaxhighlight>
fastfunc isprim num .
i = 2
while i <= sqrt num
if num mod i = 0
return 0
.
i += 1
.
return 1
.
fastfunc nextprim prim .
repeat
prim += 1
until isprim prim = 1
.
return prim
.
prim = 2
repeat
prim0 = prim
prim = nextprim prim
x = prim0 * prim - prim0 - prim
until x >= 10000
write x & " "
.
</syntaxhighlight>
{{out}}
<pre>
1 7 23 59 119 191 287 395 615 839 1079 1439 1679 1931 2391 3015 3479 3959 4619 5039 5615 6395 7215 8447 9599
</pre>
 
=={{header|Factor}}==
Line 1,717 ⟶ 1,750:
=={{header|Wren}}==
{{libheader|Wren-math}}
{{libheader|Wren-seq}}
{{libheader|Wren-fmt}}
<syntaxhighlight lang="ecmascriptwren">import "./math" for Int
import "./seqfmt" for LstFmt
import "/fmt" for Fmt
 
var primes = Int.primeSieve(101)
Line 1,731 ⟶ 1,762:
}
System.print("Frobenius numbers under 10,000:")
Fmt.tprint("$,5d", frobenius, 9)
for (chunk in Lst.chunks(frobenius, 9)) Fmt.print("$,5d", chunk)
System.print("\n%(frobenius.count) such numbers found.")</syntaxhighlight>
 
1,983

edits