Program to print 3N+1 sequence