I see in many solutions posted here, the strategy is to patch the next missing number itself:

For example, with [1, 2, 3] and N=20, I get 1-6 covered, and I patch 7.

Yes, 7 would push the frontier the furthest (to 13), but if I choose to patch 4 instead, maybe a 4 may come in handy when I need to make other numbers down the road?

Why is this choice 7 optimal? Can any provide a solid proof?