ŒcP€ḟ⁸ṢŒgLÞḢḢṭ 2,3Ç¡ị@
A monadic link, 1-indexed.
Try it online!
How?
ŒcP€ḟ⁸ṢŒgLÞḢḢṭ - Link 1, add the next number: list, a e.g. [2,3,6,12,18,24] Œc - unordered pairs [[2,3],[2,6],[2,12],[2,18],[2,24],[3,6],[3,12],[3,18],[3,24],[6,12],[6,18],[6,24],[12,18],[12,24],[18,24]] P€ - product of €ach [6,12,24,36,48,18,36,54,72,72,108,144,216,288,432] ⁸ - chain's left argument, a [2,3,6,12,18,24] ḟ - filter discard [36,48,36,54,72,72,108,144,216,288,432] Ṣ - sort [36,36,48,54,72,72,108,144,216,288,432] Œg - group runs of equal elements [[36,36],[48],[54],[72,72],[108],[144],[216],[288],[432]] Þ - sort by: L - length [[48],[54],[108],[144],[216],[288],[432],[36,36],[72,72]] Ḣ - head [48] Ḣ - head 48 ṭ - tack to a [2,3,6,12,18,24,48] 2,3Ç¡ị@ - Link: number, i e.g. 7 2,3 - literal [2,3] [2,3] ¡ - repeat i times: Ç - call last link (1) as a monad [2,3,6,12,18,24,48,54,96] ị@ - index into with swapped @rguments (with i) 48