this version runs 1000000 in 6.175s. going to modify one of ryan's functions and make sure there is no slowdown