Challenge
Write the shortest program P such that
- P takes any positive integer n as input, and outputs a program string P1
executing P1 (with no input) outputs a program string P2,
executing P2 (with no input) outputs a program string P3,
...
- executing Pn (with no input) outputs exactly "Hello!" (without the quotes).
Schematically:
P(n) → P1 → P2 → ... → Pn → Hello!
Criteria
- I/O is via stdin/stdout.
- Program length is measured in bytes.
- Programs consist only of ASCII printable characters.
- There must be no duplicates among the programs P, P1,...,Pn.
EDIT: Programs P, P1,...,Pn are meant to be source code, and "executing the program" refers to whatever processing produces the output (i.e., interpretation, compilation & execution, etc.).