Ulam numbers: Difference between revisions

→‎Version 2: Added a note about 100,000th Ulam number.
(→‎{{header|Go}}: Added second astonishingly fast version based on Phix algorithm.)
(→‎Version 2: Added a note about 100,000th Ulam number.)
Line 111:
{{trans|Phix}}
The above version is reasonably efficient and runs in about 2.9 seconds on my machine (Intel Core i7-8565U). The following version, which builds up a sieve as it goes along, is (astonishingly) about 40 times faster!
 
Although not shown here, the 100,000th Ulam number (1,351,223) is computed in about 13.5 seconds.
<lang go>package main
 
9,485

edits