Math Geeks?

Surely a math geek or two is lurking on my journal.

My roommate and I were discussing zero population growth and I pointed out that the median age would rise. This would likely increase medical costs and lower productivity. He argued that it would fall again later but that didn't seem to make sense to me. Then I realized that lifespan would also affect this. Constant or longer lifespans would also increase the median age while people dying younger would, of course, lower it.

I've been out of math too long. How the heck would I calculate that? I'm wanting to play with the numbers. Even pointers to a Web site would help.
Zero Population Growth doesn't mean that the median age rises necessarily. ZPG means that, in general, one person dies for every person that is born. So if a bunch of 95 year olds die at the same time a bunch of babies are born, that median age shifts downward.

Each second, the median age increases by one second. Each death of someone over the median lowers it, but the death of someone under the median doesn't impact it at all - since they'd be replaced by someone else underneath the median to keep the population constant.

I don't know that there's a calculator that would demonstrate this.
Well my thought is.....
Bit rusty myself, but here is my thought

If you assume 0 growth AND decay, the number of elements in the
sequence is constant.
If we name this sequence of ages as a[i](t), 1<=i<=n and we order them in ascending order at a given time t0, the median will be either a[k] if n is odd (where k is the middle) or (a[n/2]+a[n/2+1])/2 otherwise. Since we assume no growth or decay n is constant with t, therefore the median at time t+deltat will be greater then at t since a[i](t+deltat)>a[i](t).
If either growth or decay are nonzero then nothing can be said a priory without knowing what the distribution of these are. Even if you do know these distributions the calculations are probably not straightforward, but you can find a student to whom give the assignment!
From the quants
Given 1 year:
(dt = 1year)

Compare total age now (time - t) to Total Age in future (time - t+dt).
time t: we have Total Age = sum(age) .
time t + dt : Total Age1 = sum(age)+ n * dt (n = sample)
But take into account whoever has died or born.
k = fraction of people died and born
Born = k*dt, dead = k*dt*atd(t)
where atd = age at the time of death, which is supposed to grow with time.

Average at t+dt == avg(t)+dt + (k(dt)/n) - ((k(dt)*atd(t))/n)

atd(t) can be moddeled by a linear law or more complex if you want to introduce variables on quality of life etc.

For Example: atd(t) = a0 + alpha*t if you think that age at time of death grows linearly