Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
6
Task/Self-numbers/F-Sharp/self-numbers.fs
Normal file
6
Task/Self-numbers/F-Sharp/self-numbers.fs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
// Self numbers. Nigel Galloway: October 6th., 2020
|
||||
let fN g=let rec fG n g=match n/10 with 0->n+g |i->fG i (g+(n%10)) in fG g g
|
||||
let Self=let rec Self n i g=seq{let g=g@([n..i]|>List.map fN) in yield! List.except g [n..i]; yield! Self (n+100) (i+100) (List.filter(fun n->n>i) g)} in Self 0 99 []
|
||||
|
||||
Self |> Seq.take 50 |> Seq.iter(printf "%d "); printfn ""
|
||||
printfn "\n%d" (Seq.item 99999999 Self)
|
||||
Loading…
Add table
Add a link
Reference in a new issue