__hermit__'s blog

By __hermit__, history, 3 years ago, In English

Hi , I have one expression as follows:-

(b*y) — (r)*floor(b*y/r)

b and r are known. We can set any value of y of our choice >=0 .

Now what are the possible value that this expression can take?

By running for some values of r and b, I observed two things:-

if (b%r==0) then the answer is zero (which seems obvious to me) if(b%r!=0) then answer is the following :- g*K where K>=0 and K<= (r/g)-1.

Can someone provide the proof for second case? Also will the answer for following expression be similer? r*ceil(b*y/r)-b*y

Full text and comments »

  • Vote: I like it
  • -1
  • Vote: I do not like it