New version of threadprimes that uses malloc() instead of shared memory