We calculate the third coefficient of the lattice β function in pure Yang-Mills theory. We make use of a computer code for solving perturbation theory analytically on the lattice. We compute the divergent integrals by using a method based on a Taylor expansion of the integrand in powers of the external momenta in 4-ɛ dimensions. Our results are in agreement with a previous calculation by M. Lüscher and P. Weisz where the authors used a different technique. We also show how this new coefficient modifies the scaling function on the lattice in both the standard and energy schemes. In particular we show that asymptotic scaling is extremely well achieved in the energy scheme.