Major improvements to sieve

Before took unacceptably long time to compute for input in the 10⁶ order of magnitude. Now works fine for number of the size of up to 10⁸, gets problems at 10⁹.