Given Sam's number is $x$ and Peter's number is $y$, most people seem to be working from the following premises:
- $x, y \in \mathbb{N}$ where $\mathbb{N}$ is the natural integers; $\mathbb{N} = \{1, 2, ...\}$
- $2002 = x + y \lor 2002 = xy$
If that's correct then you must agree with Mike Earnest's answer or be logically impaired. A stricter reading of the problem provides these premises:
- $x \in \mathbb{N} = \{1, 2, ...\}$
- $y \in \mathbb{R}$ where $\mathbb{R}$ is the set of all real numbers
- $2002 = x + y \lor 2002 = xy$
We can intuitively (and logically) exclude more interesting numbers (complex, imaginary, etc.) for the value of $y$. I've omitted that here.
Sam: I don't know your number.
Of course Sam would have no idea. $\forall n \in \mathbb{N}$ $\exists r_a, r_m \in \mathbb{R}$ such that $(r_a \neq r_m)$ $\land$ $(2002 = x + r_a)$ $\land$ $(2002 = xr_m)$. Thanks, Sam, you told us nothing.
Peter: I don't know your number either.
This is telling. This means that $\exists$ $n_a, n_m \in \mathbb{N}$ such that $(n_a \neq n_m)$ $\land$ $(2002 = n_a + y)$ $\land$ $(2002 = n_my)$ which implies:
$$y \in \mathbb{Z} \;where\; \mathbb{Z} = \{..., -2, -1, 0, 1, 2, ...\}$$
Because $\nexists$ $r \in \mathbb{R}, n \in \mathbb{N}$ such that $2002 = n + r$ $\land$ $r \notin \mathbb{Z}$. Which means if $y \notin \mathbb{Z}$, then Peter could find $x = {2002}/y$. But Peter doesn't know $x$, so $y \in \mathbb{Z}$.
Furthermore, we can deduce:
$$y \in \mathbb{N}$$
$\nexists$ $y \in \mathbb{Z}$ such that $y < 1$ $\land$ $2002 = xy$. If $y < 1$, then Peter could find $x = 2002 - y$.
And finally:
$$ y \in F_y = \{1, 2, 7, 11, 14, 22, 77, 91, 143, 154, 182, 286, 1001\} \subset F$$
Where $F$ is the factors of $2002$. (Note: $F = F_y \cup \{2002\}$.) We know this because $\exists n_a, n_m \in \mathbb{N}$ such that $(n_a \neq n_m)$ $\land$ $(2002 = n_a + y)$ $\land$ $(2002 = n_my)$; otherwise, Peter could eliminate one of the formulas and calculate $x$. The only numbers that satisfy this criteria are in $F_y$.
Sam: Now I know your number.
The big takeaway from this is $x \neq 1001$; $x = 1001$ is the case where Sam still doesn't know $y$. This is because $2002 = 1001 + 1001$ and $2002 = 1001 * 2$. Hence, $y$ could either be $1001$ or $2$, and Sam would not know which number.
Peter: Now I know yours too.
That one bit of info (other inferences aside), must have given Peter enough knowledge to solve the problem, so $x = 1001$ must have been a potential possibility prior to Sam's statement. There's only two values of $y$ for which this is the case:
$$2002 = 1001 + 1001,\;y = 1001$$
$$2002 = 1001 * 2,\;y = 2$$
Which means the other formula will give us the potential values for $x$:
$$2002 = 2 * 1001,\;x = 2$$
$$2002 = 2000 + 2,\;x = 2000$$
So there are two solutions: either Sam picked $2$ and Peter picked $1001$, or Sam picked $2000$ and Peter picked $2$.
Unlike the other version where $y \in \mathbb{N}$, in this case we do not know if $x \in F$. If $x \in F$ then there would only be one solution: Sam picked $2$ and Peter picked $1001$.