The formula on a basic level, as in your op, is
0.95^n
I.e. 0.95 to the power of n, where n is the number of generations. This takes account of the 5% of a decreasing number thing. Multiple this by current population to find population at any generation:
7.9 billion x 0.95^n
You can choose n to be whatever you want, type it in, and that gives you population in n generations. I.e. let's say in 100 generations, then the population will be 46,772,181
Or pick a number that you consider 'effectively extinct' (because mathematically it will never get to zero, but in numbers of humans half is a good as zero!). I'll say 1000 humans, but you could choose 1 or 2 or whatever.
So
7.9 bill x 0.95^n =1000
Now some a level maths...
n log 0.95 = log(1000/(7.9 bill))
n = log(1000/(7.9 bill) ) / log0.95
n = 310
That's 310 generations , so 30 x 310 years