More fixes to counting, % testing added...

The counting argument seems to be correct, but the algorithm is still failing. I am abandoning this effort in favor of the recursive remainder calculations.