The children of the sultan

An old challenge from an old Portuguese book I have:

Abdul Al-Kwaritz-Amuhmahd was a Arabic sultan who became very famous by the size of his harem and the number of children he had fathered. More so because many of his children were twins, triplets or quadruplets.
One of the legends about this, tells that all the children of the sultan were twins, except 39 of them.
On a remote oasis, in the middle of the desert, another saying states that all of them were triplets, except 39.
The sultan descendants defend, however, that all were quadruplets except 39. Ajihad Ahmed-Humahli Hijá, an investigator, says that all the three states about the children of the sultan are true. If he is right, hom many children did the sultan have fathered?

For the purists: the sultan had, at least one "normal" child (not a twin, nor a triplet, nor a quadruplet) and, at least, one pair of twins.

12 quadruplets, 12 twins, and 12 triplets would be sufficient to have an equal number of children in quadruplets, triplets, and twins. Since this is 12 per group, the other two groups will be within the 39. So, 39-(12*2) = 39-24 = 15 children remaining.

Thus, Abdul Al-Kwaritz-Amuhmahd's children were (cheekily):

6 pairs of twins,
4 groups of triplets,
2 groups of sextuplets, and
3 only children

for a total of

51 children

• That was fast :) You nailed it. Just waiting to accept your answer :) Although you don't have to include sextuplets on your answer, eh eh!
– Pspl
Nov 11 '20 at 17:19

Let's assume that the sultan has $$2x$$ twins, $$3y$$ triplets and $$4z$$ quadruplets (since the numbers must be divisible by 2, 3 and 4 respectively). He has also $$t$$ "normal" children. Now, we have the Diophantine equation system: $$t+2x+3y=39$$, $$t+2x+4z=39$$, $$t+3y+4z=39$$ ($$t\geqslant1$$, $$x\geqslant1$$, $$y\geqslant0$$, $$z\geqslant0$$).
Now we have $$2x+3y=2x+4z=3y+4z=39-t$$, so $$2x=3y=4z=\frac{39-t}2$$. That means that $$\frac{39-t}2$$ is divisible by 12, but it must be between $$0$$ and $$19=\frac{39-1}2$$ (since $$t\geqslant1$$). So, $$2x=3y=4z=12$$ ($$x=6$$, $$y=4$$, $$z=3$$) and $$t=39-24=15$$. Total number of children is $$12+12+12+15=51$$ (6 pair of twins, 4 triplets, 3 quadruplets and 15 "single" children).

• +1 - This is a formalization of the intuitive process I went through to get to my answer.
– Avi
Nov 11 '20 at 17:25