Anaprimes: Difference between revisions
Content deleted Content added
→{{header|Wren}}: Tweak. |
|||
Line 442: | Line 442: | ||
var maxIndex = 8 |
var maxIndex = 8 |
||
var primes = Int.primeSieve(limit) |
var primes = Int.primeSieve(limit) |
||
var digPrimes = primes.take(10).toList |
|||
var anaprimes = {} |
var anaprimes = {} |
||
for (p in primes) { |
for (p in primes) { |
||
var digs = Int.digits(p) |
var digs = Int.digits(p) |
||
var key = 1 |
var key = 1 |
||
for (dig in digs) key = key * |
for (dig in digs) key = key * primes[dig] |
||
if (anaprimes.containsKey(key)) { |
if (anaprimes.containsKey(key)) { |
||
anaprimes[key].add(p) |
anaprimes[key].add(p) |