Files
project-euler/55.fs
T
2025-08-03 20:16:55 -07:00

23 lines
561 B
FSharp

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