In one day a and b together complete 1/15 of the work, and a, b and c together complete 1/8 of the work. In one day, a can complete 1/a of the work, b can complete 1/b of the work and c 1/c of the work, when each works alone. We can write (a, b and c represent the number of days each would take to complete the work on their own):
1/a+1/b=1/15; 1/a+1/b+1/c=1/8. Therefore, 1/c=1/8-1/15=(15-8)/120 and c=120/7. So c takes 120/7 days to complete the work solo. If a and c take x days to complete the work together then 1/a+1/c=1/x; and 1/b+1/c=1/(x-2). 1/c=7/120 so 1/a=1/x-7/120 and 1/b=1/(x-2)-7/120. Multiply both of these equations through by 120x:
120x/a=120-7x; 120x/b=120x/(x-2)-7x. Add these two together: 120x(1/a+1/b)=120-14x+120x/(x-2). But 1/a+1/b=1/15, so 8x=120-14x+120x/(x-2); 22x=120+120x/(x-2). Now we have an equation in x only, so we should be able to solve it for x. Multiply through by x-2: 22x(x-2)=120(x-2)+120x; 22x^2-44x=120x-240+120x; 22x^2-284x+240=0; 11x^2-142x+120=0=(x-12)(11x-10), making x=12 or 10/11. However, 10/11-2 is negative and this value would be a negative time for b and c to complete the work, so x=12 is the only valid solution.
Using 1/a=1/x-7/120 and substituting for x we have 1/a=1/12-7/120=(10-7)/120=3/120, making a=40.
CHECKS
Let's see how many days b would take: 1/b=1/10-7/120=1/24 so b=24 days. 1/a+1/b+1/c=1/8; 1/a=1/8-1/24-7/120=1/40, making a=40. 1/40+1/24=1/15. So there is consistency.