The other day I was looking at my family tree. There are my parents Antonio and Lucy Vegaseat, then my grandparents Alfonso and Ludmilla Vegaseat on my father's side and Roland and Helga Gruenspan on my mother's side. Then come my great grandparents, by now there are eight of those. It was time for a small Python program to figure out how many great great great ... grandparents I had.

# The family tree conundrum ...
# you have two parents, your parents each have two parents, that makes it
# four grandparents for you, then there must be eight great grandparents
# and so on.  A light hearted look at a serious problem.
# tested with Python24    vegaseat      24jul2005

generations = 3
number_of_parents = 2 ** generations
print "after 3 generation we have %d great grandparents" % number_of_parents


# going back 40 generations
for generations in range(4, 41):
    number_of_parents = 2 ** generations
    print "In %d generation we have %d (g)parents" % (generations, number_of_parents)

print """Going back in your family tree for 40 generations, or around a thousand years,
there should be over one trillion great-great-great-...-grandparents you could 
lay claim to being related with.

Hmmm, that alone is more people then ever lived!  We demand an explanation from 
our government!"""
11 Years
Discussion Span
Last Post by vegaseat

I do not know Python much, but I was taught that you start with Adam and Eve, not one trillion old people!

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.