I am a sophomore in high school and my math teacher did a very short lesson on infinity, here's how it went: (Try to solve each part yourself the first two are easy)
Part 1
You have an inf. number of boxes each labeled like so
[1][2][3][4].....
and that there is a person in each one of these boxes. But you have another set of five boxes like so
[1][2][3][4][5]
You want to only have one set of boxes what do you do? You must be able to tell each person what box they should goto next.
Spoiler
Each person is told to move down five boxes. Or n+5 is you new box, and the five people from the other boxes are able to move into the first five boxes or just n+0.
Part 2
Well you actually have two of these inf. box sets, but you really only want one. What now? (same rules apply)
Each person from set one is told to go to box 2n and each person from set two is told to box 2n-1
Part 3
Now you have an inf. number of these inf. box sets arranged like so
1: [1][2][3][4][5]...
2: [1][2][3][4][5]...
3: [1][2][3][4][5]...
4: [1][2][3][4][5]...
5: [1][2][3][4][5]...
and you want to fit them all into one inf. box set, how do you do it. She refused to tell us the answer and no one in my class figured it out, but I think I just did (correct me if I'm wrong, I'm also looking for alternate solutions).
How I went about solving this problem
Step 1
I assumed that there had to be some sort of pattern so I tried a few
Step 2
I picked the following patter.
1: [1][3][6][10][15]...
2: [2][5][9][14][]...
3: [4][8][13][][]...
4: [7][12][][][]...
5: [11][][][][]...
The numbers in the box represent the new box of each person
Step 3
I started to create a formula for the people to find there new room based of there current room number and box set number. I found the following sequence in for people in the first row, 1 3 6 10 15. Or +2 +3 +4 +5. Which told me that it was quadratic so the equation had to be ax^2 + bx + c = new room number
Step 4
I found three equation by plugging in room numbers and their correct new room numbers to find these three equations:
(1^2)a + 1b + c = 1 or a + b + c = 1
(2^2)a + 2b + c = 3 or 4a + 2b + c = 3
(3^2)a + 3b + c = 6 or 9a + 3b + c = 6
Step 5
After solving this system I got the following equation 1/2x^2 + 1/2x + 0 = new room number where x = current room number. This of course only tell the people in the boxes on the bottom where to go. Now I needed to find how to place the rest of the people. The first thing I noticed was that people on the same diagonal as seen bellow were very much related to each other when you look at the rooms they will end up in.
[x-4][][][][]
[][x-3][][][]
[][][x-2][][]
[][][][x-1][]
[][][][][x]
The solution
Working this knowledge into my equation was fairly easy (I was able to do it while going for a run so I won't explain how I got my equation). The equation is:
(1/2(r+c-1)^2 + 1/2(r+c-1) + 0)-r+1 = new room number | r = row | c = column
Now my question to all of you is
- Is my equation correct?
- Are there any alternate solutions to this problem?
- How could you fit a 3D array of boxes (inf boxes of people in all direction) into a 1D line of boxes?
- Can you find a way to fit a n dimensional array of boxes into a 1D line of boxes?
For any of you into JAVA here's a a short snippet of code I made to prove my answer
package main;
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int f = 2;
int r = 1;
int c = 1;
while(true){
double x = (.5*(r+c-1)*(r+c-1) + .5*(r+c-1) + 0)-r+1;
System.out.print(x +", ");
c++;
r--;
if(r < 1){
r = f;
f++;
c = 1;
}
}
}
}