economics – How do you calculate the maximum number of Bitcoins?

I am unsure on the exact formula for bitcoin supply(have an idea below):

∑〖210000 x (50 x 10^8/2^i 〗) / 10^8 with limits 32 and i=0

And from this equation is it possible to calculate the number of coins available at any given time (e.g When will 98% of Bitcoin be mined)?

Thank you for the help in advance 🙂