Accelerating the two-point and three-point galaxy correlation functions using Fourier transforms