Primes whose first and last number is 3: Difference between revisions
Content added Content deleted
(→More general: Fixed minor bug.) |
(→More general: Added stretch goal.) |
||
Line 253: | Line 253: | ||
for (chunk in Lst.chunks(primes, 10)) Fmt.print("$,%(len)d", chunk) |
for (chunk in Lst.chunks(primes, 10)) Fmt.print("$,%(len)d", chunk) |
||
System.print("\nFound %(primes.count) such primes.\n") |
System.print("\nFound %(primes.count) such primes.\n") |
||
} |
|||
d = 6 |
|||
for (x in [1, 3, 7, 9]) { |
|||
var primes = getQualifyingPrimes.call(x, d) |
|||
Fmt.print("Found $,d primes under $,d which begin and end with $d.\n", primes.count, 10.pow(d), x) |
|||
}</lang> |
}</lang> |
||
Line 297: | Line 303: | ||
Found 29 such primes. |
Found 29 such primes. |
||
Found 2,387 primes under 1,000,000 which begin and end with 1. |
|||
Found 2,251 primes under 1,000,000 which begin and end with 3. |
|||
Found 2,104 primes under 1,000,000 which begin and end with 7. |
|||
Found 2,053 primes under 1,000,000 which begin and end with 9. |
|||
</pre> |
</pre> |
||