CIT 591 Notes on Collatz Assignment
Fall 2005, David Matuszek

Neat output

The current assignment says: "Insert an extra space before each single-digit number (a number less than 10). This will make your output neater." When I wrote this, I was thinking only about starting numbers. The sequences will include three-and-four digit numbers.

You can do the assignment as specified, or you can optionally make your results neater by putting one space before 4-digit numbers, two spaces before 3-digit numbers, three spaces before 2-digit numbers, and four spaces before single-digit numbers. This way every number is printed in a five-character space.

Whether this makes your output neater or not depends on whether your output uses a monospaced or a proportional font:

iiiiiiiiii
wwwwwwwwww  
In a monospaced font, all characters (including space) are the same width.
iiiiiiiiii
wwwwwwwwww
In a proportional font, different characters take differing amounts of horizontal space.

My computers default to monospaced fonts. The ones in the lab, for some reason, appear to default to proportional fonts. Proportional fonts are more readable, but it's basically impossible to put them in neat columns.

Results

The first few lines of your output (after your names, of course) should have these numbers:

    1
2 1
3 10 5 16 8 4 2 1
4 2 1
5 16 8 4 2 1
6 3 10 5 16 8 4 2 1
7 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1
8 4 2 1
The longest sequence is the one starting with 97. It contains 119 numbers.