Anaprimes: Difference between revisions

→‎{{header|Wren}}: Now uses an insertion sort rather than the built-in quicksort. About 9% quicker than before.
(Added Wren)
(→‎{{header|Wren}}: Now uses an insertion sort rather than the built-in quicksort. About 9% quicker than before.)
Line 191:
=={{header|Wren}}==
{{libheader|Wren-math}}
{{libheader|Wren-sort}}
{{libheader|Wren-fmt}}
Unsurprisingly, getting up to 1 billion is a struggle for the Wren interpreter - 98 minutes 4350 seconds on my Core i7 machine.
I gave up after that.
<syntaxhighlight lang="ecmascript">import "./math" for Int
import "./sort" for Sort
import "./fmt" for Fmt
 
Line 202 ⟶ 204:
var anaprimes = {}
for (p in primes) {
var d = Sort.insertion(Int.digits(p).sort().join()
if (anaprimes.containsKey(d)) {
anaprimes[d].add(p)
9,488

edits