Skip to main content
2 of 2
Fixed termination condition
Sylvain
  • 236
  • 1
  • 5

An often-cited example of a very basic program, for which termination is open, is one that generates the Collatz sequence. In pseudo-code:

collatz(int n)
  while (n > 1)
    if (n mod 2 == 0)
      n = n / 2;
    else
      n = 3n + 1;
Sylvain
  • 236
  • 1
  • 5