Ha, math is fun.
As for your simulation, it is a very accurate way go about this. I think I made a program like that on my Arduino a while back, though I never thought of using it to test the average runs for Warframe drops.
In any case, the math would tell us that the average should trend to 5.5 runs (for three parts of equal chance like Nekros) which your program seems to support.
And yes, the equation used for the previous calculations was 1 - ((1 - P)^i), P being the drop chance and i being the iterations. From there I just solved for i where the equation was 99.99%. However, I rushed it and didn't properly calculate the drop chance in the first place, which is my bad. So the false 19+/-6 was the result.
But all the applicable pages have been updated and corrected with both the average number of runs, and number of runs to 99.99% guarantee a complete farm.