Your job is to write a program that rewrites and makes itself longer on each run of the program.
The program will print
Hello, World!\n (
\n denotes a newline). Then, it will modify its own file so that the new program length is exactly 2x the length at runtime. This modified file when run, will print
Hello, World!\nHello, World!\n. When run a third time, the file will print
Hello, World!\nHello, World!\nHello, World!\nHello, World!\n.
More simply, on the
nth run of the program, it will output
2^(n-1) instances of
Hello, World!\n, and have a program length of
2^(n-1) the length of the original.
This is code-golf, so shortest code (before first run) wins. Please comment if you need something is not clear.
Edit: To get past the restriction of file-rewriting, your program may print the modified source along with the
Hello, World!\ns at a +40% penalty.