This is my first post here... My algorithm is about the 3x+1 problem. I want to test if some types of numbers have a stoping time. Until now i managed to do it by just testing one type of number each time... So i would like to automate the proccess...
Here is an example:
> k := 16 n + 3
> while modp(k, 2) = 0 or modp(k, 2) = 1 do
if modp(k, 2) = 1 then k:= (3n+1)/2
elif modp(k,2)=0 then k:=k/2
Well this example will produce k= 9n+2, which is smaller than the original 16n+3 so I know that numbers of the form 16n+3 have a finite stoping time...So it passes my test. If for example i start with k:=16n+7 i will get k=27n+3 which is bigger than 16n+7 so i do not know if this number has a stoping time... so it ''fails'' my test. I hope this is clear to you.
I want to automate this. For example I want to start with something like
and test all the numbers k:=16n+a(i) for i=1,2,3,4
and i would like to get for result something like b:=[7,11,15] (These numbers fail ie do not drop to a value less than the original k)
I tried to do loops but i cannot make it work.
Thanks for any help in advance.