How can they guess my number just by knowing which rows it appears in? I've saw this "trick" many times in math club, I'm just wondering if it's real that they know ESP, or is it just a scam?
We're given 5 rows: $\newcommand{\tsf}[1]{\mathsf{\text{#1}}}$
$$\begin{array}{c|cccccccccccccccc}
\tsf{Row 1} & \sf 1 & \sf 3 & \sf 5 & \sf 7 & \sf 9 & \sf 11 & \sf 13 & \sf 15 & \sf 17 & \sf 19 & \sf 21 & \sf 23 & \sf 25 & \sf 27 & \sf 29 & \sf 31\\[0.1in]
\tsf{Row 2} & \sf 2 & \sf 3 & \sf 6 & \sf 7 & \sf 10 & \sf 11 & \sf 14 & \sf 15 & \sf 18 & \sf 19 & \sf 22 & \sf 23 & \sf 26 & \sf 27 & \sf 30 & \sf 31\\[0.1in]
\tsf{Row 3} & \sf 4 & \sf 5 & \sf 6 & \sf 7 & \sf 12 & \sf 13 & \sf 14 & \sf 15 & \sf 20 & \sf 21 & \sf 22 & \sf 23 & \sf 28 & \sf 29 & \sf 30 & \sf 31\\[0.1in]
\tsf{Row 4} & \sf 8 & \sf 9 & \sf 10 & \sf 11 & \sf 12 & \sf 13 & \sf 14 & \sf 15 & \sf 24 & \sf 25 & \sf 26 & \sf 27 & \sf 28 & \sf 29 & \sf 30 & \sf 31\\[0.1in]
\tsf{Row 5} & \sf 16 & \sf 17 & \sf 18 & \sf 19 & \sf 20 & \sf 21 & \sf 22 & \sf 23 & \sf 24 & \sf 25 & \sf 26 & \sf 27 & \sf 28 & \sf 29 & \sf 30 & \sf 31
\end{array}$$
Then I pick a number, and they ask me what rows did my number show up in.  I answered honestly, and they were able to guess my number correctly every time!
Is this a scam or, what's the truth behind this?  Every time I asked they said it's mathemagics.
 A: Note that 1 only appears in row 1, and nothing else only shows up in row 1. Likewise, 2 only shows up in row 2, and nothing else lies only in row 2. So if you answer "Only row 1," then they can see that the number is 1.
22, on the other hand, is the unique number appearing in rows 2, 3 and 5 alone. 
You can check that, in fact, all the numbers from 1 to 31 have this uniqueness property.
A: Numberphile has an explanation for this.
https://www.youtube.com/watch?v=kQZmZRE0cQY
A: I'm not sure how ... in-depth is your math knowledge, but they're using this thing called binary.
Let's put this simple; according to your $5$ rows, let's assign each row with a value:
Row 1, $2^0=1$
Row 2, $2^1=2$
Row 3, $2^2=4$
Row 4, $2^3=8$
Row 5, $2^4=16$
Then, add the value(s) of row(s) that your number appears, that should be your number.
For example, if you choose $17$, it appeared in Row 1 and 5, so $1+16=17$.
Also, I want to mention this, as T. Bongers had said, each number would have to has its unique presentation of which rows they would appear and no two distinct number would share the same presentation of appearing rows. The total number possible to be chosen from $5$ rows would be $31$, since $2^5-1=31$. (combinatorics)
If you want to learn more about this read this page (Binary number/Binary arithmetic in Wikipedia.
