Primes whose sum of digits is 25: Difference between revisions
Content added Content deleted
m (→J: simplify) |
m (→{{header|Wren}}: Minor tidy) |
||
Line 2,217: | Line 2,217: | ||
{{libheader|Wren-math}} |
{{libheader|Wren-math}} |
||
{{libheader|Wren-fmt}} |
{{libheader|Wren-fmt}} |
||
<syntaxhighlight lang="wren">import "./math" for Int |
|||
{{libheader|Wren-seq}} |
|||
import "./fmt" for Fmt |
|||
import "/fmt" for Fmt |
|||
import "/seq" for Lst |
|||
var sumDigits = Fn.new { |n| |
var sumDigits = Fn.new { |n| |
||
Line 2,237: | Line 2,235: | ||
} |
} |
||
System.print("The %(primes25.count) primes under 5,000 whose digits sum to 25 are:") |
System.print("The %(primes25.count) primes under 5,000 whose digits sum to 25 are:") |
||
Fmt.tprint("$,6d", primes25, 6)</syntaxhighlight> |
|||
{{out}} |
{{out}} |
||
Line 2,250: | Line 2,248: | ||
{{libheader|Wren-gmp}} |
{{libheader|Wren-gmp}} |
||
Run time is about 25.5 seconds. |
Run time is about 25.5 seconds. |
||
<syntaxhighlight lang=" |
<syntaxhighlight lang="wren">import "./gmp" for Mpz |
||
import "./fmt" for Fmt |
import "./fmt" for Fmt |
||