It's easy to see that the theoretical number of parents double every generation
"The formula for the number of ancestors in a given generation is:
where n is the number of generations back
and x equals the number of individuals in that generation.
But it can be argued that it doesn't quite work that way.
Once upon a time, when many marriages were either out of convenience or to build/protect family wealth, marriages between close family members were not uncommon and in-breeding occured. There is also the possibility of in-breeding from a variety of other activities.
The result is that as the number of generations increases, so does the possibility that some event reduced the the number of distinct ancestors.
Arguments have also been made that by the time you go back 10 generations the DNA has been so diluted, that DNA wise there is almost no relationship (say 1-2 percent) between you and your ancestors.
Others have argued, that given the constant growth from a very small population to a large one, we are somehow all related to each other biologically.
Still others argue that given the rapid growth of technology, you are more culturally related to your neighbor, than your GGG Grandparents. (Certainly, given enough time, neighbors matter more to our lives than ancestry)
So yes, there is a mathematical formula that will produce a number, it is a theoretical number, arrived at with a lot of assumptions.