# Project Euler Problem 63

Project Euler Problem 63 solution is trivial. The only preliminary consideration would be that numbers greater, than 9 cannot yield any n-th powers having n digits:

open System let nthPowersAmount ``base`` = let nDigits n = n.ToString().Length let power n (``base``: bigint) = [1..n] |> List.fold (fun product _ -> ``base`` * product) 1I Seq.unfold (fun n -> if (power n ``base``) |> nDigits <> n then None else Some(1, n + 1)) 1 |> Seq.length let problem063 () = {1I..9I} |> Seq.map nthPowersAmount |> Seq.sum

Advertisements

Leave a Comment