This is not a math test - there is no formula that will work with every gun - as well indicated above by several posters here, testing is what is necessary. Take the time and do it right - leave the slide rule or calculator at home. You will need an adjustable measure, or many different non-adjustable measures - start at calibre for charge weight, shoot 50 yards or futher. What shoots at 25 yards may not shoot accurately at any futher range.
My .32 gets the load combination(ball/patch/powder), that gives the rifle's best accuracy at 50 yards, then the sights are adjusted to hit centre at that range. Thus, at 25 yards, it is also shooting centre. Nothing is left to chance in that. It's most accurate load is 35gr. 3F GOEX. With 20gr. 3F, it will put 5 shots at 25 yards into a .40" hole, but - at 50 yards, that load shoots over 2". Using 35gr., it shoots an honest 1" for 5 shots and that's what it averages at that range. My other guns follow pretty much the same rule of shooting what is best at 50 yards - works further out and closer in as well - except the .58 Double Rifle and the .69 single.
These two larger bores also get their best accuracy loads - the .58 due to having 2 barrels and one sight, must use the load that regulates, meaning the barrels either converge at a descent range (modern regulation), or shoot parallel, which is mid 1800 perfect regulation. That regulation load hopefully gives good accuracy from each barrel as well - that's a tall order indeed, if one thinks about it. Luckily, this 'regulation' load is powerful enough for hunting big game and easy shooting for using it on trail walks as well as being very accurate. I was lucky. Most people with these guns are not. This rifle is also sighted for 50 yards, but holding the diameter of the front bead above the rear notch, gives a 100 yard zero - quite easy to use. A mere 100gr. to 110gr. works in this rifle for all ranges. 100gr. shoots same poi at 50 yards, making the individual barrel diverge exactly 1" at 100yards- which is just fine. With 110gr., it shoots parallel - perfect regulation for a double barreled rifle.
Due to it's greater recoil, the larger, 14 bore rifle is a case unto itself. I use 3drams for plinking, ie; range walks, etc, which is a load that is capable of shooting into 2" to 2 1/2"at 100 yards. I would not trust such a light load in this rifle further out than that, and certainly not for hunting large game. Would it kill, yes - but it has too great a trajectory to be useful for hunting - too hard to hit with. For hunting big game, and for long range target shooting, the light load is doubled. 165gr. gives amazing accuracy to 300yards and more power than needed for whatever I ever might want to shoot with it - ever.