TITLE: Choice Problem: choose 5 days in a month, consecutive days are forbidden
QUESTION [9 upvotes]: I'm "walking" through the book "A walk through combinatorics" and stumbled on an example I don't understand. 

Example 3.19. A medical student has to work in a hospital for five
  days in January. However, he is not allowed to work two consecutive
  days in the hospital. In how many different ways can he choose the
  five days he will work in the hospital?
Solution. The difficulty here is to make sure that we do not choose two consecutive days. This can be assured by the following
  trick. Let $a_1, a_2, a_3, a_4, a_5$ be the dates of the five days of
  January that the student will spend in the hospital, in increasing
  order. Note that the requirement that there are no two consecutive
  numbers among the $a_i$, and $1 \le a_i \le 31$ for all $i$ is equivalent
  to the requirement that $1 \le a_i < a_2 — 1 < a_3 — 2 < a_4 — 3 < a_5 — 4 \le 27$. In other words, there is an obvious bijection between the
  set of 5-element subsets of [31] containing no two consecutive
  elements and the set of 5-element subsets of [27].
*** Instead of choosing the numbers $a_i$, we can choose the numbers $1 \le a_i < a_2 — 1 < a_3 — 2 < a_4 — 3 < a_5 — 4 \le 27$, that is, we can
  simply choose a five-element subset of [27], and we know that there
  are $\binom{27}{5}$ ways to do that.

What I don't understand here $1 \le a_i < a_2 — 1 < a_3 — 2 < a_4 — 3 < a_5 — 4 \le 27$:

Why do the subtracting numbers increment with every other $a_i$? 
Why 27?

And the very last sentence (***) is unclear to me.

Why is there no talk about "non-consecutive"? Why choosing 5 elements of 27 is equivalent to choosing 5 non-consecutive elements out of 31? I miss the connection. 

I'd be very thankful if you could help me to understand this example!

REPLY [3 votes]: Henry's answer for the first part is already very good, so this only tries to tackle the sentence ***. 
Understanding the correspondence between five element subsets of $[27]$ and the non-consecutive days problem might be easier by going from the five element subsets of 27 to the days problem asked, rather than the other way around. 
We know that we'll be forbidden from working on four specific days -- namely, the days after the first four workdays. (We're technically forbidden from working the day after the fifth workday, too, but since we've already filled our monthly quota who cares?) -- so let's throw them out now and worry about which days exactly we've thrown out later. We're now left with days we'll number 1 to 27.
So let's pick five workdays out of the remaining twenty seven (here's our five element subset of $[27]$) and reconstruct the monthly calendar. I'm going to use $a_i$ for the numbers we picked from $[27]$ and $c_i$ for how they'll appear as days of the month a normal human calendar.  By way of example I'm going to say we picked $\{3,4,12,15,20\}$
For $a_1$ we needn't do anything, we'll just copy it down as $c_1$ and say our first workday is Jan. 3d. We're forbidden from working the next day, so we put back the first of the four days we discarded and increment our remaining $a_i$ by one. This fixes our problem with $a_2=4$, and informs us we next have work on the 5th. We do the same for the three $a_i$ left and so on.  
In the end, our five element set from $[27]$ is mapped to the $a_1$ (3rd), $a_2+1$ (5th), $a_3+2$ (14th), $a_4+3$ (18th), and $a_5+4$ (24th) days of January. (Proof that this is actually a bijection is left out, but not really difficult so eh).