Primes whose sum of digits is 25: Difference between revisions
Content added Content deleted
(→{{header|AppleScript}}: Added an idiomatic solution.) |
(Realize in F#) |
||
Line 566: | Line 566: | ||
4957 4993</pre> |
4957 4993</pre> |
||
=={{header|F_Sharp|F#}}== |
|||
<lang fsharp> |
|||
// Primes to 5000 who's sum of digits is 25. Nigel Galloway: April 1st., 2021 |
|||
let rec fN g=function n when n<10->n+g=25 |n->fN(g+n%10)(n/10) |
|||
primes32()|>Seq.takeWhile((>)5000)|>Seq.filter fN|>Seq.iter(printf "%d "); printfn "" |
|||
</lang> |
|||
{{out}} |
|||
<pre> |
|||
997 1699 1789 1879 1987 2689 2797 2887 3499 3697 3769 3877 3967 4597 4759 4957 4993 |
|||
</pre> |
|||
=={{header|Factor}}== |
=={{header|Factor}}== |
||
{{works with|Factor|0.99 2021-02-05}} |
{{works with|Factor|0.99 2021-02-05}} |