I assume you want the sons to have equal amounts of money, then the solution is easier than you might think.

Let x = the value of the father's will, then

The first son receives dollars.

The second son receives dollars.

As these are equal, equate and solve for x:

Now it's easy to find the number of sons. Since now we know the first son receives 6 dollars, and all the sons receive the same amount, the man has sons.

I can't believe how long I spend looking at functions of functions and trying to turn everything into massive overcomplicated expressions, all the while overlooking this easy solution.