Skip to content

Instantly share code, notes, and snippets.

@Andrea
Created October 14, 2015 19:47
Show Gist options
  • Save Andrea/644599c0739f97eca842 to your computer and use it in GitHub Desktop.
Save Andrea/644599c0739f97eca842 to your computer and use it in GitHub Desktop.
Kats conf
let isPrime x =
match x with
| 2 | 3 -> true
| x when x % 2 = 0 -> false
| _ ->
let rec superPrimeCheck i =
match i with
| i when x % i = 0 -> false
| i when x < i*i -> true
| _ -> superPrimeCheck (i + 2)
superPrimeCheck 3
isPrime 1
let oneM = 1000000
let checkStuff maxNumber =
[2..10000]
|> Seq.ofList
|> Seq.filter(fun x-> isPrime x)
|> Seq.fold(fun acc x ->
if (isPrime acc && acc <= maxNumber)then
printfn "found %A" acc
acc + x
) 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment