SPOJ 4073: 3n+1 problem