initial commit
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
module _12
|
||||
open System
|
||||
|
||||
let fiveDivisorTriangle =
|
||||
let root (n : int) = int( Math.Sqrt(float(n)) )
|
||||
// observation: if number has a factor < sqrt(num), then it has a corresponding
|
||||
// factor > sqrt(num)
|
||||
let factorCount x = Seq.sum (seq { for i = 1 to root x do if x % i = 0 then yield 2 })
|
||||
|
||||
let result =
|
||||
(1, 0) |> Seq.unfold (fun (num,acc) ->
|
||||
Some(num + acc, (num + 1, num + acc)))
|
||||
|> Seq.filter (fun x ->
|
||||
let factCount = factorCount x
|
||||
factCount >= 500 )
|
||||
|> Seq.head
|
||||
result
|
||||
Reference in New Issue
Block a user