Numbers with prime digits whose sum is 13: Difference between revisions

Realize in F#
m (→‎{{header|Phix}}: minor simplification (instead of mult[*10], just build numbers as strings, still needs padding on append though))
(Realize in F#)
Line 70:
</pre>
 
=={{header|F_Sharp|F#}}==
<lang fsharp>
// prime digits whose sum is 13. Nigel Galloway: October 21st., 2020
let rec fN g=let g=[for n in [2;3;5;7] do for g in g->n::g]|>List.groupBy(fun n->match List.sum n with 13->'n' |n when n<12->'g' |_->'x')|>Map.ofSeq
[yield! (if g.ContainsKey 'n' then g.['n'] else []); yield! (if g.ContainsKey 'g' then fN g.['g'] else [])]
fN [[]] |> Seq.iter(fun n->n|>List.iter(printf "%d");printf " ");printfn ""
</lang>
{{out}}
<pre>
337 355 373 535 553 733 2227 2272 2335 2353 2533 2722 3235 3253 3325 3352 3523 3532 5233 5323 5332 7222 22225 22252 22333 22522 23233 23323 23332 25222 32233 32323 32332 33223 33232 33322 52222 222223 222232 222322 223222 232222 322222
</pre>
=={{header|Factor}}==
<lang factor>USING: formatting io kernel math math.combinatorics
2,172

edits