module _55 open System.Numerics let lynchrels = let isLynchrel n = let revInt (n:bigint) = n |> (string) |> common.revString |> (fun s -> BigInteger.TryParse(s) |> snd) let rec isLynchrelRec (n:bigint,d) = match (n + (revInt n)), d with | _,0 -> true | n,_ when ((string) >> common.isPalindrome) n -> false | n,d -> isLynchrelRec (n, d-1) isLynchrelRec (n,50) [|1I..10000I|] |> Array.filter isLynchrel |> Array.length