How to calculate Gas sensor PPM from analog readings?
You misunderstood the referenced article. The two code snippets are not supposed to work together in a loop.

First code is control. It reads sensor 100 times, calculates average and prints it out. This should be done in normal air conditions, i.e. with detectable gas concentrations at their safe levels. You take the printed value and place it into second code.

The second code is what actually supposed to run continuously in a loop. It reads sensor and compares it to previously obtained control value. This gives you current gas concentration relative to normal conditions.

Note, that better way to do this is to replace analogRead in the second code with inner loop, similar to the first, to get an average of 10-50 consecutive readings instead of a single read.

UPDATE

In order to calculate current PPM you need to find sensor resistance RS first. Normally it is done by simple formula for voltage divider: RS/RL = (V-Vs)/Vs, where RL is load resistor. When measured in clean air the calculated RS becomes R0. The first code uses this equation, however I have no idea why they divide this by some constant. IMHO the formula for ratio should be simple RS/R0 = RS_gas/RS_air. I suspect it is supposed to represent the gain of OP Amp used in their circuit somehow, but it would be pointless since the constant should be present in second code too, where they would cancel each other.

Regarding PPM calculation, first thing you should notice is that the relationship between RS/R0 and PPM is given on log-log scale. The second thing is that the graph in this scale is approximately linear. There are several methods to deal with this.

You can take the graph from datasheet and plot it on linear scale. The result would be exponential curve and you can use various tools to find exponential fit for it. This article has examples of exponential approximation and a code for some sensors.

You can also treat the graph as straight line y = ax + b but substitute x and y for their logarithms: log(y) = a * log(x)  + b. Then you can use points on the graph in datasheet to find out slope (a) and offset (b). This seems to be exactly what the author of the referenced article is doing (although I am not sure the resulting formula is correct).

Finally, it seems the article is missing very important part of the functionality - the variable voltage supply. The circuit is supposed to switch between 1.5V and 5V for sensor to operate properly, according to datasheet. The measurements are done at low voltage, then it is heated up to clean adsorbed gases.