# how to predict next set of number from two number groups.

I need to write a php class fulfillment script that has to pick 4 numbers from one group (101-159) and then pick one number out of a new group that has the same number set (101-159) and over the history of the sets what is the odds that the one number picked from the second set. I know the odds of that second number that is picked not being that same is higher than it being the same, but how do I show these odds to make a better prediction of the second number.

Ok maybe a sample set of data will help me explain myself :D. These are past real results.

set1 has 101-159         set2 has101-159
rule1: 4 out of set 1 but never same
rule2: 1 out of set 2

past test results:
set1(115 123 143 145)  set2(107)
set1(108 113 117 134)  set2(135)
set1(105 133 141 154)  set2(113)
set1(104 119 128 129)  set2(105)
set1(112 124 143 144)  set2(107)
set1(106 129 134 144)  set2(128)
set1(110 130 136 138)  set2(101)
set1(105 119 129 145)  set2(125)
set1(103 121 124 138)  set2(124)
set1(121 135 146 147)  set2(102)
set1(105 123 125 128)  set2(134)
set1(116 121 127 141)  set2(114)
set1(114 116 130 151)  set2(119)
set1(110 113 115 131)  set2(118)


So I need to predict the next 3 set with it being super close. Like a one in 10 chance kinda close is the goal. Can someone steer me in the right direction?

[EDIT]

So to try to explain it a different way, as we all read things differently, I need to take a bunch of database entries and use them, and some basic formation of the entry data to predict the next one in line to occur within a error rate of something like 20%.

The rules are

There are two sets of numbers per entry
full row will be formed like (FYI: random & user choice)
====================================================
set1(115 123 143 145)                  | set2(107)
4 numbers between 101-159 non-matching | 1 number numbers between 101-159
====================================================


Now there are some thing I think are common sense, but do know how to form in a math equation. Like, the odds of a set like this

set1(101 102 103 104)  set2(101)  <<< odd very low.


also I would think this would be a low accuring running of the chocies.

<<< odd very low.
set1(101 112 123 134)  set2(101)
set1(102 113 124 135)  set2(101)
set1(103 114 125 136)  set2(101)


And I would also think the odds of the numbers being evenly spread out is very low.. ie:

set1(101 111 121 131)  set2(141)

-
Sounds like it would be a 5/59 chance of getting a number in set 2 that is the same as one of the numbers in set 1 – riotburn Feb 8 '12 at 20:10
This is a word-salad, not a question. Please ask someone who is fluent in both mathematics and English to help you edit it into something comprehensible. – Gerry Myerson Feb 9 '12 at 0:12
@riotburn: why $5/59$ and not $4/59$? – Henry Feb 9 '12 at 1:07
I'm sorry, too, but "to predict the closely to the next set" is not the kind of thing people write if they know English and want other people to understand them. Neither is "what is the odds that the one number picked from the second set." Neither is "I need to predict the next 3 set with it being super close." Get some help with writing mathematical English, and you may get some useful answers. Otherwise, we're just all guessing what you are trying to say (and, mostly, giving up). – Gerry Myerson Feb 9 '12 at 2:38
If I understood the question, I would edit it into better shape myself, and answer it if I could. I wrote what I did because I don't understand the question and, judging from the paucity of responses, others don't, either. I don't even know what a "php class fulfillment script" is, and I can't tell whether I need to know what it is in order to engage with the question. Look: if you're happy with the answers you're getting here, that's terrific. If you're not, you may want to consider taking my advice, to get some help editing your question. It can't hurt. – Gerry Myerson Feb 9 '12 at 2:52

Let's see if I understand the problem.

Some process is spitting out 5-tuples of numbers, $(a_1,a_2,a_3,a_4,b)$.

You know that $101\le a_1\lt a_2\lt a_3\lt a_4\le159$, and $101\le b\le159$, and for all $i$, $a_i\ne b$.

Given a list of all the 5-tuples created so far, you want to predict the next one, or maybe the next few.

You don't know what rule, if any, the process is following.

So first, let's calculate the number of different 5-tuples possible. By standard techniques, that is $(59)(58)(57)(56)(55)/24=25031930$.

This means that if the process is picking numbers randomly, then your chances of predicting the next 5-tuple exactly are 1 in 25031930.

It also puts into some perspective your feeling that the odds of, say, $(101,111,121,131,141)$ are very low: the odds of any particular 5-tuple, even of $(115, 123, 143, 145,107)$, are very low - 1 in 25031930.

Now a few things you say indicate you don't have to get it exact. You write about being "super close," "a 1 in 10 chance kinda close," "within an error rate of something like 20%." I don't really know what you mean by these. Some clarification would be welcome. Meanwhile, here's an idea that may or may not be the kind of thing you're looking for:

Look at your past test results, take the average of the numbers in the first column, round to a whole number, and make that your guess for the next $a_1$; do the same for each of the other columns to make your guess for the next $a_2$, $a_3$, $a_4$, and $b$. If your guess for $b$ turns out to be equal to one of the $a_i$ guesses, and if you are sure the process will never have the 5th number equal to one of the other four, then change your $b$-guess to the next whole number up or down.

I know you can't comment on answers, but you can edit your question to say whether I'm on the right track, or whether I'm still not understanding.

-
so with this .. (59)(58)(57)(56)(55)/24 first.. what is the 24 for and the last number would be (59) right? So you seem like you have the right idea now.. On the '"within an error rate of something like 20%." I don't really know what you mean by these' the point is that I just need to not have a 1 in a million but bring the odds down. I seems like you are getting close to what I'm driving at.. I will just need to get it a little more robust – jeremy.bass Feb 10 '12 at 20:01
So moving this forward I notice this is not a correct rule, $a_i\ne b$ should be $a_i\ne a_i+1$ . So when predicting the next set, is there any examples of math that show odds of something affecting the output. For example, thou yes at random I could end up with a set that is 101,102,103,104 and 105 .. ie: all in line but that is almost impossible so I'd like to lead the equation so I get better answers. Hope that is clear. Thank you for the help. - – jeremy.bass Feb 15 '12 at 16:50