First off, I apologize if this is the wrong board. I'm a heavy StackOverflow user, and this is technically a programming question (or at least serves programming use), but I find it to be based moreso in math.
I have two sets of sequential integers that relate to each other, for the sake of example, defined as such:
Set A: [1..50] Set B: [1..150]
I need to generate a third set from a combination of these two sets, with unique values. All integers from Set A
must be programmatically paired with all integers from Set B
to create Set C
, which will contain unique integers. Jumping right into it, I thought "Well, just add the two to together!" I found quickly that such an idea wasn't even close to feasible.
Set A Set B Set C ----- ----- ----- 1 1 2 1 2 3 * 1 3 4 * 2 1 3 * 2 2 4 * 2 3 5 *Non-unique Values
Multiplication didn't go so well either...
Set A Set B Set C ----- ----- ----- 1 1 1 1 2 2 * 1 3 3 2 1 2 * 2 2 4 2 3 6 *Non-unique Values
So I'm looking for an operator or small formula to put between Set A
and Set B
to generate a unique, integral Set C
.
EDIT
Both sets will have values added to them over time, so I need a solution that could handle an infinitely large Set A
and Set B