Now with Dan's easy graphical solution there is only one number left that will be needed to to machine the gear. That will be a constant for any given diametrical pitch (DP) and is Pi/(4*DP). In your case using 48 DP cutters it is Pi/(4*48) = Pi/192 = 0.0164
This is the vertical distance that you have to move the cutter off of the center line of the blank to make the cutter pass through the same point on the pitch circle when the gear blank is rotated 1/4 tooth.
To machine the gear, put the blank on an arbor and the cutter on the center line of the arbor. Cut all the teeth indexing a full tooth. In the case of a 40 tooth gear this will be 360/40 = 9 degrees.
Next index the gear 1/4 of a tooth. In the 40 tooth gear this will be 9/4 =2.25 degrees. Now move the cutter vertically the amount calculated above so that it will pass through the same gash at the small end of the bevel. You will have to raise or lower the cutter depending on which way you indexed the 2.25 degrees. Go all the way around the gear again in full tooth increments. Now take out the 2.25 degrees to get back to center line and go an additional 2.25 degrees. Now move the cutter so it again passes through the same spot on the pitch cirlcle. If you raised it before, lower it twice the above calculated value and you should be there. Onc more around in full tooth increments and you are done.
A few notes.
Use the same cutter number that you would use if cutting a spur gear with the same number of teeth.
Try to arrange the work so the cutter is pushing the blank onto your mandrel. Dedending on your index head it is sometimes easier to put the cutter on reversed and run the mill in reverse in order to get the index head crank in a easier position to operate. You will be turning it a lot.
If your are just playing, I suggest that you cut a 1:1 set of 18 tooth gears to get the feel for it. This makes all the indexing angles even numbers and a multiple of 5 degrees. You can even do this with a spindex. The 1:1 ratio makes the blank angles 45 degrees which is easy to set up on the lathe.
Gail in NM
Edit: Before someone calls me on it, the formula I give for the the vertical offset is theoretically incorrect. However, the error is MUCH smaller than the resolution of any of the machine tools I have ever seen or used. On a 48 DP gear it less than 1/100,000 inch so there is no need to work with the correct but far more complicated formula.