1
0

Make computation parallel

This commit is contained in:
2025-08-05 09:18:33 -04:00
parent f511d1c0ea
commit 49d4f20b18
2 changed files with 13 additions and 4 deletions

View File

@@ -51,6 +51,7 @@
# maths
primes
arithmoi
parallel
# graphing libraries!
# Chart

View File

@@ -3,13 +3,21 @@ The Simplest Math Problem No One Can Solve - Collatz Conjecture
https://youtu.be/094y1Z2wpJg
-}
import Data.Set (fromList)
import Debug.Trace (trace)
import Control.Parallel.Strategies
import Data.Containers.ListUtils
import Debug.Trace (trace)
main :: IO ()
main = do
let results = map f [10^1_000..10^1_000+100] :: [Integer]
print (fromList results)
let start = 2^1_000_000
let end = 100
-- let message = "Starting at " <> show start <> ", and computing " <> show end <> " values."
let message = "Starting at 2^1_000_000, and computing " <> show end <> " values."
let results = parMap rpar f [start..start+end] :: [Integer]
putStrLn "======================================"
putStrLn message
print $ nubOrd results
putStrLn "======================================"
lst :: [Integer]
lst = take 300 [2^100_000..]