solved problem 46 using Quinny's PrimeSieve class