Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

Take a stand against long lines

Recently, someone proposed more stringent limits for Python's default line length:

Clearly, no program should ever use more than 80 characters per line, for a whole host of reasons. First and foremost, for readability and maintainability, it is important to have a solid standard, so we can adjust the width of our text editors appropriately. As a secondary benefit, code can easily be transferred onto media that may have restrictions, and where adding line-breaks can be distracting, like print pages for review in a meeting, or punch cards.

But is 80 characters too high? Some suggest 79, or even as low as 75, to allow for an 80 character wide terminal to fit the code with a few columns devoted to line numbers. Clearly, ultimately, lower is better, as lower limits allow for the code to be used in more situations without reformatting.

Introducing the max6 standard

Your goal is to find and demonstrate the minimum line length required by Your Favorite Language by writing a FizzBuzz variant with the fewest number of characters in any line.

Input

An integer, n, via any desired method.

Output

Print the numbers from 1 to n, (n ≥ 1, n ∈ Z) separated by line breaks, except:

  • for multiples of 3 print "Apple"
  • for multiples of 5 print "Pie"
  • for multiples of both 3 and 5 print "ApplePie"

Scoring

The maximum line length in bytes, not including the line break (Cr, CrLf, Lf, or other system standard break, specify, as desired), and the total code length in bytes as a tiebreaker.

Rules

All line breaks must be meaningful. Line breaks that can be removed and adjacent lines directly concatenated without an impact on the output, must be removed.

Answer*

Draft saved
Draft discarded
Cancel
6
  • \$\begingroup\$ But the longest line in the golfed version is 10 bytes If A and B \$\endgroup\$ Commented Feb 14, 2018 at 21:04
  • \$\begingroup\$ @jmarkmurphy TI-BASIC is a tokenized language, and most tokens are represented by a single byte. I mentioned that in my description of the solution. You can read more about that on this wiki. \$\endgroup\$ Commented Feb 14, 2018 at 21:07
  • \$\begingroup\$ But the premise was that editors should allow a minimum number of characters per line. I doubt that you are typing the tokens with an editor. And I don't think any of the other languages that are not purely interpreted are using a compiled object or tokenized byte count. \$\endgroup\$ Commented Feb 14, 2018 at 21:11
  • \$\begingroup\$ @jmarkmurphy actually you do type the tokens in the editor. The Ans token is 1 byte, whereas the three consecutive characters Ans are 1, 2, and 2 bytes respectively for a total of 5. It's not an ASCII string, it's literally the token when you type it on the calculator. \$\endgroup\$ Commented Feb 14, 2018 at 21:37
  • \$\begingroup\$ There's some consensus on this already on meta. \$\endgroup\$ Commented Feb 14, 2018 at 21:45

AltStyle によって変換されたページ (->オリジナル) /