Collatz Conjecture

The Collatz conjecture, named after Lothar Collatz of Germany, proposed the conjecture in 1937. The conjecture states you must begin with any positive integer n: If it is an even number then halve it, or if it is an odd number then triple it and add 1. Do this recursively, and your result should always reach 1.

Please note: A maximum input length of 500 digits is enforced. Everything except positive numbers will be stripped out (including plus and minus signs) and must equal 1 or above. By entering ridiculously large numbers, the resulting page may be a few megabytes big.

Starting Integer: (required)

It has long been undecided if the first step should or should not include the starting integer. Many documents state this uncertainty on the Internet. I'm following the OEIS examples A006577 and A008884. On my page, I shall use step 0 to show the starting integer.

Other names for the Collatz conjecture include the 3n+1 conjecture, the Ulam conjecture, Kakutani's problem, the Thwaites conjecture, Hasse's algorithm, and the Syracuse problem.

This tool was inspired by xkcd's comic #710 "Collatz Conjecture" from 05/03/2010.

Application Program Interface

I've made a basic API for this tool in a very easy-to-use format; however, I can't see any reason you couldn't implement the Collatz calculations yourself unless working with large integers is impossible for you. The API will let you access the generated steps from beginning to end.

To access the API, you simply need to make GET request to the following URL:

Simply replace 1234567890 with the starting integer you want, and replace .csv with .xml, .txt, or .json.

Please be aware that when passing a bad input, the request may redirect you to a sanitised URL before providing you with results. If the input you supply has no readable digits, it will redirect back to this HTML page. If the input you supply is over 500 digits (not characters) then you will be redirected to a URL where the input has been truncated to 500 digits.


I thought it might be interesting to some to include statistics about the data generated by use of this tool.

I've seen 1,420,860 unique starting integers. I have a total submission count of 1,491,794. The greatest number of steps I've seen from a submitted starting integer is 62,118 so far (abiding by the 500 digit length limitation) and was found on 18/01/2015. The most popular submitted starting integer has been submitted 20,396 times. The grand total number of steps produced by this tool is 312,074,294. This means a staggering grand total number of 5,051,925,945 digits were generated (including step #0 and the final result of 1), that equates to 4.7 GiBs of data.

These statistics began recording back in July, 2012.

© Copyright 2008-2015: Nitrxgen, all rights reserved.
XHTML 1.0 valid and CSS3 valid.
Source last modified 23 days ago.