Find divisors in pairs
Replace a full scan with an integer-safe square-root boundary.
Understand the idea
For positive n, each divisor d has partner n/d. At least one member of a pair is at most √n, so test d while d ≤ n/d. Process the partner only when it differs from d, avoiding a duplicated square root.
Trace a small example
For 36, the pairs are (1,36), (2,18), (3,12), (4,9), (6,6). Its nine divisors are 1, 2, 3, 4, 6, 9, 12, 18, 36. To output them sorted, collect small divisors and large partners separately, then reverse the large list.
Conditions and cost
The scan costs O(√n), plus output work. n/d avoids overflow in d*d; d starts at 1. The input 1 has one positive divisor and no positive proper divisors. Zero does not have a finite positive-divisor list.
Why process n/d only when it differs from d?
Turn the idea into code
List the divisors of 18 in increasing order.
Give me a hint
Find pairs using d = 1 through 4.
Show the explained solution
Pairs (1,18), (2,9), (3,6) yield 1, 2, 3, 6, 9, 18.
Your notes
Mark complete when you can explain it yourself.