I have a number say 345691. I want to find remainders in backward direction.Say :
I came across following formulation:
current_remainder = (currentdigit * P +previous_remainder) % b; P=10^(lenght ofnumber-1)
I tried understanding but could not understand the roots of this formulation. Can some one help me understand why it works ?