Untouchable numbers: Difference between revisions
m
→{{header|Wren}}: Minor tidy
m (→{{header|C}}: Runs quicker if compiled without any optimizations (used -O3 before).) |
m (→{{header|Wren}}: Minor tidy) |
||
Line 1,893:
=={{header|Wren}}==
{{libheader|Wren-math}}
{{libheader|Wren-fmt}}
Line 1,899 ⟶ 1,898:
===Version 1===
Run time about 70 seconds on my Core i7 machine.
<syntaxhighlight lang="
import "./
var sieve = Fn.new { |n|
Line 1,924 ⟶ 1,922:
System.print("List of untouchable numbers <= 2,000:")
System.print()
Fmt.print("$,6d untouchable numbers were found <= 2,000", untouchable.count { |n| n <= 2000 })
Line 1,978 ⟶ 1,974:
Run time for untouchable numbers up to 100,000 (m = 14) is now only 1.4 seconds and 1,000,000 (m = 63) is reached in 132 seconds.
<syntaxhighlight lang="
import "./
var limit = 1e6
Line 2,006 ⟶ 2,001:
}
System.print("List of untouchable numbers <= 2,000:")
System.print()
Fmt.print("$,7d untouchable numbers were found <= 2,000", untouchable.count { |n| n <= 2000 })
|