import SimpleOutput;

/**
 * Give a sequence of 100 Collatz numbers starting with whatever
 * value is given on the command line.  Does not do any
 * error checking of input.
 *
 * @author Samuel A. Rebelsky
 * @version 1.0 of October 1999
 */
public class Collatz {
  public static void main(String[] args) {
    // Get a starting value.
    long val = Integer.parseInt(args[0]);
    // Prepare for output.
    SimpleOutput out = new SimpleOutput();
    // Output 100 values
    for (int i = 0; i < 100; ++i) {
      // Print the current value
      out.print(val + " ");
      // Move on to the next value
      if (val % 2 == 0) 
        val = val / 2;
      else
        val = 3*val + 1;
    } // for
    out.println();
  } // main(String[])

} // class Collatz

