I get 21 for Row 1 too... and Row 2 and Row 9. You cast on 31 stitches, but you're using 10 of them for the garter edges, so that leaves 21, or 2 repeats of the pattern. What you wrote out...
Am I interpreting the pattern right, per the above? it's only 20?
P1, k1, p3, k1, p3, k1, p1: k1, p3, k1, p3, k1, p1; P1, k1, p3, k1, p3, k1, p1
.... is 3 pattern repeats - an you've got 32 sts there.
I think you're thinking you're supposed to do 3 pattern repeats because you CO 31, but the garter edge uses the extra 10 stitches.