Question: How do I solve this sequence in Maple?

I have a problem with this sequence, as defined : f(x)=1-1/x+2*trunc(1/x)

The sequence starts with the number x=50100 and with 100000 steps the aim of the sequence is to see how many numbers are between 0 and 1( and 1 and 2, 2 and 3, and 3 and 4). My idea is:

       k:=0 : a:=0 : b:=0 : c:=0 : d:=0 : while k<100000 do x:=f(x): k:=k+1 : if(x>0 and x<1)   then(a=a+1)           elif(x>1 and x<2) then(b=b+1) elif(x<2 and x>3) then(c=c+1) elif (x>3 and x<4) then (d=d+1) end             if : end do: printf("%d %d %d %d", a,b,c,d)                                                                                                                                             But i have problems :(.  Does anyone see the mistake?

Please Wait...