/* gnubc program: cloitre */ " The Benoit Cloitre CONJECTURE: if cloitre(y) is typed in, the iterates y, t(y), t(t(y)),... of the Benoit Cloitre function t(x) are printed and the number of steps taken to reach one of 0, -1, -4, -19 is recorded. Benoit Cloitre conjectured in an email to Jeff Lagarias dated July 19, 2011, that every trajectory starting from a positive integer will eventually reach 0. Experimentally it is certain that any trajectory starting from a negative integer will evevntually reach one of -1, -4 or -19. " /* the Benoit Cloitre function */ /* the least non-negative remainder when an integer a is divided by a positive integer b */ /* a%b=m(a,b) if a>=0 or a<0 and b divides a */ /* a%b=m(a,b)-b if a<0, b>0, a not divisible by b */ define mod(a,b){ auto c c=a%b if(a>=0) return(c) if(c==0) return(0) return(c+b) } define t(x){ auto r r=mod(x,3) if(r==0) return(2*x/3) if(r==1) return((x-1)/3) return(5*x+3) } define cloitre(y){ auto i,x x=y for(i=0;i>=0;i++){ print "i=",i,":",x,"\n" if(x==0 || x == -1 || x == -4 || x == -19){ print "starting number = ",y,"," print "the number of iterations taken to reach ",x, " is " return(i) } x=t(x) } }