On a generalization of the 3x+1 problem