aboutsummaryrefslogtreecommitdiff
path: root/store/works/life/algorithm-experiment/1.1b.cpp
blob: c64c73e52a0b1d48d3a46725433f7aa5e634debf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>

int main() {
  for (int i = 2; i <= 1000; i++) {
    std::cout << i << ',';

    int n = i;

    int k = 0;

    while (n != 1) {
      n = n % 2 ? n * 3 + 1 : n / 2;
      k++;
    }

    std::cout << k << '\n';
  }

  return 0;
}