initial commit

This commit is contained in:
2025-08-03 20:16:55 -07:00
commit 87a130499d
89 changed files with 10241 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
module _37
let truncations i =
let s = string i
let len = s.Length
seq {
for n in 0..(len - 1) do
yield s.Substring(0, len - n)
if (n > 0) then
yield s.Substring(len - n)
} |> Seq.distinct |> Seq.toList |> List.map (int)
let truncatablePrimes =
let oddOr2 i = i % 2 = 1 || i = 2
let pa =
common.primeArray 1000000
|> Array.filter (common.numDigits >> (Array.forall oddOr2))
let isPrime n = Array.exists (fun p -> p = n) pa
pa
|> Array.filter ((<) 10)
|> Array.map truncations
|> Array.filter (List.forall isPrime)
|> Array.map (Seq.nth 0)
|> Array.sum