Guessing/extracting from the pool of partially right guesses Lets assume that I have integer numbers from 1 to 50.
I imagine any 5 unique numbers from 1 to 50.
A computer can generate an array of 5 random numbers, as many times as it wants.
Each time it generates an array, it guesses 0, 1, or 2 numbers correctly.
There is an equal chance of obtaining 0, 1 or 2 guesses right.
It never guesses more than 2 numbers right.
If, lets say, computer generates a lot of guesses (lets say that lot means 1000), it will guess each number from the ones I imagined, at least once.
However, computer does not know which numbers are correct from the ones it guessed.
What would be the best method to apply to a pool of guesses to extract 5 numbers that would match the ones I imagined, in any order ?
Thanks!
EDIT (the source code for generating the pool of guesses)
import java.util.ArrayList;
import java.util.Random;  

public class theGuessing {
public static void main(String[] args) {
    Random rnd = new Random();
    ArrayList<String> poolOfGuesses = new ArrayList<String>();
    int[] imagined = {2,4,5,30,48}; //these are the numbers I imagined.

    //now, let us create a pool of guesses, lets say there are 1000 guesses in a pool
    while(poolOfGuesses.size()<1000){
    //this is how one guess is generated:
    ArrayList<Integer> guess = new ArrayList<Integer>();
    int numberOfCorrectNumbers = rnd.nextInt(3);
    while(guess.size() < numberOfCorrectNumbers){
        int correctNumberPosition = rnd.nextInt(imagined.length);
        int correctNumber = imagined[correctNumberPosition];
        if(!guess.contains(correctNumber)){guess.add(correctNumber);}
    }

    while(guess.size() < 5){
        int someRandomNumber = rnd.nextInt(50)+1;
        if(!guess.contains(someRandomNumber)){guess.add(someRandomNumber);}
    }

    //since the order does not matter, lets sort the Integer.
    Integer[] tosort = guess.toArray(new Integer[guess.size()]);
    Arrays.sort(tosort);

    //now, for fun lets make the guess a String
    String theGuess = "";
    for(Integer r:tosort){
        theGuess = theGuess+r+",";
    }

    theGuess = theGuess.substring(0, theGuess.length()-1); //removes the dangling comma
    //since we want a pool of guesses, just add theGuess to the pool
    poolOfGuesses.add(theGuess);
    }
}

What happens next, a person is given this poolOfGuesses and they need to find out, to best of their ability, what are the 5 numbers that I guessed. How would they do that ? what would be the best procedure ??? 
 A: Given that the program always guesses 0, 1, or 2 numbers correct with equal probability the solution is straightforward. The numbers that occur with highest frequency after 1000 guesses are your best bet. 
Example by R simulation
# number of guesses
n = 1e3 
# sample true values
true = sample(1:50, 5)
# empty matrix to store guesses
guess = matrix(NA, n, 5)
for (i in 1:n) {
  # sample how many are guess correctly
  right = sample(0:2, 1)
  # make guess
  guess[i, ] = c(sample(true, right), sample((1:50)[-true], 5L - right))
}
# get frequency with which every number is guessed
tb = table(c(guess))
plot(tb, las = 1, bty = 'n', col = ifelse(1:50 %in% true, 'gold', 'black'))


Proof by math.
Since $P(A) = \sum_i P(A|B_i)*P(B_i)$ the probability of a guess $g$ being any correct number $c$ is: 
\begin{align}
P(g=c) &= P(g=c|\text{2 correct guesses})*P(\text{2 correct guesses}) + \\
& \quad P(g=c|\text{1 correct guesses})*P(\text{1 correct guesses}) + \\
& \quad P(g=c|\text{0 correct guesses})*P(\text{0 correct guesses}) \\
& = \frac{1}{3} (\frac{2}{5} + \frac{1}{5} + 0) =  \frac{1}{5}
\end{align}
To get the probability for an individual true number to be guessed we have to further divide this by the amount of correct numbers. The probability for a correct number to be guessed is then $\frac{\frac{1}{5}}{5} = \frac{1}{25} = 0.04$. The probability for a false number to be guessed is $1-\frac{1}{5} = \frac{4}{5}$. However, we also have to divide this by the number of options, resulting in $\frac{\frac{4}{5}}{45} = \frac{4}{225} \approx 0.01778$. Since the probability for a true number to be guessed is much larger, the best strategy is to choose the numbers that appear with highest frequency after 1000 guesses.
