Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
8
Task/Amicable-pairs/F-Sharp/amicable-pairs.fs
Normal file
8
Task/Amicable-pairs/F-Sharp/amicable-pairs.fs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
[2..20000 - 1]
|
||||
|> List.map (fun n-> n, ([1..n/2] |> List.filter (fun x->n % x = 0) |> List.sum))
|
||||
|> List.map (fun (a,b) ->if a<b then (a,b) else (b,a))
|
||||
|> List.groupBy id
|
||||
|> List.map snd
|
||||
|> List.filter (List.length >> ((=) 2))
|
||||
|> List.map List.head
|
||||
|> List.iter (printfn "%A")
|
||||
Loading…
Add table
Add a link
Reference in a new issue