I think most basic codes would look like as following.
Using dynamic arrays is not the most basic way of doing things.
TS states that even TStringList isn't know in his Pascal dialect, so better stick to things that are widely supported, even in old dialects.
(IIRC then classes in Delphi were introduced before dynamic arrays.)
There are issues of whether more than one figure are allowed in one line.
This was never specified, and the original code did not cater for that possibility, which lead me to the assumption there would ever only be one numer on each line.
Also the "give me a line number and I tell you which number" in it's original wording doesn't use plural.
I do not know how to write console I/O
What about write, writeln, read, readln?
If you omit the textfile parameter, they write to stdout and read from stdin.
I would have thought that was rather basic?
Bart