initial commit
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
module _23
|
||||
|
||||
let abundantUpperLimit = 28123
|
||||
|
||||
let abundantNumbers =
|
||||
let dSums =
|
||||
common.divisors abundantUpperLimit
|
||||
|> Array.mapi (fun i divisors -> (i, List.fold (+) 0 divisors))
|
||||
dSums |> Array.choose ( fun (i, dSum) ->
|
||||
match dSum with
|
||||
| abundant when dSum > i -> Some(i)
|
||||
| _ -> None
|
||||
)
|
||||
|
||||
let sumNotAbundant =
|
||||
let a = abundantNumbers
|
||||
// add all abubundant numbers together
|
||||
|
||||
let sums = common.crossMap (+) a a |> Seq.distinct |> Seq.toArray
|
||||
|
||||
let sna =
|
||||
sums
|
||||
|> Set.ofSeq
|
||||
|> (-) (Set.ofList [1..abundantUpperLimit])
|
||||
|> Set.toSeq
|
||||
//|> Array.rev
|
||||
|
||||
sna |> Seq.fold (+) 0
|
||||
Reference in New Issue
Block a user