Jump to content

Primes with digits in nondecreasing order: Difference between revisions

Realize in F#
(add FreeBASIC)
(Realize in F#)
Line 216:
Base 62: found 150 non-decreasing primes under G8</pre>
 
=={{header|F_Sharp|F#}}==
This task uses [http://www.rosettacode.org/wiki/Extensible_prime_generator#The_functions Extensible Prime Generator (F#)]
<lang fsharp>
// Primes with digits in nondecreasing order: Nigel Galloway. May 16th., 2021
let rec fN g=function n when n<10->(n<=g) |n when (n%10)<=g->fN(n%10)(n/10) |_->false
let fN=fN 9 in primes32()|>Seq.takeWhile((>)1000)|>Seq.filter fN|>Seq.iter(printf "%d "); printfn ""
</lang>
{{out}}
<pre>
2 3 5 7 11 13 17 19 23 29 37 47 59 67 79 89 113 127 137 139 149 157 167 179 199 223 227 229 233 239 257 269 277 337 347 349 359 367 379 389 449 457 467 479 499 557 569 577 599 677
</pre>
=={{header|Factor}}==
{{works with|Factor|0.99 2021-02-05}}
2,172

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.