Company: Walmart_nov20
Difficulty: medium
The Order of Divisors Problem A deck holds the cards numbered 1, 2, ..., N . A ritual turns the deck into a list of N numbers, one step at a time: 1. If the deck is empty, stop. 2. Compute the greatest common divisor of all the numbers still in the deck. 3. Write that value down at the end of the list. 4. Remove any one card of your choosing from the deck, for good. 5. Go back to step 1. Every run of the ritual produces exactly N numbers, and the choices made in step 4 decide which numbers those are. Produce the lexicographically largest list the ritual can produce. A list a is lexicographically larger than a list b of the same length when, at the first position where they differ, a holds the larger value. Input Format A single line holding the integer N . Output Format One line with the N numbers of the largest list, separated by single spaces. Constraints 1 <= N <= 6000 (inferred: the source paper allows 10^5 , whose output exceeds the per-case output size this judge accepts) E