Pick a quote or phrase that is exactly 5 words long, such as Programming puzzles and code golf!.

Write a program that, when appended to itself n times, outputs the first n + 1 words of your phrase in order.

For example, if your program code was MYPROG and your phrase was Programming puzzles and code golf!, running...

  • MYPROG should output Programming
  • MYPROGMYPROG should output Programming puzzles
  • MYPROGMYPROGMYPROG should output Programming puzzles and
  • MYPROGMYPROGMYPROGMYPROG should output Programming puzzles and code
  • MYPROGMYPROGMYPROGMYPROGMYPROG should output Programming puzzles and code golf!

Appending more than 4 times is undefined, your program may do anything.


  • Your phrase must be grammatical meaningful English. Ideally it should be properly capitalized and punctuated.
  • Your phrase may be any length but its entropy, as calculated by http://www.shannonentropy.netmark.pl/, may not be less than 3.5.
    (Paste in your phrase, hit Calculate and look for the last H(X).)
  • Your phrase can only contain printable ASCII characters (hex 20 to 7E). Your code can only contain printable ASCII and tabs and newlines.
  • Your phrase must contain exactly 5 unique words and 4 spaces. All non-spaces count as parts of words. Spaces are the word boundaries. They may not be leading or trailing; there should be one after all but the last word.
  • The output should contain one space between words as well. The output at each appending step may contain trailing spaces but not leading spaces.
  • Output to stdout. There is no input.


Your score is the length in bytes of your initial un-appended program. (e.g. MYPROG scores 6)

As this is code-golf, the lowest score wins.

  • 24
    \$\begingroup\$ aww, the entropy and uniqueness requirements kill my idea of "buffalo " as an entry. \$\endgroup\$
    – Sparr
    Commented Aug 3, 2014 at 5:16
  • 4
    \$\begingroup\$ I was going to have so much fun in Piet until "Your code can only contain printable ASCII and tabs and newlines." :( \$\endgroup\$
    – Sp3000
    Commented Aug 3, 2014 at 7:27
  • 3
    \$\begingroup\$ @Sp3000 You're welcome to put in an honorary answer. I'd love to see a Piet solution :) \$\endgroup\$ Commented Aug 3, 2014 at 7:32
  • 1
    \$\begingroup\$ grammatical meaningful English Too unclear what is "grammatical meaningful English" due to different interpretations of grammatical and meaningful. \$\endgroup\$
    – MilkyWay90
    Commented Jun 24, 2019 at 3:03

33 Answers 33


SmileBASIC, 54 bytes

DATA"Does"," anybody"," have"," a"," key?

I would've prefered "The sand can be eaten." but that fails the entropy test somehow. Of course I could've picked a shorter phrase but that's boring.

The READ keyword reads a value from DATA and stores it in a variable. Using READ again will get the next item, and so on.


Pyth, 27 bytes


Once, twice, thrice, four times, and five times. Appending after this begins to repeat the phrase.


Vyxal , 18 bytes


Try it Online!

Try it Online!Try it Online!

Try it Online!Try it Online!Try it Online!Try it Online!Try it Online!

`λλ⇩İλ¬×ḟɾ∷`       # `thecogandFunJoe`
            3ẇ     # Split into chunks of 3
              ¥i   # Index the register into this
                &› # Increment the register
                   # (ṡ flag) print stack  joined on spaces

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.