Odd GCD Permutation
You are given an integer $N$. Print a permutation of $\{1, 2, \ldots, N\}$ such that the greatest common divisor (GCD) of the numbers at odd indices is greater than the GCD of the numbers at even indices. If there are many such permutations, print the lexicographically largest permutation. More formally, find the lexicographically largest permutation $P$ such that $\text{GCD}(P_1, P_3, P_5, \ldot
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start