Primes with digits in nondecreasing order: Difference between revisions
Content added Content deleted
No edit summary |
m (→{{header|Wren}}: Minor tidy) |
||
Line 1,632: | Line 1,632: | ||
=={{header|Wren}}== |
=={{header|Wren}}== |
||
{{libheader|Wren-math}} |
{{libheader|Wren-math}} |
||
{{libheader|Wren-seq}} |
|||
{{libheader|Wren-fmt}} |
{{libheader|Wren-fmt}} |
||
<syntaxhighlight lang="ecmascript">import "/math" for Int |
<syntaxhighlight lang="ecmascript">import "./math" for Int |
||
import "/ |
import "./fmt" for Fmt |
||
import "/fmt" for Fmt |
|||
var nonDescending = Fn.new { |p| |
var nonDescending = Fn.new { |p| |
||
Line 1,654: | Line 1,652: | ||
for (p in primes) if (nonDescending.call(p)) nonDesc.add(p) |
for (p in primes) if (nonDescending.call(p)) nonDesc.add(p) |
||
System.print("Primes below 1,000 with digits in non-decreasing order:") |
System.print("Primes below 1,000 with digits in non-decreasing order:") |
||
Fmt.tprint("$3d", nonDesc, 10) |
|||
for (chunk in Lst.chunks(nonDesc, 10)) Fmt.print("$3d", chunk) |
|||
System.print("\n%(nonDesc.count) such primes found.")</syntaxhighlight> |
System.print("\n%(nonDesc.count) such primes found.")</syntaxhighlight> |
||