should have been generating a and b for each prime