My first instinct was trial division and I started coding it up before they even finished explaining.
Clarify the problem constraints and edge cases, then propose an efficient algorithm like the Sieve of Eratosthenes with an upper bound estimate for the n-th prime. Discuss time and space complexity, and consider optimizations such as segmented sieve or wheel factorization for large n.
Pro tip: Mention that the n-th prime is approximately n * (ln n + ln ln n) for n >= 6, which helps set a tight sieve limit. Also, note that for n up to 100,000, a simple sieve is sufficient, but showing awareness of advanced methods demonstrates depth.
Ask about input range, expected output format, and handle edge cases like n=1 (first prime is 2) and n<=0 (invalid).
Select the Sieve of Eratosthenes for its simplicity and efficiency for n up to 100,000. Estimate an upper bound for the sieve using the prime number theorem.
Implement the sieve with a boolean array, marking composites. Optimize by only sieving up to sqrt(limit) and starting from p*p.
Discuss time complexity O(N log log N) and space O(N). Mention alternatives like segmented sieve for memory constraints or trial division for small n.
Test with small n (e.g., n=1, n=6) and large n (e.g., n=100,000) to ensure correctness and performance.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.