AMC 10 Step by Step

2026 AMC 10B Problem 9

P1-10~5 minPrint

A library offers 5 desks arranged in a row from left to right for quiet studying. Students arrive one at a time and sit down at a desk. If possible, each student avoids sitting next to another student. Otherwise they will, if possible, sit next to one student rather than two. How many possible seating configurations (which seats are occupied) for one to five students are there?

Log in to save your progress.
Show solution without answering

Key insight

Build the patterns one student at a time: from each pattern of taken desks, find where the next student may sit, and count each different pattern once.

Solution

Number the desks 1,2,3,4,51, 2, 3, 4, 5 from left to right. A "configuration" is just the list of desks that are taken, for example "desks 11 and 44". We need all the lists that can really happen when there is one student, then two, then three, four and five.

The next student's choice depends only on which desks are taken right now. So build the lists one student at a time.

The rule for a new student, in order:

  • first choice: an empty desk with no student beside it;
  • if there is none: an empty desk with one student beside it;
  • if there is none of those either: a desk with a student on both sides.
  1. One student. The room is empty, so any desk is fine. That gives 55 patterns: desk 11, desk 22, desk 33, desk 44 or desk 55.

2. Two students. Wherever the first student sits, there is still a desk that is not beside them. (If the first student is at desk 33, desks 11 and 55 are free of neighbors. If the first student is anywhere else, a desk at the far end is.) So the second student never sits beside the first. The pairs of desks that are not side by side are
1 and 3,1 and 4,1 and 5,2 and 4,2 and 5,3 and 5.1\text{ and }3,\quad 1\text{ and }4,\quad 1\text{ and }5,\quad 2\text{ and }4,\quad 2\text{ and }5,\quad 3\text{ and }5.
Each one can happen: the first student takes one desk of the pair and the second takes the other. That gives 66 patterns.

  1. Three students. Take each two-student pattern and see where the third student may sit.
Desks takenEmpty desks with no neighborThird student sits atPatterns made
1,31, 355551,3,51,3,5
1,41, 4none (22, 33, 55 each have one neighbor)22, 33 or 551,2,41,2,4 and 1,3,41,3,4 and 1,4,51,4,5
1,51, 533331,3,51,3,5
2,42, 4none (11 and 55 have one neighbor, 33 has two)11 or 551,2,41,2,4 and 2,4,52,4,5
2,52, 5none (11, 33, 44 each have one neighbor)11, 33 or 441,2,51,2,5 and 2,3,52,3,5 and 2,4,52,4,5
3,53, 511111,3,51,3,5

Some patterns show up more than once, and we count each only once. The different ones are
1,3,51,2,41,3,41,4,52,4,51,2,52,3,5.1,3,5 \qquad 1,2,4 \qquad 1,3,4 \qquad 1,4,5 \qquad 2,4,5 \qquad 1,2,5 \qquad 2,3,5.
That gives 77 patterns. (The ones that never happen are three in a row: 1,2,31,2,3 and 2,3,42,3,4 and 3,4,53,4,5.)

  1. Four students. Now only two desks are empty, and the fourth student takes the one with fewer neighbors (either one if they tie). Do the same for each three-student pattern.
Desks takenThe two empty desksFourth student sits atDesk left empty
1,3,51,3,522 (two neighbors), 44 (two neighbors)22 or 4444 or 22
1,2,41,2,433 (two neighbors), 55 (one neighbor)5533
1,3,41,3,422 (two neighbors), 55 (one neighbor)5522
1,4,51,4,522 (one neighbor), 33 (one neighbor)22 or 3333 or 22
2,4,52,4,511 (one neighbor), 33 (two neighbors)1133
1,2,51,2,533 (one neighbor), 44 (one neighbor)33 or 4444 or 33
2,3,52,3,511 (one neighbor), 44 (two neighbors)1144

The desk left empty is always 22, 33 or 44, never an end desk. So there are 33 patterns: 1,3,4,51,3,4,5 and 1,2,4,51,2,4,5 and 1,2,3,51,2,3,5.

  1. Five students. The last student takes the last desk. That is 11 pattern.

6. Add the stages.
5+6+7+3+1=22.5 + 6 + 7 + 3 + 1 = 22.

The answer is (D) 22\boxed{\textbf{(D)}\ 22}.

Why this works

When people or objects arrive one at a time and follow a rule, the next move depends only on the picture right now. So you can build every possible picture stage by stage, using the pictures from the stage before. Different arrival orders often lead to the same picture, so always count the different pictures, not the routes to them.

Alternative approach

Count what is missing instead. This is a good way to check the lists.

With no rule at all, each desk is either taken or empty, so there are 25=322^5 = 32 patterns, and 3131 of them have at least one student. Now remove the ones the rule makes impossible:

  • Two students side by side (and nobody else): 1,21,2 and 2,32,3 and 3,43,4 and 4,54,5. That is 44 patterns. They cannot happen because the second student can always find a desk with no neighbor.
  • Three students in a row (and nobody else): 1,2,31,2,3 and 2,3,42,3,4 and 3,4,53,4,5. That is 33 patterns. The table in Step 3 shows they never appear.
  • Four students with an end desk empty: 2,3,4,52,3,4,5 and 1,2,3,41,2,3,4. That is 22 patterns. The table in Step 4 shows they never appear.

So 31−4−3−2=2231 - 4 - 3 - 2 = 22 patterns can happen.

Concise solution

A shorter write-up, the way contest solutions are usually written. It may take a different route from the solution above.

Build the reachable sets of taken desks stage by stage.

  • One student: any desk, 55 sets.
  • Two students: a desk with no neighbor always exists, so exactly the 66 pairs that are not side by side: 13,14,15,24,25,3513, 14, 15, 24, 25, 35.
  • Three students: 13,15,3513, 15, 35 each force 135135; 1414 gives 124,134,145124, 134, 145; 2424 gives 124,245124, 245; 2525 gives 125,235,245125, 235, 245. That is 77 different sets (every triple except 123,234,345123, 234, 345).
  • Four students: from each triple the newcomer takes the empty desk with fewer neighbors (either one if they tie); the desk left empty is always 22, 33 or 44, so 33 sets.
  • Five students: 11 set.

Total: 5+6+7+3+1=225 + 6 + 7 + 3 + 1 = 22.

The answer is (D) 22\boxed{\textbf{(D)}\ 22}.

Review in the AoPS books

Similar problems

Problem © Mathematical Association of America (MAA), American Mathematics Competitions. Reproduced for non-commercial educational use. Solution and commentary are original to this site.