On a problem of A. Rényi