Packing spheres in volume of shape

Thanks for the good feedback.
I understand the math better now (thanks Ethan!)
I still want to make a 3D GH sphere pack calculator.
and doesnt have to be super exact, just a good approximation.
i found few topics but not a solution way yet:

Sphere Packing - #4 by sheridanspheremeshtest.gh (17.3 KB)