Ulam numbers: Difference between revisions
m
→{{header|Wren}}: Minor tidy
No edit summary |
m (→{{header|Wren}}: Minor tidy) |
||
Line 1,688:
===Version 1===
{{libheader|Wren-set}}
<syntaxhighlight lang="
var ulam = Fn.new() { |n|
Line 1,732:
{{libheader|Wren-fmt}}
The above version is reasonably efficient and runs in about 21.6 seconds on my machine (Intel Core i7-8565U). The following version, which builds up a sieve as it goes along, is more than 3 times faster.
<syntaxhighlight lang="
import "./fmt" for Fmt
var ulam = Fn.new { |n|
Line 1,775:
The only downside with this version is that you need to know how much memory to allocate in advance.
<syntaxhighlight lang="
var ulam = Fn.new { |n|
|