OK this is a little complex
say
Time for the master = x
Time for apprentice = y
so y=15+x (you probably got that far)
The rate the apprentice can build machines at is Ra = 1/y
The rate the master can build machines at is Rm = 1/x
The rate they can both build them at = Ra+Rm= 1/y + 1/x
so the time taken to build 1 is 1/ (1/y+ 1/x) which = x-5
so 1/(x-5) = 1/y+1/x
as y=15+x (above)
1/(x-5) =1/(x+15) +1/x = x+(x+15) / x(x+15)
so x(x+15) = (x-5)(2x+15)
if you multiply that out you'll get a quadratic equation that you can simply solve for x
x�-10x-75=0
which I make a bit under 16 hours
You'll want to get the proper answer and check I haven't done anything daft (It has been known)