RKKY interaction in one- and two-dimensional electron gases