Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Let's say I have 3 people who each has a random number:

A: 1920970862902
B: 1920970862087
C: 1920970861233

How do I create a single number $X$ from $N$ (in this case, 3) numbers, where if I give $X$ to $A$, $B$ or $C$, they will be able to use $X$ to determine if their own number is inside? Is this even possible?

Extra Info: I'm using this for a programming function, so I would prefer simple formulas.

share|cite|improve this question
The numbers don't look too random if they share a large prefix... – lhf May 23 '12 at 2:26
Does 192097086290220871233 count? – lhf May 23 '12 at 2:28
As lhf suggests, what about just concatenating all the numbers together? Or do you want $X$ to have the same length as the numbers of $A$, $B$, and $C$? – Austin Mohr May 23 '12 at 2:31
lhf: well they are timestamps, so they aren't that random, the randomness comes from the fact that they can be generated anytime. AustinMohr: well if I have 20 random numbers then it might become an issue. $N$ could range from 1 to ~100 numbers. Preferably $X$ should be the same length, or at least not too long. – Wei Hao May 23 '12 at 2:33
It's impossible to compress random numbers: if you want to encode a sequence of $N$ arbitrary integers of $d$ digits each, you'll need at least $Nd$ digits to do so. On the other hand, if the numbers are not completely random, some compression may be possible. Look at – Robert Israel May 23 '12 at 2:43
up vote 0 down vote accepted

If you're dealing with timestamps they're probably counted from a far away date. Move to a date closer to now but still far from the timestamps and you'll be able to use less digits to represent each timestamp. I've used 1920970860000 for that closer date in my comment and got 2902, 2087, 1233, joined together into 290220871233. But for 100 timestamps you'll still need several digits, probably 400 say.

share|cite|improve this answer
Thanks. That's an interesting suggestion. – Wei Hao May 23 '12 at 2:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.