# A game with numbered cards

Alice and Bob have each a number (not greater than 30) of cards numbered sequentially 1 onwards. Alice can easily reorder her cards and place them on a table one after the other so that no two cards which lie next to each other have a digit in common. On the other hand Bob, who has just one card more than Alice, has no way of placing his cards on a table likewise (no two cards lying next to each other with a shared digit), however he tries.

How many numbered cards does Alice have?

$$17$$ cards
In the first $$18$$ cards, that Bob will have, $$10$$ of those will contain the digit '$$1$$'. For any ordering, if we divide the cards into $$9$$ consecutive pairs, by the Pigeonhole Principle, there will be at least one pair which contain two cards showing the digit '$$1$$'. Hence, Bob will never be able to find a configuration that works.
On the other hand, Alice just needs to ensure all cards containing the digit '$$1$$' appear in the odd numbered positions and ensure no two cards which differ by $$10$$ are next to each other. For example, she could order them as follows, $$1, 2, 10, 3, 11, 4, 12, 5, 13, 6, 14, 7, 15, 8, 16, 9, 17$$