The closed form for $n = 3$ where $3! <= p < q < (r > 2p$ and $r > 2q)$ is $g(p,q,r)= (p -2)(q -2)(r -2) -2[(p -1)(q -1) -1 +(p -1)(r -1) -1 +(q -1)(r -1) -1] +3[p +q +r +1] -1.$ It took me about 45 minutes to find it.
For example, the McDonald's nugget problem is $p= 6, q= 9, r= 20, g(6,9,20)= 4*7*18 -2[(5*8 -1 +(5*19 -1) +(8*19 -1)] +3[6 +9 +20 +1] -1 = 504 -2(284) +3(36) -1 = 43.$
Try it for this made up problem... for 6, 8, 27; you should get 37, and it's right! Nobody has seen it since about the year 1880. Nice,... huh?? I made a YouTube video that reiterates it. William Bouris
Somebody is actually down-voting it. LOL
well, no. For the triple $(6,7,10001),$ your formula gives something large, while the correct value comes from the two smaller coins, $42-6-7 = 29.$
You are using the letters $p < q < r.$ Note that the examples you give that do work have $\gcd(p,q) \neq 1.$ that is, the answer is not the same as the answer for the two smaller coins, because using just those two coins always gives multiples of $g = \gcd(p,q).$
There is nothing to prevent you having a correct formula for $\gcd(p,q) \neq 1$ and specific bounds on $r.$
How to investigate more, from wikipedia on Numerical Semigroups: