On the problem of Gauss