Collatz Conjecture and Ambi

Here is the Ambi code to calculate the Collatz sequence including a demonstration for the largish number
99,999,999
.  To run this code simply copy and paste it into the wholly browser based Ambi implementation.


// Collatz Sequence Function;
function; collatz ;
 if;
  import dup $n = 1 neq;
  ifelse;
   $n 2 / floor $n 2 / dup $half = eq;
   $half . collatz export;
   $n 3 * 1 + . collatz export;
   ;
  ;
// Show sequence for a big number ;
99999999 collatz

After TABing or Clicking into the Result box, you should see the 169 term Collatz Sequence for this number (which I won’t bore you with here).