|MadSci Network: Genetics|
Mathematically, I think you are right - in fact, I know you are. We each have two parents, Dolly and a bunch of mice being the exception. However, where you are wrong is the notion that all those people were different. In fact, there must be considerable overlap in the ancestor set of all people. In earlier times, travel was more difficult. Logically, this suggests that the marriage partners for a given person were probably found within 5-10 miles of them at the time of mating; 16-30. If true, this suggests that after a period of time all the people living in a given area were a product fo all the forebears of those same people. In islands this is certainly true. Following this logic, the current flexibility in marriage partners is certainly unprecedented. So, I don't really have an answer, just the basic feeling that 2^40/2 is the number of matings, but not the number of ancestors.
Try the links in the MadSci Library for more information on Genetics.