#include
using namespace std;
#define MAX_N 128
/*
* Via OEIS.org: "The 3x+1 or Collatz problem is
* as follows: start with any number n. If n is
* even, divide it by 2, otherwise multiply it
* by 3 and add 1. Do we always reach 1? This
* is a famous unsolved problem. It is conjectured
* that the answer is yes." #HailstoneNumbers
*
* @creator gdt
* @created 02017.03.27
* @oeis http://oeis.org/A006577
* "Number of halving and tripling steps
* to reach 1 in '3x + 1' problem."
* @note Numberphile posted "Collatz Conjecture in Color"
* the day after this program was written.
* https://youtu.be/LqKpkdRRLZw
*/
void doit(int i) {
int n = i;
int count = 0;
while (n != 1) {
if (n % 2)
n = n * 3 + 1;
else
n /= 2;
count++;
}
cout << i << "..." << count << endl;
}
int main(int,char**) {
for (int n = 1; n <= MAX_N; n++)
doit(n);
}