Yes, I agree with Alexander. If the random variable 'X' takes any integer value in the range [M,N] with equal probability then the joint probability of two independent observations, X = x1 and X = x2 is equal to P(X = x1)*P(X = x2) =
1/(N - M + 1) * 1/(N - M + 1). Where x1, x2 belongs to [M, N] and '*' denotes the multiplication sign.
I may not understand your problem in the same way as Alexander and Pooja, but I will add some comments from my understanding (or misunderstanding. If you choose two terms from set q containing a finite number of terms, then the real question is whether the second choice will be the same as the first. If N is the number of terms in q, and the terms are equally likely, then 1/N is the probability that the second term chosen will be the same as the first. If N is infinite, then this probability is zero (which does NOT mean impossible). If q is all prime numbers within some specified range, then the challenge may be finding the value of N.
1/(N - M + 1) * 1/(N - M + 1) is the probability to choose some PREDEFINED number twice from the segment [M, N]; but if we say about ANY number from the segment, this probability is summed (N-M+1) times, and the answer is 1/(N - M + 1).
I agree with you completely, Alexander, except that you and I have understood Neetesh's problem in different ways. I thought he wanted the set q to include only prime numbers, so that it is more difficult to say how many members are in the set. You may be right that his set q includes all integers in an [M,N] range.
Actually, I need to define a set q (may be with prime numbers or not, that has to be decided), in which I wish to make it more difficult for users (say 2 users) to randomly picked up the same number (in fact, i wish this not to be happened).
So what should be q (finite integer/prime no.) more specifically? But q is very large, means each of thousand/million users picks a random number from this pool q.
If I understand you correctly now, you don't need to deal with prime numbers.. You can just use the 32-bit or 64-bit integer range (if we talk about some software). For two users the probability to choose the same number will be 1/(2 to the power 32) or 1/(2 to the power 64).
Neetesh, I think you are now describing a rather different problem than either Alexander or I have been considering. I think now that the real problem is to find the probability that a large number of users will each choose a different number from the set q. Obviously this is the complement of the number you are seeking, but it would provide a solution to the problem. Let us say that there are U users and N numbers in the set q. The first user cannot duplicate a used number, so we can say that N/N is the probability he/she chooses an unused number. For the second user the probability is (N-1)/N of choosing an unused number. Eventually the probability of choosing an unused number is (N-U+1)/N for user U. Multiplying all these U probability numbers gives the probability that no user chooses a previously used number as N!/[(N–U)! N^U] in which ! denotes factorial and N^U is N to the power U. Then 1–N!/[(N–U)! N^U] is the probability of at least one number being chosen more than once.
I hope this is helpful, and that I have not misunderstood the problem again.