But math isn’t about trial and error, it’s about formulas and exactitude.
I'm not sure I agree with that, there are times when brute force is the only solution. Solving cryptographic hashes (think bitcoins) is such an example.
However, sometimes there are situations where an approximation can lead you to close to the correct answer.
Let me start by re-stating your problem to be sure that I understand it. If you have 36 titles, you would like to split them up into 6 groups such that each group has 6 titles, such that the number of titles is close to then number of groups. As opposed to having 3 groups with 12 titles where now one has few groups but many titles.
The exact solution is to find the median factor(s) of the number of titles. Eg: For 100 titles, 100 has factors, 1,2,5,10,20,50,100, where the median is 10. For 99 => 1,3,9,11,33,99 median = 9,11. But if you are unlucky and land on a prime number say 113, the median factor are 1, 113 in which case even that solution does not work.
But the astute observer will notice that 10 is sqrt of 100. So taking the square root of the number of titles, may not produce the exact answer but it will lead you very close to an optimal solution. For 113 the sqrt is 10.63... 10 x 11 = 110, so 3 categories will have one extra title. For 356 sqrt = 18.86... 18 x 19 = 342 so 14 extra titles.