multithreading - Powershell Multithreaded math -
i'm working on self-inspired project learn powershell, , have been writing script generate prime numbers. stands, script works without issue, next goal increase it's processing speed. cls $primes = @() $primes += 3 $targetnum = 5 $primesindex = 0 $numofprime = 3 while(1) { if(($targetnum / 3) -lt 3) { $primes += $targetnum $targetnum += 2 $numofprime += 1 } else { if($primes[$primesindex] -le ($targetnum / ($primes[$primesindex]))) { if($targetnum % $primes[$primesindex] -eq 0) { $primesindex = 0 $targetnum += 2 } else { $primesindex++ } } else { $primesindex = 0 $numofprime += 1 $primes += $targetnum $targetnum += 2 if($targetnum -gt 100000){write-host $targetnum ", " $numofprime;break} ...