Hey Jeff, great initiative.
Not to say anything about your method (apart from the fact that you gave a bad example: 71 is a prime number), what works, works, but…
I’d take the opposite approach (but it depends on the situation you are in)…
Say I have a ‘pillar’ of 1 grid unit and 7 grid units of space before the next pillar (we only need one direction at the time, as you pointed out).
Then if I want 9 pillars, I make the grid 9 x (1 + 7) – 7 units wide.
In an image (with 6 pillars):
