# You're lucky you’re here.

Here’s a little program that kind of surprised me. It shows the approximate number of people involved in your birth. This only goes back 60 generations because of math overflow somewhere above 60, but it still shows a large number of people. Just think if something happened to just one of those people, you wouldn’t be reading this. You can enter the year you were born and the approx number of years per generation. The first column shows the generation. The second column the year for that generation. The third column shows the number of people involved for that generation and the fourth column the total number of people involved to get to you. The default birth year is 1990 with 30 years per generation.

PS: Something doesn’t seem right with this assumption because there weren’t that many people living back then. I’ll have to rethink what this is showing.

``````supportedOrientations(LANDSCAPE_ANY)

function setup()
textMode(CORNER)
font("Courier-Bold")
tab={}
dy=0
parameter.text("Year born",1990)
parameter.text("Years per gen",30)
parameter.action("Calc",calc)
calc()
print("Run in landscape orientation")
end

function draw()
background(0)
fill(255)
text("Gen  Year            Nbr people          Total people",40,HEIGHT-20+dy)
for a,b in pairs(tab) do
text(b,40,HEIGHT-a*20+dy-30)
end
end

function calc()
tab={}
tot=0
yb=tonumber(Year_born)
yg=tonumber(Years_per_gen)
for z=0,60 do
tot=tot+2^z
if z==0 then
str=string.format("%3d %04d                 You %d  %20d",z,yb-z*yg,2^z,tot-1)
elseif z==1 then
str=string.format("%3d %04d        Your parents %d  %20d",z,yb-z*yg,2^z,tot-1)
elseif z==2 then
str=string.format("%3d %04d   Your Grandparents %d  %20d",z,yb-z*yg,2^z,tot-1)
else
str=string.format("%3d %04d  %20d  %20d",z,yb-z*yg,2^z,tot-1)
end
table.insert(tab,str)
end
end

function touched(t)
if t.state==MOVING then
dy=dy+t.deltaY
if dy<0 then
dy=0
end
end
end
``````

@dave1707 - hmmmm, interesting, sure it’s flawed somewhere. Possible overlap where you have siblings. The pyramid should invert at some point then decline back to Adam and Eve!!!

After more thinking, due to the death of spouses and remarriage, there doesn’t have to be a constant doubling from one generaton to the next, but an increase of 1. A husband who had 2 wives, or a wife who had 2 husbands. So instead of 2 separate people creating 1, 3 separate people could create 2, so there wouldn’t be the doubling. So I don’t know if this would really work, but each generation could increase by just 1 person, just like Pascal’s triangle, so going back 60 generations there would be 61 people not the gazillions by doubling each generation. I’m sure it’s not that simple, but it’s somewhere in between those 2.

@dave1707 - figures can be frightening, when you consider families could have up to 10 offspring (even royalty - look at Queen Victoria) you can imagine the figures involved.

Got to factor in infant death rates, war, plague and even positive effect of nhs - nature has some heavy levellers.

Pre tv and the pill looks like peoples favourite pastime.

The doubling is correct: each person needs two biological parents regardless of marriage and remarriage. So each person has two parents, four grandparents, eight great-grandparents, etc.

However, not all of the people counted will have been actually different people. For example, in the uk it is legal for cousins to marry. As cousins share two grandparents, this means that there are actually only six people involved from that generation rather than eight.

@LoopSpace @Bri_G It’s true that each person in the chain needs 2 people to create 1, but by going back just 60 generations the number of people doubling just to create one now was such a large number. That was going back only 1800 years, 60x30. Just think of the number of people if the doubling went back 10’s or 100’s of thousand of years. So yes, there has to be overlapping and the majority of it was probably long long ago when the population wasn’t that large. It’s just that when I wrote this I wasn’t expecting to be confused by the results I got. The thing I was trying to point out by the title was that if 1 person in the chain didn’t survive, just think how many other people wouldn’t be here either.

@dave1707 - looking at that the claim that we all have a bit of Ghengis Khan in us could well be true!!!