An imperative solution seems appropriate.
let problem40a = let sb = System.Text.StringBuilder() let mutable n = 1 while sb.Length <= 1000000 do sb.Append(n) |> ignore n <- n+1 let mutable prod = 1 for i in 0..6 do prod <- prod * ((sb.[(pown 10 i)-1] |> int) - 48) prod
No comments:
Post a Comment