Canadian Computing Competition: 2023 Stage 1, Senior #5
Alice, the mathematician, likes to study real numbers that are between and . Her favourite tool is the filter.
A filter covers part of the number line. When a number reaches a filter, two events can happen. If a number is not covered by the filter, the number will pass through. If a number is covered, the number will be removed.
Alice has infinitely many filters. Her first filters look like this:
In general, the -th filter can be defined as follows:
Alice has instructions for constructing the Cantor set. Start with the number line from to . Apply all filters on the number line, and remove the numbers that are covered. The remaining numbers form the Cantor set.
Alice wants to research the Cantor set, and she came to you for help. Given an integer , Alice would like to know which fractions are in the Cantor set.
The first line contains the integer .
The following table shows how the available 15 marks are distributed:
| Marks Awarded | Bounds on | Additional Constraints |
|---|---|---|
| 3 marks | is a power of 3 | |
| 4 marks | None | |
| 8 marks | None |
Output all integers where and is in the Cantor set.
Output the answers in increasing order. The number of answers will not exceed .
Here is a diagram of the fractions and the first filters. In reality, there are infinitely many filters.
, , and are not in the Cantor set because they were covered by the st filter.
Furthermore, and are not in the Cantor set because they were covered by the nd filter.
It can be shown that the remaining fractions will pass through all filters.
No comments yet. Be the first to comment!