Welcome to davidpratten.com

You can change this text in the options panel in the admin

Member Login

Lost your password?

Collatz Conjecture and Ambi

April 29, 2009
By david

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).

Leave a Reply




Rss Feed Tweeter button Facebook button Technorati button Reddit button Myspace button Linkedin button Webonews button Delicious button Digg button Stumbleupon button Newsvine button