All pastes #966075 Raw Edit

Stuff

public text v1 · immutable
·published 2008-04-01 13:46 UTC
rendered paste body
#include <stdio.h>
#include <stdlib.h>

int tnpl(int i, int j){
	int max=0, c, t;
	unsigned long r;

	for(t=i;t<=j;t++){
		r= t;
		c=1;
		while(r!=1){
			if(!(r%2)) r/=2;
			else r=3*r+1;
			c++;
		}
		if(c>max) max=c;
	}
	return max;
}

int main(int argc, char* argv[])
{
  int i, j;

  if (argc != 3) {
    printf("Usage: tnp1 i j\n"); return 1;
  }
  i = atoi(argv[1]);
  j = atoi(argv[2]);
  printf("%d\n", tnpl(i, j));	/* replace MY_FUNCTION */
  return 0;
}