All pastes #795666 Raw Edit

Untitled

public cpp v1 · immutable
#795666 ·published 2007-11-24 09:27 UTC
rendered paste body
<?php$thenum = $argv[1];echo 'Number is '.$thenum."\xD\xA";$line=0;while($thenum != 1) {	if(($thenum%2)==1) {		$thenum=($thenum*3)+1;		} else {			$thenum=$thenum/2;		}		echo $thenum."\xD\xA";	}		?>==================================================#include <iostream>#include "math.h"#include <conio.h>#define clrscr() printf("\e[1;1H\e[2J")using namespace std;int line = 0;bool isOdd( int number ) {if ((number % 2) == 1) return true;return false;}void ulam(int process) {	 cout << "Number is: " << process << "...\n";	 while(process != 1) {	 			   	 			   if (isOdd(process) == true) {				   	  				  process = 3*process+1;									  		  } else {											  		 process = process/2;													 }					cout << process << " ";					line=line+1;					if (line==4) {					   			cout << "\n";								   line=0;								   }								   }								   line=0;								   cout << "\n\n..Done.";								   } main () {	 	 int num = 1;	 cout << "==Ulam Sequence Calculator==\n";	 	 	 while(1) {	 	 		   Ask:	 		   cout << "\n\nStart with: ";	 		   cin>>num;			  // clrscr();	 	 		   if(num==0 || num==1) {	 		   			cout << "Cant be 0 or 1\n";	 		  			goto Ask;						}		ulam(num);		}		return 0;		}