The Collatz sequence is a sequence of positive integers. The term after value=n is:
Example: 5 -> 16 -> 8 -> 4 -> 2 -> 1.
Source: Project Euler Problem 14.
Find the number n < 1,000,000 that gives the longest chain (before hitting one).
Test your code: print out the entire sequence of numbers beginning with n=161439. Make sure you get about 230 numbers, ending in a 1.
Suggestion: Insert code to check for an impossible condition, say n<1 in your sequence generating function.