Saturday, April 6, 2019

How To Evaluate Remainder And Quotient For Another Number (Devisor)

If you already know the quotient and reminder when you divide x by a, then what will be the quotient and reminder if you divide x by b?

All numbers discussed here are integers.
Suppose there are there numbers x, a, b
When you divide x by a, the reminder is a1 and quotient is a2.

If you now divide x by b, what will be the values of the new quotient b2 and reminder b1 in terms of x, a, b, a1, a2?


What will be the new reminder if you divide y by a is a far simpler problem explained in 
https://vbala99.blogspot.com/2019/04/estimating-next-prime-number-conts.html. Though the associated discussion on prime numbers is more involved.


Coming back to our problem, assume that the values of x, a, b, and hence of a1, a2 are known.

a2 = (x-a1)/a
x + (b-a)*a2 when divided by b will give the same reminder a1 and same quotient a2.
For example assume x=13, a=3, b=5.
a1=1, a2=4

Let's term (b-a)*a2 as c

x + c = x + (b-a)*a2 = 13+(5-3)*4 = 13+8=21.
If 21 is divided by b=5, the quotient is 4 and reminder is 1. As before.

Remember values of a1, a2. We have to determine the values of b1, b2 when x=13 is divided by b=5.

Now let's focus on the number that was added to x: c = (b-a)*a2 = 8

Let's divide c by b=5
The quotient is 1 and reminder 3.

When x was divided by a=3, the quotient was 4 and reminder 1.

To determine the b1, b2 we take the first set of quotient and reminder {4,1} and reduce the second set {1,3} from it.

We get the new set 4-1=3 and 1-3=-2
The new quotient and reminder are 3, -2.

3*5 +(-2) is indeed 13. Rather, when 13 is divided by 5, b1=3 and b2=-2.
But then reminder should be positive.
So we subtract 1 from b1 and add b to b2.

Final answer b1=3-1=2 and b2=-2+5=3.

If we put it in algebra:

If the set of quotient, reminder when x is divided by a is {a2, a1} and the set when c = (b-a)*a2 is divided by b is {c2,c1}

Then when x is divided by b the quotient and reminder are {a2-c2, a1-c1} ...... Eqn (1)

In case a1-c1 is negative then reduce a2-c2 by 1 and add b to a1-c1. ..... Eqn (2)


Let's apply this to an example.
x=167, a=8, b= 17
a2=20, a1=7 (because 20*8+7=167)

Now,
c = (b-a)*a2 = (17-8)*20=180
When 180 is divided by 17, the quotient and reminder are {10,10}

So the final set, applying Eqn (1) is {20-10, 7-10} = {10, -3}. Note 10*17+ (-3) = 167 = x

Since -3 is less than 0, we apply Eqn (2) and get the corrected quotient and reminder set:
 {10, -3} = {10-1, -3+17} = {9, 14}

Check: 9*17 + 14 = 167

Simple.

No comments:

Post a Comment

Popular Posts

Featured Post

Whom Do We Trust

I came across this: APNews being the trusted source of news for half the world.  And there is Truth Social which also is read and trusted by...