0

I'm not sure of the best way to ask this question but I will try with an example of my problem:

I have three numbers, 3 and 5 and x.

x always starts as zero.

There are two possible events that can occur:

  • Someone buys an apple -> I add 3 to x
  • Someone buys a banana -> I add 5 to x

If someone makes a purchase then I can use mod3, mod5 and mod8 to determine if they bought an apple, a banana or both.

This is fine for any number lower than 15. Once we get to 15 and above we do not know whether someone only bought apples, only bought bananas or bought a combination of both.

So my question is, are there any three numbers I can always use to determine if they bought just apples, just bananas or both?

Or is there a better way of doing this all together?

3 Answers3

2

Short answer: No, there are no such numbers. Not if you are adding. Take any $p,q \in \mathbb{N}$. Then, at one point you may have $x = pq$ and can't decide whether that is because someone bought $q$ apples or $p$ bananas.

You can, however, do this by using multiplication. Initialize $x := 1$ and choose $p := 2$, $q := 3$ (or any other distinct primes). Multiply $x$ by $p$ or $q$ accordingly. To get the information about how much was bought, factorise $x$. I do not recommend this for practical purposes, but in theory it works fine.

m_l
  • 1,004
  • After rethinking through my problem, I have decided I am over-complicating the entire issue. Thanks for the answer and since you offered an alternative solution then I will mark it as accepted. – My Head Hurts Apr 20 '12 at 15:19
1

If a,b,c are the numbers you want, a|LCM(a,b) and b|LCM(a,b), that means when c>=LCM(a,b), you will never know c whether someone only bought apples, only bought bananas or bought a combination of both.

1

This is the coin problem. If the two values are a,b and gcd(a,b)=1, you can represent all numbers above ab-a-b-1. Once you get to ab you can't tell whether you have a b's or b a's.

Ross Millikan
  • 374,822
  • +1 thanks for the link and the almost layman explanation. It always makes me feel better when they have a name for my problem :) – My Head Hurts Apr 20 '12 at 15:23
  • 1
    @MyHeadHurts: not only does it make you feel better to know the name of the problem, but it gives you something to search on. I have received the same as 18 point problem for http://math.stackexchange.com/questions/43311/choosing-points-in-fractions-of-the-unit-interval and found some interesting articles that way. – Ross Millikan Apr 20 '12 at 15:38