Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Learn more about F# at http://fsharp.org
- open System
- open System.Diagnostics
- open System.Threading
- let isPrimeNumber x =
- let mutable i = 2
- let mutable isFactorFound= false
- while not isFactorFound&& i < x do
- if x % i = 0 then
- isFactorFound<-true
- i <- i + 1
- not isFactorFound
- let sw = new System.Diagnostics.Stopwatch()
- let ResetStopWatch ()=
- sw.Reset ()
- sw.Start ()
- let ShowTime ()=
- printfn "took me %d ms" sw.ElapsedMilliseconds
- let executeTest1 () =
- let intArray = [| for i in 10000000..10004000 -> i |]
- ResetStopWatch ()
- let primeDetails1 = intArray |> Array.map (fun x -> (x, isPrimeNumber x))
- ShowTime()
- [<EntryPoint>]
- let main argv =
- 0 // return an integer exit code
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement