42
3
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!
Since the quine tag was added after the three current answers were posted, were you intending to forbid the quine loopholes in addition to the other ones? – Οurous – 2018-03-17T05:39:37.763
2@Οurous What??? I did not add that tag myself... – iBug – 2018-03-17T06:45:15.957
6@iBug Regardless, are submissions allowed to read their own source code? – Martin Ender – 2018-03-17T06:45:59.947
@MartinEnder What's the site's stance or general case? I did forbid it at the beginning, but I removed it during the grace period and I'm now unsure. I tend to forbit it now. – iBug – 2018-03-17T08:12:26.570
3@iBug The "quine" tag forbids it by default, and it usually makes answers more interesting to do so. It's up to you though. – Martin Ender – 2018-03-17T08:15:43.677
More restrictive challenge but highly related. – Giuseppe – 2018-03-17T10:50:51.353
1
"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! – Eric Duminil – 2018-03-17T20:17:17.370less restricted but highly related – Destructible Lemon – 2018-03-18T22:43:36.133
1
Possible duplicate of Program that creates larger versions of itself (quine-variant)
– FireCubez – 2018-12-05T15:52:53.530