# Answer: 32.

Solution. Let's divide the people sitting at the table into alternating groups of consecutive knights and consecutive samurais. From the condition, it follows that there are exactly 14 such groups (7 groups of knights and 7 groups of samurais), since the 7 knights mentioned in the condition are precisely the rightmost knights in the groups of knights.

Note that at least 8 knights do not sit next to two knights: these are the 7 knights mentioned in the condition and at least 1 leftmost knight in a group of more than one knight (such a group exists because there are 7 groups and 40 knights). Therefore, no more than $40-8=32$ knights sit between two knights.

Now let's provide an example. For this, we will take 6 groups of knights consisting of 1 person each and one group of 34, while the samurais can be distributed arbitrarily among 7 groups (not forgetting that the groups of knights and samurais alternate). It is clear that 32 non-edge knights from the "large" group of knights are the ones we are looking for.
Problem 9.4. At a round table, 40 knights and 10 samurais are sitting. Exactly 7 knights have a samurai as their right neighbor. What is the maximum number of knights that could be sitting next to two knights?