What I want is to continue back to the next i (outer loop), rather than the next p (inner loop). This code doesn't do that:
It's not elegant, but what I did was add a flag labeled C. We check the value of C before starting the inner loop.
That does what I want: