Fixed bug with modulo inversion
Working sieve