## Clean vetted C program for Collatz total stopping time records

I’m copying below a clean copy of my latest C program to find some (but not all) record breaking values of the modified total stopping time to reach ‘1’, based on a small variant of the Lagarias total stopping time function sigma_{oo} (n), for integers n at least two, introduced by Jeffrey Lagarias in his 1985 American Mathematical Monthly “cyclopedic” article.

The program now uses two long long int integers to store intermediate (non-printed) computations, due to “blow-up” in the iterates of the T(.) function, following Lagarias1985.

The two long long int values are stored in a one-dimensional array of size 2. This functions in the code below as “arithmetic modulo 10^15 ” , and is defined in the first line of code with the token ‘MOD’.

Only integers n such that n == 27 (mod 100) are tested. This is a purely empirical criterion, that still appears to catch a healthy proportion of all “record-breaking” n.

David Bernier

Quebec City,

August 16, 2014

12:30 AM

#define MAX 100000000000

#define MOD 1000000000000000

#include <stdio.h>

int main(void)

{

long long n;

long long y[2];

long long steps;

long long maxsteps;

long long modulo2;

long long tmp;

long long ret;

maxsteps = 0;

for(n=27; n< MAX; n=n+100)

{

y[0] = n;

y[1] = 0;

steps = 0;

while(y[0]>1 || y[1]>0)

{

modulo2 = y[0]%2;

if(modulo2 == 0)

{

tmp = y[1]/2;

if(0 == (y[1]%2))

{

y[1] = tmp;

y[0] = y[0]/2;

}

else

{

y[1] = tmp;

y[0] = y[0] + MOD;

y[0] = y[0]/2;

}

}

else

{

y[1] = y[1]+y[1]+y[1];

y[0] = y[0]+y[0]+y[0];

y[0] = y[0]+1;

tmp = y[0]%MOD;

ret = (y[0]-tmp)/MOD;

y[1] = y[1] + ret;

y[0] = tmp;

}

steps++;

}

if(steps > maxsteps)

{

if(maxsteps< 1050)

{

maxsteps = steps;

}

printf(“%lld %lld total steps\n”, n, steps);

}

}

return 0;

}