Prime numbers which contain 123: Difference between revisions

m
(Added Quackery.)
m (→‎{{header|Wren}}: Minor tidy)
 
Line 1,244:
{{libheader|Wren-math}}
{{libheader|Wren-fmt}}
{{libheader|Wren-seq}}
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="ecmascriptwren">import "./math" for Int
import "./fmt" for Fmt
import "/seq" for Lst
 
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)
for (chunk in Lst.chunks(results, 10)) Fmt.print("$,7d", chunk)
Fmt.print("\nFound $,d such primes under $,d.", results.count, limit)
 
9,476

edits