PlasbianX
October 8th, 2009, 05:14 PM
Okay so im making a program for my TI83 (all done within the calculator) that allows me to run the syracuse problem. Basically I have to check all whole numbers 1 through 100 to see how many integrals they have. When its finished, it has to display the number that had the highest amount, and what that amount was. How syracuse works is this: We take any whole number n greater than 0. If n is even, we halve it (n/2), else we do "triple plus one" and get 3n+1. The conjecture is that for all numbers this process converges to 1
My code is rather messy, but if anyone could help me out then it would be extremely appreciated. My problem is that it keeps looping continuously and won't ever find the answer. HALP!! :saddowns:
// X is the counter for which number the program is on
// R is the remainder of the fpart
// C is the counting number to see how many times the equation has been run
// H is the highest number of C
// Y is the highest number of X
0->X
0->R
0->C
0->H
0->Y
lbl A
(X+1)->X
X->Z
lbl B
Z->W
fpart(Z/2)->R
if R = 0
then
(W/2)->Z
(C+1)->C
else
((3W)+1)->Z
(C+1)->C
end
if Z > 1
then
goto B
else
if C > H
then
C->H
X->Y
0->C
goto A
else
goto A
end
end
if x = 100
then
disp H
display Y
else
goto A
end
My code is rather messy, but if anyone could help me out then it would be extremely appreciated. My problem is that it keeps looping continuously and won't ever find the answer. HALP!! :saddowns:
// X is the counter for which number the program is on
// R is the remainder of the fpart
// C is the counting number to see how many times the equation has been run
// H is the highest number of C
// Y is the highest number of X
0->X
0->R
0->C
0->H
0->Y
lbl A
(X+1)->X
X->Z
lbl B
Z->W
fpart(Z/2)->R
if R = 0
then
(W/2)->Z
(C+1)->C
else
((3W)+1)->Z
(C+1)->C
end
if Z > 1
then
goto B
else
if C > H
then
C->H
X->Y
0->C
goto A
else
goto A
end
end
if x = 100
then
disp H
display Y
else
goto A
end