Iterative simulation of RC low pass filter, strange correction required
You're basically numerically integrating the differential equation

\$\frac{dV_c}{dt} = \frac{V_e-V_c}{RC}\$

using a first order approximation to the derivative i.e. setting dt to time_step, this has limited accuracy. It becomes exact, as you noted, by reducing the time step to zero. Alternatively, you could use a higher order approximation, if you research some of those you'll find where that scaling factor might come from.