 |
|
|
|
 |
|
 |
 |
DigiNut
You kids get off my lawn!

Registered: Dec 2002
Location: Toronto, Self-proclaimed Centre of the Universe
|
|
|
| quote: | Originally posted by Flyboy217
DigiNut, I think it's actually easier to think of it without specifically using modular arithmetic. Basically, think about a value after which you know ALL values can be achieved, and work your way back. If you have some value x*A + y*B, then what does taking away one A and adding a B do to your value? You can obviously achieve all prices P where P%A = 0 and P%B = 0. How do you achieve the rest? |
Ok, here's one way of looking at it:
If you take A*B, you know that you have a number that's divisible by BOTH A and B (that is, P%A=0 and P%B=0 like you said). If A and B are relatively prime, you know the following things:
- (A+B)%A = B, and (A+B)%B = A. Therefore (A+B)%A > 0, and (A+B)%B > 0. (1)
- If you subtract A from (A*B), you cause the result to be indivisible by B (with a remainder of A). (2)
- If you again subtract B from this total, you cause it to be indivisible by A (with a remainder of B). (3)
- You know that the result after step (2) will not suddenly become divisible by B again after step (3), because of lemma (1).
- (A*B) - A - B = (A*B) - (A+B)
- Therefore, this number is guaranteed to be indivisible by both A and B.
Now, I know that (A*B) - (A+B) can be written as (A-1)(B-1) - 1. So the first value where you CAN make ANY price is (A-1)(B-1). I'm sure there's a way to prove that when you have (B-1) A's and (A-1) B's already, that you can generate prices in increments of exactly 1, but I haven't worked out exactly how yet.
Actually, that last part seems intuitive, but I'm just not sure how to spell it out...
___________________
My party schedule:
2009-02-21 - DJ Attention @ I'm So Popular
2009-06-18 - DJ Annoying @ People Need To Know Where I'll Be
2012-11-32 - DJ Insufferable ɸ Or At Least the Stalkers I Complain About
2048-06-66 - Spastic & Whocares ¶ Although I'm Actually Flattered
9999-45-81 - Tweaker Gimp ☼ I Probably Won't Even Go To This But I Have To Make Sure I Fill Up All The Available Space Here
Last edited by DigiNut on Oct-12-2003 at 21:30
|
|
Oct-12-2003 21:24
|
|
|
 |
 |
Flyboy217
Senior tranceaddict

Registered: Aug 2003
Location: In DEEP SPACE... Space... space... sp...
|
|
|
| quote: | Originally posted by DigiNut
Ok, here's one way of looking at it:
If you take A*B, you know that you have a number that's divisible by BOTH A and B (that is, P%A=0 and P%B=0 like you said). If A and B are relatively prime, you know the following things:
- (A+B)%A = B, and (A+B)%B = A. Therefore (A+B)%A > 0, and (A+B)%B > 0. (1)
- If you subtract A from (A*B), you cause the result to be indivisible by B (with a remainder of A). (2)
- If you again subtract B from this total, you cause it to be indivisible by A (with a remainder of B). (3)
- You know that the result after step (2) will not suddenly become divisible by B again after step (3), because of lemma (1).
- (A*B) - A - B = (A*B) - (A+B)
- Therefore, this number is guaranteed to be indivisible by both A and B.
Now, I know that (A*B) - (A+B) can be written as (A-1)(B-1) - 1. So the first value where you CAN make ANY price is (A-1)(B-1). I'm sure there's a way to prove that when you have (B-1) A's and (A-1) B's already, that you can generate prices in increments of exactly 1, but I haven't worked out exactly how yet.
Actually, that last part seems intuitive, but I'm just not sure how to spell it out... |
First, some notation: A%x=0 is properly written as A = 0 (mod x), read "A is congruent to zero, modulo x". (Actually, the congruency sign properly has three bars, not two...)
It's true that AB-A-B is indivisible by both A and B. This can be proven by noting that AB=0 mod A and mod B, and therefore only numbers different from AB by a multiple of A are congruent to 0 mod A (and similarly for B).
What's important is that AB-A-B is not a positive linear combination of A and B though. I'll write up an explanation when I get a chance. You're thinking along the right lines though...
|
|
Oct-12-2003 22:39
|
|
|
 |
 |
Flyboy217
Senior tranceaddict

Registered: Aug 2003
Location: In DEEP SPACE... Space... space... sp...
|
|
|
Okay. This is the ugliest, dirtiest proof I've ever written. If you don't follow it, props to you for not being f*ed in the head...
------
Call a price "attainable" if you can purchase an item of that price with exact change.
Using 0 of coin B and as many of coin A as we need, We can attain all prices C where C = 0 (mod A) (i.e., all multiples of A) starting with C = 0*B.
Using 1 of coin B and as many of coin A as we need, we can attain all prices C = xA + B. I.e., we can attain all prices C where C = B (mod A) starting with C = 1*B.
Using at most y of coin B, we can attain all prices C where C = {0*B, 1*B, ..., y*B} mod A.
Note that n*B mod A are distinct for all 0 <= n <= A-1. Thus, we can attain all prices greater than or equal to C = (A-1)B that have the same congruency as (A-1)B mod A.
Hence, (A-1)(B)-A is not attainable (since (A-1)B = (A-1)B-A (mod A) and (A-1)B is the smallest price congruent to (A-1)B mod A that is attainable). However, (A-1)B-A+1 is attainable, because it is congruent to a value other than (A-1) mod A, all other congruencies have been satisfied, and it is greater than (A-2)B (which was the last satsified congruency).
Therefore, (A-1)B - A + 1 = (A-1)(B-1) is the smallest value for which all prices greater than or equal to it can be satisfied.
-
||
-
|
|
Oct-12-2003 23:30
|
|
|
 |
 |
|
 |
All times are GMT. The time now is 00:04.
Forum Rules:
You may not post new threads
You may not post replies
You may not edit your posts
|
HTML code is ON
vB code is ON
[IMG] code is ON
|
|
|
|
|
|
Contact Us - return to tranceaddict
Powered by: Trance Music & vBulletin Forums
Copyright ©2000-2026, Jelsoft Enterprises Ltd.
Privacy Statement / DMCA
|