Ormiston triples: Difference between revisions

m
→‎{{header|Wren}}: Minor changes to first version including using the correct 'cacheSize' parameter for my machine though performance unaffected.
(→‎{{header|Wren}}: Like Phix, added a faster version using 'primesieve'.)
m (→‎{{header|Wren}}: Minor changes to first version including using the correct 'cacheSize' parameter for my machine though performance unaffected.)
Line 1,822:
 
var limit = 1e10
var primes = Int.segmentedSieve(limit, 8128 * 1024)
var orm25 = []
var j = 1e9limit/10
var count = 0
var counts = []
Line 1,852:
Fmt.tprint("$,10d ", orm25, 5)
System.print()
j = 1e9limit/10
for (i in 0...counts.count) {
Fmt.print("$,d Ormiston triples before $,d", counts[i], j)
Line 1,875:
===Faster version===
{{libheader|wren-psieve}}
This uses our bindings to the C++ library, ''primesieve'' and, as we're now iterating through the primes rather than sieving for them, uses very little memory compared to the first version.
 
It's also far quicker - 4.4 seconds to search up to 1 billion and 43.4 seconds to search up to 10 billion.
9,486

edits