Prime numbers which contain 123: Difference between revisions
m
→{{header|Wren}}: Minor tidy
(Added Quackery.) |
m (→{{header|Wren}}: Minor tidy) |
||
Line 1,244:
{{libheader|Wren-math}}
{{libheader|Wren-fmt}}
The only number under 1,000 which can possibly satisfy the task description is 123 and that's clearly divisible by 3 and hence composite.
<syntaxhighlight lang="
import "./fmt" for Fmt
var limit = 1e5
Line 1,254 ⟶ 1,252:
var results = primes.where { |p| p < limit && p.toString.contains("123") }.toList
Fmt.print("Primes under $,d which contain '123' when expressed in decimal:", limit)
Fmt.tprint("$,7d", results, 10)
Fmt.print("\nFound $,d such primes under $,d.", results.count, limit)
|