Write a program (or function) (let's call it P1), that when run, outputs another program P2 of the same language and exactly 1 byte longer than P1.
Program P2 when run, should output a 3rd program P3 that's 1 byte longer than P2. P3 must output a program P4 that's one byte longer than P3, etc. The same for P5, P6, ..., P∞.
The program chain should go indefinitely, or to a place where the interpreter can't handle anymore (but must remain as a theoretically valid program in the language)
Rules
- Standard loopholes forbidden
- All programs in the chain should be in one language
- No input is given. Output goes to stdout or function return value
- The program must end after a period of time. A program that stops generating output after a certain time spot but never terminates does not qualify
The shortest program P1 in bytes in each language wins!
"puts <<2*2,2\nputs <<2*2,2\n\n2"
grows by 2 at each iteration in Ruby. I couldn't find anything better. :-/. Interesting challenge! \$\endgroup\$