168

43

Introduction

In our recent effort to collect catalogues of shortest solutions for standard programming exercises, here is PPCG's first ever vanilla FizzBuzz challenge. If you wish to see other catalogue challenges, there is "Hello World!" and "Is this number a prime?".

Challenge

Write a program that prints the decimal numbers from 1 to 100 inclusive. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.

Output

The output will be a list of numbers (and Fizzes, Buzzes and FizzBuzzes) separated by a newline (either \n or \r\n). A trailing newline is acceptable, but a leading newline is not. Apart from your choice of newline, the output should look exactly like this:

1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
16
17
Fizz
19
Buzz
Fizz
22
23
Fizz
Buzz
26
Fizz
28
29
FizzBuzz
31
32
Fizz
34
Buzz
Fizz
37
38
Fizz
Buzz
41
Fizz
43
44
FizzBuzz
46
47
Fizz
49
Buzz
Fizz
52
53
Fizz
Buzz
56
Fizz
58
59
FizzBuzz
61
62
Fizz
64
Buzz
Fizz
67
68
Fizz
Buzz
71
Fizz
73
74
FizzBuzz
76
77
Fizz
79
Buzz
Fizz
82
83
Fizz
Buzz
86
Fizz
88
89
FizzBuzz
91
92
Fizz
94
Buzz
Fizz
97
98
Fizz
Buzz


The only exception to this rule is constant output of your language's interpreter that cannot be suppressed, such as a greeting, ANSI color codes or indentation.

Further Rules

• This is not about finding the language with the shortest approach for playing FizzBuzz, this is about finding the shortest approach in every language. Therefore, no answer will be marked as accepted.

• Submissions are scored in bytes in an appropriate preexisting encoding, usually (but not necessarily) UTF-8. Some languages, like Folders, are a bit tricky to score--if in doubt, please ask on Meta.

• Nothing can be printed to STDERR.

• Feel free to use a language (or language version) even if it's newer than this challenge. If anyone wants to abuse this by creating a language where the empty program generates FizzBuzz output, then congrats for paving the way for a very boring answer.

Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language.

• If your language of choice is a trivial variant of another (potentially more popular) language which already has an answer (think BASIC or SQL dialects, Unix shells or trivial Brainfuck derivatives like Alphuck and ???), consider adding a note to the existing answer that the same or a very similar solution is also the shortest in the other language.

• Because the output is fixed, you may hardcode the output (but this may not be the shortest option).

• You may use preexisting solutions, as long as you credit the original author of the program.

• Standard loopholes are otherwise disallowed.

As a side note, please don't downvote boring (but valid) answers in languages where there is not much to golf; these are still useful to this question as it tries to compile a catalogue as complete as possible. However, do primarily upvote answers in languages where the authors actually had to put effort into golfing the code.

Catalogue

var QUESTION_ID=58615;var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";var COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk";var OVERRIDE_USER=30525;var answers=[],answers_hash,answer_ids,answer_page=1,more_answers=true,comment_page;function answersUrl(index){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+index+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(index,answers){return"https://api.stackexchange.com/2.2/answers/"+answers.join(';')+"/comments?page="+index+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:true,success:function(data){answers.push.apply(answers,data.items);answers_hash=[];answer_ids=[];data.items.forEach(function(a){a.comments=[];var id=+a.share_link.match(/\d+/);answer_ids.push(id);answers_hash[id]=a});if(!data.has_more)more_answers=false;comment_page=1;getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:true,success:function(data){data.items.forEach(function(c){if(c.owner.user_id===OVERRIDE_USER)answers_hash[c.post_id].comments.push(c)});if(data.has_more)getComments();else if(more_answers)getAnswers();else process()}})}getAnswers();var SCORE_REG=/<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;var OVERRIDE_REG=/^Override\s*header:\s*/i;function getAuthorName(a){return a.owner.display_name}function process(){var valid=[];answers.forEach(function(a){var body=a.body;a.comments.forEach(function(c){if(OVERRIDE_REG.test(c.body))body='<h1>'+c.body.replace(OVERRIDE_REG,'')+'</h1>'});var match=body.match(SCORE_REG);if(match)valid.push({user:getAuthorName(a),size:+match[2],language:match[1],link:a.share_link,});else console.log(body)});valid.sort(function(a,b){var aB=a.size,bB=b.size;return aB-bB});var languages={};var place=1;var lastSize=null;var lastPlace=1;valid.forEach(function(a){if(a.size!=lastSize)lastPlace=place;lastSize=a.size;++place;var answer=jQuery("#answer-template").html();answer=answer.replace("{{PLACE}}",lastPlace+".").replace("{{NAME}}",a.user).replace("{{LANGUAGE}}",a.language).replace("{{SIZE}}",a.size).replace("{{LINK}}",a.link);answer=jQuery(answer);jQuery("#answers").append(answer);var lang=a.language;lang=jQuery('<a>'+lang+'</a>').text();languages[lang]=languages[lang]||{lang:a.language,lang_raw:lang.toLowerCase(),user:a.user,size:a.size,link:a.link}});var langs=[];for(var lang in languages)if(languages.hasOwnProperty(lang))langs.push(languages[lang]);langs.sort(function(a,b){if(a.lang_raw>b.lang_raw)return 1;if(a.lang_raw<b.lang_raw)return-1;return 0});for(var i=0;i<langs.length;++i){var language=jQuery("#language-template").html();var lang=langs[i];language=language.replace("{{LANGUAGE}}",lang.lang).replace("{{NAME}}",lang.user).replace("{{SIZE}}",lang.size).replace("{{LINK}}",lang.link);language=jQuery(language);jQuery("#languages").append(language)}}
body{text-align:left!important}#answer-list{padding:10px;width:290px;float:left}#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="language-list"> <h2>Shortest Solution by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr> </thead> <tbody id="languages"> </tbody> </table> </div> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr> </thead> <tbody id="answers"> </tbody> </table> </div> <table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr> </tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr> </tbody> </table>

1Nothing can be printed to STDERR. Is this true only when running, or also when compiling (assuming that is a separate step?) – AShelly – 2015-09-24T20:47:43.363

@AShelly Only when running – Beta Decay – 2015-09-24T20:48:06.640

I’m not sure I like the fact that you hardcoded the 100 into the challenge. That way, a program that just generates the expected output is a valid entry, but is not interesting for this challenge. I think the challenge should expect the program to input the number of items to output. – Timwi – 2015-09-24T23:28:17.400

9@Timwi While I agree that it would make it (only slightly) more interesting, I've very often seen FizzBuzz as strictly 1 to 100 (on Wikipedia and Rosetta Code, for example). If the goal is to have a "canonical" FB challenge, it makes sense. – Geobits – 2015-09-25T00:50:36.917

TI-BASIC's Disp outputs strings left-justified and numbers right-justified. Is that acceptable? – lirtosiast – 2015-09-25T03:54:16.040

@ThomasKwa Yes, I would think so – Beta Decay – 2015-09-25T05:47:32.010

65A "vanilla fizzbuzz" sounds delicious. – Reinstate Monica -- notmaynard – 2015-09-25T15:12:09.853

QBasic outputs numbers with a leading space. Is that acceptable? (Workaround costs 14 bytes.) – DLosc – 2015-09-27T21:27:58.193

What is that code snippet at the end of your answer? Is it automatically scrapping the page for answers? – David says Reinstate Monica – 2015-09-28T17:44:08.520

@DavidGrinberg Yep, it gets the answers and puts them into the leaderboard :) – Beta Decay – 2015-09-28T17:45:21.783

I can always add my Shakespearian reply, but since it barely counts as a "golfed code" (and SPL is nearly impossible to golf), perhaps it's best not to.

– Rodolfo Dias – 2015-12-03T12:19:14.723

Related: High throughput Fizz Buzz for a version of this where performance is the winning condition, not code-size.

– Peter Cordes – 2021-02-16T02:19:39.177

93

Hexagony, 91 bytes

Thanks for the bounty :)

Wow, I would never have imagined I could beat Martin’s Hexagony solution. But—who would have thunk it—I got it done. After several days of failure because I neither had the Hexagony colorer nor the EsotericIDE to check my solution. I got several aspects of the specification wrong, so I produced a few wrong “solutions” just using pen and paper and a text editor. Well, finally I overcame my laziness and cloned both repositories, downloaded VisualStudio and compiled them. Wow, what useful tools they are! As you can see, I am far from being someone you’d call a programmer (I mean, come on! I didn’t even have VisualStudio installed, and have pretty much no clue about how to compile a program) ;)

It still took me a while to find a working solution, and it is quite crammed and chaotic, but here it is in all its glory:

Fizzbuzz in a size 6 hexagon:

3}1"$.!$>)}g4_.{$'))\<$\.\.@\}F\$/;z;u;<%<_>_..$>B/<>}))'%<>{>;e"-</_%;\/{}/>.\;.z;i;..>(('


Hexagonal layout:

      3 } 1 " $. !$ > ) } g 4
_ . { $' ) ) \ <$ \ . \ . @ \ }
F \ $/ ; z ; u ; < % < _ > _ . .$ > B /
< > } ) ) ' % < > {
> ; e " - < / _ %
; \ / { } / > .
\ ; . z ; i ;
. . > ( ( '


And the beautiful rendition, thanks to Timwi’s Hexagony Colorer:

So, here is a 110 seconds long GIF animation at 2 fps, showing the program flow during the first 6 numbers 1, 2, Fizz, 4, Buzz, Fizz, the first 220 ticks of the program (click on the image for the full size):

My goodness, thanks to the Natron compositing software the animation of the pointer was still tedious to create, but manageable. Saving 260 images of the memory was less amusing. Unfortunately EsotericIDE can’t do that automatically. Anyways, enjoy the animation!

After all, once you wrap your head around the memory model and the rather counterintuitive wrapping of paths that cross the borders of the hexagon, Hexagony is not that hard to work with. But golfing it can be a pain in the butt. ;)

It was fun!

1Very nice! :) That's what I get for forgetting to try side-length 6 myself. ;) (Would be interesting to see if my solution fits into side-length 6 more easily though.) – Martin Ender – 2016-03-06T09:45:08.770

@MartinBüttner I would love to see it :) – M L – 2016-03-06T16:56:44.507

2I am less of a programmer than you, because what is Visual Studio? :P – Rɪᴋᴇʀ – 2016-03-10T02:42:22.240

5Unfortunately EsotericIDE can’t do that automatically. — Please go right ahead and file a feature suggestion, I might get around to doing that some day :) – Timwi – 2016-03-10T13:22:07.093

2(oops this comes up after 6 months of last reply) You may golf off 1 byte from the end of the program by shifting the grey path by 1 byte and placing a "Cancelling op" in the orange path like 3}1"$.!$>)}g4_'{$))}\<$\.\.@\;F\$/;z;u;<%<_>_..$>B/<>}))'%<>{>;e"-</_%;\/{}/>.\)(z;i;..>('.Now there is an extra ( after the z, which can be "cancelled" with a ) or by putting the z there. Now it is a ) which pushes all commands on the orange path 1 tick later, and got back with the no-op that was on line 3. Btw I also installed Visual Studio just due to Hexagony Colorer and Esoteric IDE :P – Sunny Pun – 2016-10-14T03:50:57.843

83

Python 2, 56 bytes

i=0;exec"print i%3/2*'Fizz'+i%5/4*'Buzz'or-~i;i+=1;"*100


Try it online!

8Dang, that's bloody genius. Can I steal your idea to multiply the string by the mod-result? – AdmBorkBork – 2015-09-24T20:01:15.500

1@TimmyD Go ahead. – feersum – 2015-09-24T20:06:59.743

17

A different method for 56 (from here): i=1;exec"print'FizzBuzz'[i%-3&4:12&8-i%5]or i;i+=1;"*100. Anyone want to brute force search expressions to try to optimize the bit bashing?

– xnor – 2015-09-25T05:35:22.123

@ETHproductions It does.

– Ben Fortune – 2015-09-25T09:50:36.227

May I also steal your mod trick for a Ruby answer? – Reinstate Monica -- notmaynard – 2015-09-25T15:39:36.577

1Very nice technique, I love the division of the modulo result to make it binary! I have an improvement to get your method down to 54 chars... Of course I wouldn't post it as an answer without your permission (since it's ~95% your answer) ;) – Tersosauros – 2016-03-06T13:09:57.500

2@Tersosauros Go ahead... my method is not very hard to find and has no doubt been independently discovered by many people. – feersum – 2016-03-06T21:16:54.057

@MickyT What? That's 91 bytes long and not even valid, as it would only work in a REPL. – feersum – 2016-03-17T04:00:32.467

My closest was 169 bytes: for x in range(1,101):m={0:'Fizz'}.get(x%3,'')+{0:'Buzz'}.get(x%5,'');print(m if m else x) – teepee – 2020-11-10T23:43:13.787

Total genius. The use of modulo to convert to binary. Still wrapping my brain around the solution. Awesome work. – Joe Ferndz – 2020-12-26T05:51:54.197

It also works and comes out to 56 without the exec magic and the multiplied string, using a normal loop instead: for i in range(100):print i%3/2*'Fizz'+i%5/4*'Buzz'or-~i. – jaaq – 2021-01-20T08:38:13.617

Can someone please explain how this actually works? – Parseltongue – 2021-02-09T06:04:35.113

48

Labyrinth, 94 bytes

"):_1
\ } 01/3%70.105
" :   @ "     .
"  =";_""..:221
+  _
"! 5%66.117
_:= "     .
="*{"..:221


Sub-100! This was a fun one.

Explanation

Let's start with a brief primer on Labyrinth – feel free to skip this if you're already familiar with the basics:

• Labyrinth has two stacks – a main stack and an auxiliary stack. Both stacks have an infinite number of zeroes at the bottom, e.g. + on an empty stack adds two zeroes, thus pushing zero.

• Control flow in Labyrinth is decided by junctions, which look at the top of the stack to determine where to go next. Negative means turn left, zero means go straight ahead and positive means turn right... but if we hit a wall then we reverse direction. For example, if only straight ahead and turn left are possible but the top of the stack is positive, then since we can't turn right we turn left instead.

• Digits in Labyrinth pop x and push 10*x + <digit>, which makes it easy to build up large numbers. However, this means that we need an instruction to push 0 in order to start a new number, which is _ in Labyrinth.

Now let's get to the actual code!

Red

Execution starts from the " in the top-left corner, which is a NOP. Next is ), which increments the top of the stack, pushing 1 on the first pass and incrementing n on every following pass.

Next we duplicate n with :. Since n is positive, we turn right, executing } (shift top of main stack to auxiliary) and :. We hit a dead end, so we turn around and execute } and : once more, leaving the stacks like

Main [ n n | n n ] Aux


Once again, n is positive and we turn right, executing _101/ which divides n by 101. If n is 101 then n/101 = 1 and we turn into the @, which terminates the program. Otherwise, our current situation is

Main [ n 0 | n n ] Aux


Orange 1 (mod 3)

3 turns the top zero into a 3 (10*0 + 3 = 3) and % performs a modulo. If n%3 is positive, we turn right into the yellow ". Otherwise we perform 70.105.122:.., which outputs Fizz. Note that we don't need to push new zeroes with _ since n%3 was zero in this case, so we can exploit the infinite zeroes at the bottom of the stack. Both paths meet up again at light blue.

Light blue

The top of the stack is currently n%3, which could be positive, so the _; just pushes a zero and immediately pops it to make sure we go straight ahead, instead of turning into the @. We then use = to swap the tops of the main and auxiliary stacks, giving:

Main [ n | n%3 n ] Aux


Orange 2 (mod 5)

This is a similar situation to before, except that 66.117.122:.. outputs Buzz if n%5 is zero.

Dark blue

The previous section leaves the stacks like

Main [ n%5 | n%3 n ] Aux


{ shifts the n%3 back to the main stack and * multiplies the two modulos.

If either modulo is zero, the product is zero so we go straight into yellow. = swaps the top of the stacks and _ pushes a zero to make sure we go straight ahead, giving

Main [ n 0 | 0 ] Aux


Otherwise, if both modulos are nonzero, then the product is nonzero and we turn right into green. = swaps the tops of the stacks, giving

Main [ n | (n%5)*(n%3) ] Aux


after which we use : to duplicate n, turn right, then use ! to output n.

Purple

At this point, the main stack has either one or two items, depending on which path was taken. We need to get rid of the zero from the yellow path, and to do that we use +, which performs n + 0 in some order for both cases. Finally, \ outputs a newline and we're back at the start.

Each iteration pushes an extra (n%5)*(n%3) to the auxiliary stack, but otherwise we do the same thing all over again.

8Loving the explanation. – The_Basset_Hound – 2015-09-27T23:08:33.557

31

Perl 5, 49 bytes

46 bytes script + 3 bytes -E"..."

Using say (which requires -E"...") can reduce this further to 46 bytes since say automatically includes a newline (Thanks @Dennis!):

\b(_{5})+$Bu; ;_* zz '_&.  Try it online! Explanation .100{^ _  The . is the global silent flag which turns off implicit output at the end of the program. 100{ wraps the rest of the program in a loop which is executed for 100 iterations. Finally, the stage itself just inserts a _ at the beginning of the string, which effectively increments a unary loop counter. *\(a(___)+ Fi;$&


More configuration. *\( wraps the remainder of the program in a group, prints its result with a trailing linefeed, but also puts the entire group in a dry run, which means that its result will be discarded after printing, so that our loop counter isn't actually modified. a is a custom regex modifier which anchors the regex to the entire string (which saves a byte on using ^ and $ explicitly). The atomic stage itself takes care of Fizz. Divisibility by 3 can easily be checked in unary: just test if the number can be written as a repetition of ___. If this is the case, we prepend Fi; to the string. The semicolon is so that there is still a word boundary in front of the number for the next stage. If we turned the line into Fizz___... the position between z and _ would not be considered a boundary, because regex treats both letters and underscores as word characters. However, the semicolon also allows us to remove the zz duplication from Fizz and Buzz. \b(_{5})+$
Bu;


We do the exact same for divisibility by 5 and Bu;, although we don't need to keep the _s around this time. So we would get a results like

_
__
Fi;___
____
Bu;
Fi;______
...
Fi;Bu;
...


This makes it very easy to get rid of the underscores only in those lines which contain Fizz, while also filling in the zzs:

;_*
zz


That is, we turn each semicolon into zz but we also consume all the _s right after it. At this point we're done with FizzBuzz in unary. But the challenge wants decimal output.

'_&.


& indicates a conditional: this stage is only executed if the string contains an underscore. Therefore, Fizz, Buzz and FizzBuzz iterations are left untouched. In all other iterations (i.e. those which are neither divisible by 3 nor 5), we just count the number of characters, converting the result to decimal.

21

beeswax, 10489 81 bytes

Denser packing allowed for cutting off 8 more bytes.

Shortest solution (81 bytes), same program flow, different packing.

p?@<
p?{@b'gA<
p@zzuBd'%~5F@<fz<
>~P"#"_"1F3~%'dFizb
d;"-~@~.<
>?N@9P~0+d


Changing the concept enabled me to cut down the code by 15 bytes. I wanted to get rid of the double mod 5 test in the solution, so I implemented a flag.

Short explanation:

if n%3=0 Fizz gets printed, and the flag gets set. The flag is realized simply by pushing the top lstack value onto the gstack (instruction f).

If n%5=0, then either n%3=0(FizzBuzz case) or n%3>0(Buzz case). In both cases, Buzz gets printed, and the flag reset by popping the stack until it’s empty (instruction ?).

Now the interesting cases:

If n%5>0, then either we had n%3=0 (printing Fizz case, n must not be printed) or n%3>0 (Fizz was not printed, so n has to be printed). Time to check the flag. This is realized by pushing the length of gstack on top of gstack (instruction A). If n%3 was 0 then the gstack length is >0. If n%3 was >0, the gstack length is 0. A simple conditional jump makes sure n gets only printed if the length of gstack was 0.

Again, after printing any of n, Fizz, and/or Buzz and the newline, the gstack gets popped twice to make sure it’s empty. gstack is either empty [], which leads to [0] after instruction A (push length of gstack on gstack), or it contains one zero ([0],the result of n%3), which leads to [0 1], as [0] has the length 1. Popping from an empty stack does not change the stack, so it’s safe to pop twice.

If you look closer you can see that, in principle, I folded

>      q
dFizzf>


into

<fz<
dFizb


which helps to get rid of the all the wasted space between A and < at the end of the following row in the older solution below:

q?{@b'gA<       p      <


New concept solution (89 bytes) including animated explanation:

q?@ <
q?{@b'gA<       p      <
p?<@zzuBb'%~5F@<fzziFb'<
>N@9P~0+.~@~-";~P"#"_"1F3~%d


Hexagonal layout:

   q ? @   <
q ? { @ b ' g A <               p             <
p ? < @  z z u B  b ' % ~ 5 F @ < f  z z i F  b ' <
> N @ 9 P ~ 0 + . ~ @ ~ - " ; ~ P " # " _ " 1 F 3 ~ % d


Animation of the first 326 ticks at 2 fps, with local and global stacks, and output to STDOUT.

For comparison, below are the path overlays of the older, more complex solution. Maybe it’s also the prettier solution, from a visual standpoint ;)

3This is as crazy and beautiful as Hexagony. Have a +1! – ETHproductions – 2016-02-26T17:08:59.133

@ETHproductions I still need to give Hexagony a try, but from what I can tell from the language specs, my beeswax doesn’t even come close to the craziness of Hexagony. – M L – 2016-02-26T17:17:50.660

– M L – 2016-12-03T20:53:54.300

How are you making those animations? – baordog – 2018-08-19T03:32:04.540

20

Perl 5, 45 bytes

say((Fizz)[$_%3].(Buzz)[$_%5]or$_)for+1..100  Requires the -E option, counted as one. This must be run from the command line, i.e.: perl -Esay((Fizz)[$_%3].(Buzz)[$_%5]or$_)for+1..100


Quotes around the command are unnecessary, if one avoids using spaces, or any other characters which can act as command line separators (|, <, >, &, etc.).

Perl 5, 48 bytes

print+(Fizz)[$_%3].(Buzz)[$_%5]||$_,$/for 1..100


If command line options are counted as one each, -l would save one byte (by replacing $/). By Classic Perlgolf Rules, however, this would count 3: one for the -, one for the l, and one for the necessary space. You can use say, with the -E switch, which has edit distance 1 to -e, so it should count as 1 byte. – Dennis – 2015-09-25T06:24:24.970 Hey primo, I feel like I'm cheating in my answer for using say, I've assumed that -E can be used in place of -e which would bring you down to 44 rather than 46. I don't think it's fair that I'm scoring differently to you, what's the preferred scoring mechanism? I generally use print to avoid this! Closest to a consensus would be this? – Dom Hastings – 2015-09-25T16:15:50.530 My personal take is that every additional byte on the command line should score 1. In particular for say, if your code can be written on one line avoiding any OS separators, score 1 for -E. If you need to use quotes, e.g. -E"$a||$b", score 3. If you can't get it on one line, score 5 for -M5.01. But at that point you'd probably be better off using -l. I don't agree that it should be free by default, for two reasons: 1) the improvement is trivial and uninteresting, and 2) there is no version of the interpreter for which it is enabled by default. – primo – 2015-09-25T16:39:16.497 19 gs2, 28 27 (without f) Hex: 1b 2f fe cc 04 46 69 7a 7a 09 07 42 75 7a 7a 19 06 27 2d d8 62 32 ec 99 dc 61 0a  Explanation: 1b 100 2f range1 (1..n) fe m: (map rest of program) cc put0 (pop and store in register 0) 04 string-begin Fizz 09 9 07 string-separator Buzz 19 25 06 string-end-array (result: ["Fizz"+chr(9) "Buzz"+chr(25)]) 27 right-uncons 2d sqrt d8 tuck0 (insert value of register 0 under top of stack) 62 divides 32 times (string multiplication) ec m5 (create block from previous 5 tokens, then call map) 99 flatten dc show0 (convert register 0 to string and push it) 61 logical-or 0a newline  Embedding 3 and 5 into the string constant doesn't work because \x05 ends string literals. Note: This problem can be solved in 1 byte with gs2 using the built-in f. 18 ><>, 686665 64 bytes 1\2+2foooo "Buzz"< o>:::3%:?!\$5%:?!/*?n1+:aa*)?;a
o.!o"Fizz"/oo


The only trick is to multiply remainders as a condition to number printing. That way, if one of them is 0 we won't print the number.

You can try it here.

Saved one byte thanks to Sp3000 and another thanks to randomra. Many thanks!

1Very well golfed, I love the reuse of the "" on the first line and the one on the second line. – cole – 2015-09-25T22:59:03.020

1-1 byte if you move the o at end of the second line to the empty space at the start of the line, I believe. – Sp3000 – 2015-09-26T00:55:33.183

@Sp3000 Indeed, I spent so much time golfing this I don't know how this did not come to mind – Aaron – 2015-09-27T11:28:10.223

1Who needs fizz buzz when you can have foooo Buzz? – caird coinheringaahing – 2017-09-04T20:46:17.337

18

Jelly, 24 20 bytes

³µ3,5ḍTị“¡Ṭ4“Ụp»ȯµ€G


Try it online!

How it works

³µ3,5ḍTị“¡Ṭ4“Ụp»ȯµ€G  Main link. No input.

³                     Yield 100.
µ                    Begin a new, monadic chain.
µ€   Apply the preceding chain to all integers n in [1, ..., 100].
3,5ḍ                Test n for divisibility by 3 and 5.
T               Get all truthy indices.
This yields [1] (mult. of 3, not 5), [2] (mult. of 5, not 3),
[1, 2] (mult. of 15) or [].
“¡Ṭ4“Ụp»      Yield ['Fizz', 'Buzz'] by indexing in a dictionary.
ị              Retrieve the strings at the corr. indices.
ȯ     Logical OR hook; replace an empty list with n.
G  Grid; join the list, separating by linefeeds.


1again nobody out golfed dennis (except for the HQ9+ style answer) – noɥʇʎԀʎzɐɹƆ – 2016-07-17T17:08:30.233

@noɥʇʎԀʎzɐɹƆ but now they have. – Lyxal – 2020-08-31T04:08:55.450

µ€ is now known as ), saving a byte. – Lynn – 2020-09-30T10:17:12.637

2@Lyxal It seems that you're right... ^ Lynn has out golfed Dennis in the comment above. – None – 2020-11-16T09:21:22.757

18

ArnoldC, 842 bytes

IT'S SHOWTIME
HEY CHRISTMAS TREE a
YOU SET US UP 100
HEY CHRISTMAS TREE b
YOU SET US UP 0
HEY CHRISTMAS TREE r
YOU SET US UP 0
STICK AROUND a
GET TO THE CHOPPER b
HERE IS MY INVITATION 101
GET DOWN a
ENOUGH TALK
GET TO THE CHOPPER r
HERE IS MY INVITATION b
I LET HIM GO 15
ENOUGH TALK
BECAUSE I'M GOING TO SAY PLEASE r
GET TO THE CHOPPER r
HERE IS MY INVITATION b
I LET HIM GO 3
ENOUGH TALK
BECAUSE I'M GOING TO SAY PLEASE r
GET TO THE CHOPPER r
HERE IS MY INVITATION b
I LET HIM GO 5
ENOUGH TALK
BECAUSE I'M GOING TO SAY PLEASE r
TALK TO THE HAND b
BULLSHIT
TALK TO THE HAND "Buzz"
YOU HAVE NO RESPECT FOR LOGIC
BULLSHIT
TALK TO THE HAND "Fizz"
YOU HAVE NO RESPECT FOR LOGIC
BULLSHIT
TALK TO THE HAND "FizzBuzz"
YOU HAVE NO RESPECT FOR LOGIC
GET TO THE CHOPPER a
HERE IS MY INVITATION a
GET DOWN 1
ENOUGH TALK
CHILL
YOU HAVE BEEN TERMINATED


First try at golfing, I think this is as bad as it gets (both language and golfing).

2YOU HAVE NO RESPECT FOR LOGIC lol, this is a great language ;) – ETHproductions – 2016-03-10T17:39:14.033

1Hahahaha!!! You should've made it a method, worse bytecount, better phrases ;). – Magic Octopus Urn – 2016-10-13T17:46:32.550

17

brainfuck, 206 bytes

++>+++++>>>>>++++++++++[>+>>+>>+>+<<<[++++<-<]<,<,-<-<++<++++[<++>++++++>]++>>]>
[+[[<<]<[>>]+++<[<.<.<..[>]]<<-[>>>[,>>[<]>[--.++<<]>]]+++++<[+[-----.++++<<]>>+
..<-[>]]<[->>,>+>>>->->.>]<<]<[>+<<<,<->>>+]<]


Formatted:

++>+++++>>>>>
++++++++++[>+>>+>>+>+<<<[++++<-<]<,<,-<-<++<++++[<++>++++++>]++>>]
>
[
+
[
[<<]
<[>>]
+++<
[
Fizz
<.<.<..
[>]
]
<<-
[
>>>
[
,>>[<]
>[--.++<<]
>
]
]
+++++<
[
Buzz
+[-----.++++<<]
>>+..
<-
[>]
]
<[->>,>+>>>->->.>]
<<
]
<[>+< <<,<->>>+]
<
]


Try it online

The memory layout is

0 a 122 105 70 b f 0 t d1 s d2 c d 10 0


where f cycles by 3, b cycles by 5, d1 is ones digit, d2 is tens digit, s is a flag for whether to print tens digit, d cycles by 10, c is copy space for d, t is working space that holds 0 or junk data or a flag for not-divisible-by-3, and a determines program termination by offsetting the pointer after Buzz has been printed 20 times.

17

MUMPS, 56 54 bytes

f i=1:1:100 w:i#5=0 "Fizz" w:i#3=0 "Buzz" w:$X<3 i w !  What's this w:$X<3 i thing, you ask? $X is a magic variable (an "intrinsic") that stores the horizontal position of the output cursor (as a number of characters from the left edge of the terminal). w is the abbreviated form of the WRITE command. The syntax command:condition args is a postconditional - "if condition, then do command args". So we're checking whether the output cursor has been advanced more than two characters (which would mean that at least one of "Fizz" or "Buzz" has been written to the terminal), and if not, writing i to the terminal. The $X variable - and hence, this sort of deep inseparability from the terminal - is a first-class feature of MUMPS. Yikes.

17

C, 85 bytes

i;main(){for(;i++<=99;printf("%s%s%.d\n",i%3?"":"Fizz",i%5?"":"Buzz",(i%3&&i%5)*i));}


-2 thanks to squeamish.

Trying to compile here but gcc doesnt recognize the new line inside the string as \n. It gives me a compiling error. Do I need to pass any parameter to the compiler? BTW, you missed the <= in your post (I counted 88 bytes with <= ... so im assuming it is missing). – wendelbsilva – 2015-09-24T20:57:37.627

1oops. missed the error in the warnings. Adds 2 chars. – AShelly – 2015-09-24T21:01:54.840

1Global variables are initialized to zero, so instead of main(i), try i;main(). Then you can get rid of the i-- at the start of the for() loop. You don't need the line break either. That should bring the byte count down to 85. – r3mainer – 2015-09-24T22:36:52.350

Thanks. (I wasn't counting the newline, just inserted for readability.) – AShelly – 2015-09-24T22:44:54.667

Found a way to shave one more byte: main(i){for(;printf("%s%s%.d\n",i%3?"":"Fizz",i%5?"":"Buzz",(i%3&&i%5)*i),99/i++;);} – Tob Ernack – 2015-09-25T04:48:11.957

So it should be 84 bytes now. (I wanted to add this to my other comment but edit timed out) – Tob Ernack – 2015-09-25T04:58:00.623

1printf(i%5?i%3?"%d\n":"Fizz\n":i%3?"Buzz\n":"FizzBuzz\n",i) saves another byte, can be combined with @TobErnack's comment. – hvd – 2015-09-26T16:58:07.293

2

Depending on how UB you want to get, you can do 73, 74, or 75 bytes. Here's my 74 byte answer.

– Lynn – 2015-09-27T16:44:44.740

Feel like there is something you can do with the double "zz" in fizz and buzz haha – Albert Renshaw – 2015-09-30T05:34:03.997

1OMG I spent maybe 3 hours trying to get this thing just one byte smaller. Here you go. Replace (i%3&&i%5)*i with i%3*i%5?i:0 I'm going to bed – Albert Renshaw – 2015-09-30T10:24:59.053

17

Scratch, 203 185 bytes

Bytes counted from the golfed textual representation, per this meta post. Scratch is not very space-efficient.

say is the closest thing to a stdout Scratch has: the sprite displays a speech bubble containing whatever it is saying. In practice, a wait n secs block would be needed to actually read this output, but for the purposes of this challenge this code fulfills the requirements.

You're missing numbers after the y = (in both occurrences) – Beta Decay – 2015-10-28T10:29:12.577

@BetaDecay Sorry? I don't follow. – timothymh – 2015-10-28T14:33:08.583

Inside the repeat loop, the set y to ... is missing a value – Beta Decay – 2015-10-28T17:04:57.353

1@BetaDecay That's the empty string. :) if you click on the image, you can view it in action! – timothymh – 2015-10-28T17:12:16.043

Ohhh haha sorry for doubting you ;) – Beta Decay – 2015-10-28T17:22:04.540

1Nice one. I've never seen a Scratch solution before. :) – HyperNeutrino – 2016-03-07T03:01:07.637

1Never thought Scratch solution will show up here. So awesome to see this. Great work @timothymh – Joe Ferndz – 2020-12-26T05:50:47.257

17

JavaScript, 62 bytes

for(i=0;++i<101;console.log(i%5?f||i:f+'Buzz'))f=i%3?'':'Fizz'


I think I this is the shortest Javascript solution now.

1Wow, just wow! But all the other JS answers use console.log; it's much less annoying than having to press "OK" on 100 pop-up boxes in a row. Could you please change this? It'll only be 62 bytes, still three better than mine. – ETHproductions – 2015-11-15T03:04:02.363

I'll have to do so tomorrow, as I have already edited 5 of my own posts and can't edit anymore... – Mama Fun Roll – 2015-11-15T05:16:36.000

2Oh, I didn't realise there was a limit to editing... – ETHproductions – 2015-11-15T18:48:42.617

So if I found a shorter answer that's similar to this, do I edit this or post a new answer? (it still uses console.log) – Samathingamajig – 2020-10-26T02:44:08.717

16

CJam, 35 bytes

100{)_[Z5]f%:!"FizzBuzz"4/.*s\e|N}/


Try it online in the CJam interpreter.

How it works

100{)_[Z5]f%:!"FizzBuzz"4/.*s\e|N}/
100{                             }/  For each integer I between 0 and 99:
)_                                 Increment I and push a copy.
[Z5]                             Push [3 5].
f%                           Map % to push [(I+1)%3 (I+1)%5].
:!                         Apply logical NOT to each remainder.
"FizzBuzz"4/             Push ["Fizz" "Buzz"].
.*           Vectorized string repetition.
s\         Flatten the result and swap it with I+1.
e|       Logical OR; if s' pushed an empty string,
replace it with I+1.
N      Push a linefeed.


3More straightforward solution: 100{):I3%!"Fizz"*I5%!"Buzz"*+Ie|N}/ – aditsu quit because SE is EVIL – 2015-09-30T14:12:31.137

16

C#, 128126125 124 bytes

class A{static void Main(){for(var i=0;i++<100;)System.Console.Write("{0:#}{1:;;Fizz}{2:;;Buzz}\n",i%3*i%5>0?i:0,i%3,i%5);}}


89 bytes without the boilerplate code around.

Done with the use of C#'s conditional formatting.

With two section separators ;, Fizz or Buzz are printed if the value from their condition is zero.

Saved a total of 4 bytes thanks to @RubberDuck, @Timwi and @Riokmij.

It would be shorter to call Write and append the newline directly to the string, right? – RubberDuck – 2015-09-24T23:26:31.107

It’s also one byte shorter to write i%3*i%5>0?i:0 instead of i%3*i%5==0?0:i. – Timwi – 2015-09-24T23:31:25.057

You can save another byte on the for statement by using for(var i=0;i++<100;) – Najkin – 2015-09-25T08:08:34.250

@LegionMammal978 No, it cannot, it would hide the i only on multiple of 15, instead of 3, 5 and 15.. You can try it. – Pierre-Luc Pineault – 2015-09-26T03:07:52.917

This skips number 1. Start form i=0. – Hand-E-Food – 2015-09-28T01:01:53.103

@Hand-E-Food Oh, indeed! I forgot to change that part while doing the improvement suggested by Riokmij. Thanks! – Pierre-Luc Pineault – 2015-09-28T01:52:52.430

1

You can save three more bytes by leveraging String Interpolation from C#6.0 and embedding the format arguments into the string itself (e.g. $"{(i%3*i%5>0?i:0):#}...\n") – LiamK – 2015-09-29T12:58:53.043 Live code for this http://csharppad.com/gist/c235498d6c042476664420a1b5ab0e7b – Tim Abell – 2017-03-19T22:44:48.297 3can do with 121 bytes today - class A{static void Main(){for(var i=0;i<100;)System.Console.Write($"{(++i%3*i%5<1?0:i):#}{i%3:;;Fizz}{i%5:;;Buzz}\n");}} – Jerri Kangasniemi – 2018-10-28T09:45:53.200

16

main=mapM putStrLn[show nmaxmap("FizzBuzz"!!)[6-2*gcd 3n..2+gcd 5n]|n<-[1..100]]


The expressions work out like this:

 n   6-2*gcd(3,n)  2+gcd(5,n)
=============================
1        4             3
2        4             3
3       *0             3
4        4             3
5        4            *7
6       *0             3
7        4             3
8        4             3
9       *0             3
10        4            *7
11        4             3
12       *0             3
13        4             3
14        4             3
15       *0            *7
16       ...           ...


We use them as start and end points for slicing the string. For example, when n == 5, then map("FizzBuzz"!!)[4..7] == "Buzz".

For non-divisible numbers, the range [4..3] is empty, so the result of map is "", and max (show n) replaces that result.

main=mapM f[1..100]
f n|d<-drop.(*4).mod n=putStrLn$max(show n)$d 3"Fizz"++d 5"Buzz"


d = drop.(*4).mod n is key here: d 3 "Fizz" is drop (nmod3 * 4) "Fizz". This is "Fizz" when n mod 3 is 0 and "" otherwise.

Other stuff

I got here via this 85:

main=mapM putStrLn[max(show n)$drop(6-2*gcd 3n)$take(3+gcd 5n)"FizzBuzz"|n<-[1..100]]


Here is another interesting 85:

f n=cycle[show n,"Fizz","Buzz",f 3++f 5]!!div(gcd 15n)2
main=mapM(putStrLn.f)[1..100]


The world record is 80 bytes by henkma.

Rearrangement golfs it down to 82, I think: (%)=drop.(*4).mod n;main=mapM putStrLn[max(show n)$3%"Fizz"++5%"Buzz"|n<-[0..100]]. – CR Drost – 2015-09-27T16:35:52.547 Wait, then n isn't in scope. Hm. – CR Drost – 2015-09-27T16:38:16.257 Yeah, that doesn't work, but I've hit an alternative 85-byte solution that looks a lot like it: main=mapM putStrLn[max(show n)$3%"Fizz"++5%"Buzz"|n<-[0..100],(%)<-[drop.(*4).mod n]] – Lynn – 2015-09-28T22:47:18.830

Why not use a line break? It's just as short as a semicolon but less unreadable. – dfeuer – 2019-02-28T03:00:08.097

@dfeuer I remember I was trying lots of different FizzBuzz approaches, and I wrote them all as one-liners in a single file to easily compare their lengths. – Lynn – 2019-02-28T14:23:33.173

Could you change it now? Horizontal scrolling is especially rough on mobile devices. – dfeuer – 2019-02-28T20:03:54.790

1I suggest you reconsider your quest for readable code on a code golf website :) – Lynn – 2019-02-28T22:25:52.333

Whoops.... That down vote was mine, and entirely accidental. – dfeuer – 2019-03-23T21:05:39.427

1@dfeuer I found a shorter solution, so you can fix your downvote if you'd like. – Lynn – 2020-09-29T22:20:10.557

16

C, 74 bytes

main(i){for(;i<101;puts(i++%5?"":"Buzz"))printf(i%3?i%5?"%d":0:"Fizz",i);}


The 0 argument to printf instead of "" is fishy, but seems to work on most platforms I try it on. puts segfaults when you try the same thing, though. Without it, you get 75 bytes.

There are 73-byte solutions that work on anarchy golf, and I found one digging around in the right places on the internet, but they rely on platform-specific behavior. (As you might have guessed, it's something of the form puts("Buzz"±...).)

1Nice trick to get i=1 for the no args case (argc=1). It's a feature: you can start the sequence from any point by running ./fizzbuzz $(seq 40) :P – Peter Cordes – 2016-05-27T21:05:47.257 14 PowerShell, 786861 54 Bytes 1..100|%{(($t="Fizz"*!($_%3)+"Buzz"*!($_%5)),$_)[!$t]}


Edit: Saved 10 bytes thanks to feersum

Alternatively, also 54 bytes

1..100|%{($_,('Fizz'*!($_%3)+'Buzz'*!($_%5))|sort)[1]}  This is the same loop structure as above, but inside it sorts the pair (n, string), and relies on the fact that an empty string sorts before a number, but a FizzBuzz string sorts after a number. Then it indexes the second sort result. As an aside, if PowerShell ever implemented the || operator, like in C#, we could likely get down to 43 bytes with something similar to 1..100|%{"Fizz"*!($_%3)+"Buzz"*!($_%5)||$_} ... doubtful, since the | is such an important special operator in PowerShell, but I can dream ... – AdmBorkBork – 2015-09-24T20:51:06.303

1How about 1..100|%{'Fizz'*!($_%3)+'Buzz'*!($_%5)-replace'^$',$_} for 54? – TessellatingHeckler – 2015-09-25T06:18:09.777

You can replace if($t){$t}else{$_} with something like ($t,$_)[!$t] – Danko Durbić – 2015-09-25T07:03:23.873

1... so you get 1..100|%{(($t="Fizz"*!($_%3)+"Buzz"*!($_%5)),$_)[!$t]} which is also 54 like @TessellatingHeckler's suggestion – Danko Durbić – 2015-09-25T08:01:45.883 @TessellatingHeckler PowerShell is nothing if not flexible. – AdmBorkBork – 2015-09-26T00:34:16.407 14 Clojure, 113106101100 91 bytes My first golf! (dotimes[i 100](println(str({2'Fizz}(mod i 3))({4'Buzz}(mod i 5)({2""}(mod i 3)(inc i))))))  Ungolfed: (dotimes [i 100] ; account for off-by-one later (println (str ({2 'Fizz} ; str converts symbols to strings (mod i 3)) ({4 'Buzz} ; 4 instead of 0 because of off-by-one (mod i 5) ({2 ""} ; shortest way to write when-not (mod i 3) (inc i))))))  1 You can remove 5 characters by handling the println the same way as in the Java solution, eg. (doall(map #(let[t(=(mod % 3)0)](println(str(if t"Fizz""")(if(=(mod % 5)0)"Buzz"(if t""%)))))(range 1 101))) – resueman – 2015-09-25T14:47:38.103 1@resueman Thanks! It actually ended up being 7, because (if t"Fizz""") can be simplified to (if t"Fizz"). :) – Sam Estep – 2015-09-25T16:49:29.037 +1 Nice modulo trick, at first I though you had off-by-one errors. – coredump – 2015-09-28T08:09:37.853 13 brainfuck, 411 350 277 258 bytes Edits: • -61 bytes by storing the values of "Fizz Buzz" as "BuziF" "BuziG" and redoing the number printing section. • -71 bytes by redoing the modulo number printing section, splitting the loop counter and the number counter, and reusing the newline cell as the mod value, among other things • -19 bytes by realising that there aren't any 0s in any FizzBuzz numbers. Also added explanation +[-[>+<<]>-]>--[>+>++>++>++++++>+>>>++++++[<<<]>-]<+++++[>+>+>->>->++>>>-->>>++[<<<]>>>-]>[>]+++>>[>+<<<-[<]<[>+++>+<<-.+<.<..[<]<]>>-[<<]>[.>.>..>>>>+[<]+++++<]>[>]>>[[->+>-[>+>>]>[+[-<+>]>+>>]<<<<<<]>[-<+>]>,>[>]<[>-[<+>-----]<---.,<]++++++++++>]<.<<<<,>-] Try it online! Instead of checking if the number itself was divisible by 5 or 3 I had two counters keeping track of the modulo of the number, decrementing them for each number and printing out the corresponding word when they reached 0. How It Works: +[-[>+<<]>-]>-- Generate the number 61 [>+>++>++>++++++>+>>>++++++[<<<]>-] Set the tape to multiples of 61 TAPE: 0 0' 61 122 122 110 61 0 0 110 "=" "z" "z" "n" "=" <+++++[>+>+>->>->++>>>-->>>++[<<<]>>>-]>[>]+++>> Modify values by multiples of 5 TAPE: 0' 5 66 117 122 105 71 3 0 100' 0 0 10 "B" "u" "z" "i" "G" Some info: 5 - Buzz counter "Buz" - Buzz printing "ziG" - Fizz printing. Modifying the G in the loop is shorter than modifying it outside 3 - Fizz counter 0 - This is where the Fizz|Buzz check will be located 100 - Loop counter 0 - Number counter. It's not worth it to reuse the loop counter as this. 0 - Sometimes a zero is just a zero 10 - Value as a newline and to mod the number by [ Loop 100 times >+<<< Increment number counter -[<]< Decrement Fizz counter [ If Fizz counter is 0 >+++ Reset the Fizz counter to 3 >+<< Set the Fizz|Buzz check to true -.+<.<.. Print "Fizz" [<]<] Sync pointers >>-[<<]> Decrement Buzz counter [ If Buzz counter is 0 .>.>.. Print "Buzz" >>>>+ Set the Fizz|Buzz check to true [<]+++++< Reset the Buzz counter to 5 ] >[>]>> Go to Fizz|Buzz check [ If there was no Fizz or Buzz for this number TAPE: 3% BuziG 5% 0 Loop Num' 0 10 [->+>-[>+>>]>[+[-<+>]>+>>]<<<<<<] Mod the number counter by 10 TAPE: 3% BuziG 5% 0 Loop 0' Num 10-Num%10 Num%10 Num/10 >[-<+>] Move Num back in place >,>[>]< Reset 10-Num%10 [ For both Num/10 (if it exists) and Num%10 >-[<+>-----]<--- Add 48 to the number to turn it into the ASCII equivilent .,< Print and remove ] ++++++++++> Add the 10 back ] <. Print the newline <<<<, Remove Fizz|Buzz check >- Decrement Loop counter ]  Well done Jo! I might try to beat that someday :) – Forcent Vintier – 2017-12-15T16:33:17.673 13 R, 88837771 70 bytes I'm sure that this can be improved ... and it was with credit to @flodel. A further couple of bytes saved thanks to a suggestion from @njnnja and another from @J.Doe x=y=1:100;y[3*x]='Fizz';y[5*x]='Buzz';y[15*x]='FizzBuzz';write(y[x],1)  A cat answer. The mouse is above :) – Silviu Burcea – 2015-09-25T10:36:36.717 2I found a bit better: x=1:100;i=!x%%3;j=!x%%5;x[i]="Fizz";x[j]="Buzz";x[i&j]="FizzBuzz";cat(x,sep="\n") – flodel – 2015-09-28T02:13:07.413 @njnnja Thanks for the suggestion. I implemented it with a write rather than cat though – MickyT – 2015-09-28T19:07:47.657 2Necromancy here! The write call can take a 1 instead of a an empty string so x=y=1:100;y[3*x]='Fizz';y[5*x]='Buzz';y[15*x]='FizzBuzz';write(y[x],1) is a trivial 1 byte golf for 70 bytes. – J.Doe – 2018-10-01T13:00:26.300 68 bytes. The bytecount includes three unprintable backspaces, and it doesn't work correctly in TIO. – J.Doe – 2018-10-04T21:41:27.850 @J.Doe I like the use of backspaces in this, but I think it may not be acceptable based on this meta and the statement in the rules " ... Because the output is fixed ... ". Still nice job – MickyT – 2018-10-04T21:56:26.790 Oh well, it was worth a try! If escape characters are disallowed in this kind of challenge, then I guess 70 bytes is rock bottom. – J.Doe – 2018-10-04T22:26:33.307 12 80386 machine code + DOS, 75 bytes Hexdump of the code: 0D 0A 24 B1 64 33 C0 BA-03 05 BB 00 01 40 50 FE CE 75 0C 83 EB 04 66 C7-07 42 75 7A 7A B6 05 FE CA 75 0C 83 EB 04 66 C7-07 46 69 7A 7A B2 03 84 FF 74 0C D4 0A 04 30 4B-88 07 C1 E8 08 75 F4 52 8B D3 B4 09 CD 21 5A 58-E2 C0 C3  Source code (TASM syntax):  .MODEL TINY .CODE .386 org 100h MAIN PROC db 13, 10, '$'
mov cl, 100
xor ax, ax
mov dx, 503h

main_loop:
mov bx, 100h
inc ax
push ax

dec dh
jnz short buzz_done
sub bx, 4
mov dword ptr [bx], 'zzuB'
mov dh, 5
buzz_done:

dec dl
jnz short fizz_done
sub bx, 4
mov dword ptr [bx], 'zziF'
mov dl, 3
fizz_done:

test bh, bh
jz short num_done

decimal_loop:
aam;
dec bx
mov [bx], al
shr ax, 8
jnz decimal_loop

num_done:
push dx
mov dx, bx;
mov ah, 9
int 21h
pop dx
pop ax

loop main_loop
ret

MAIN ENDP
END MAIN


This code counts from 1 to 100 in ax, building the output message from the end to the beginning. The end of the message (newline and the $ character that DOS uses for end-of-message flag) appears at the beginning of the code: db 10, 10, '$'


It's executed as a harmless instruction (or ax, 240ah). I could put it in a more conventional place, like after the end of the code, but having it at address 0x100 has a benefit.

The code also uses 2 additional counters:

• Counting from 3 to 0 in dl
• Counting from 5 to 0 in dh

When a counter reaches 0, it pushes the string Fizz or Buzz to the end of the output message. If this happens, bx will be decreased, and bh will be zero. This is used as a condition for outputting the number in a decimal form.

Note: I am using 32-bit data here. This won't work on a pre-386 computer.

Does TASM really handle multi-byte characters constants in the opposite order from NASM? In NASM, you write mov [mem], 'Fizz' to store Fizz in that order in memory, matching db directives. See my overcomplicated "efficient" YASM FizzBuzz for example.

– Peter Cordes – 2016-05-28T00:36:34.410

1Does it save any bytes to use std, then stosb / stosd? You'd have to replace test bh,bh with cmp di, 100h or something. Instead of saving/restoring the counter in AL, you could keep it in BL and just clobber eax whenever you want. E.g. sub bx, 4 / mov dword ptr [bx], 'zzuB' is 3+7 bytes, right? mov eax, 'zzuB' / stosd is 6+2 bytes (operand-size prefix on both). It would be nice if the answer included disassembly so instruction sizes were visible. – Peter Cordes – 2016-05-28T00:46:30.307

1

This is a great answer - abusing benign instructions for data and using never-used PSP memory space. @PeterCordes I played with your suggestions using stosd but wasn't able to eek out any score reduction myself. Since stosd decrements DI afterwards you don't get to lose the sub di, 4 and then you have DI 4 bytes off at the end. I was able to -6 bytes using a few other minor tweaks which I ended up posting as a separate answer (only because I couldn't possibly fit in all a comment). Kudos!

– 640KB – 2019-08-27T17:19:33.157

11

Vyxal, jM, 17 bytes

Ĥƛ3œı⍞«*n5œı≕⊂*+⟇


Try it Online!

I refuse to be beaten by Arn. I absolutely will not be beaten by Arn. Vyxal forever lads.

Explained

Ĥƛ3œı⍞«*n5œı≕⊂*+⟇

Ĥ                      # Push the number 100
ƛ                     # Start a lambda map doing the following over the range [1, 100]: (it would usually map over [0,99] but the M flag makes the lambda increase the start and end of that range)
3œ                   #   Find the divisibility of the argument by 3 AND
ı⍞«               #   Push the compressed string "Fizz" AND
*               #    Multiply the two together THEN
n5œ            #   Find the divisibility of the argument by 5 AND
ı≕⊂        #   Push the compressed string "Buzz" AND
*        #   Multiply the two together THEN
+       #   Add the two multiplied strings together THEN
n⟇     #   Short-circuit OR the string and the argument.
# The j flag automatically joins with newlines



String compression here is dictionary string compression.

A clarification: When you try to map a function to an integer, the range [0, integer) is generated and is consequently used as the iterable. The M flag makes this implicit range [1, integer]

Here is a detailed walk through on how to get 18 bytes told through a story of successive iterations of fizzbuzz (taken from a conversation in The Tarpit chatroom):

FizzBuzz Mark I

Before we begin writing any code, I'll explain what Vyxal is and what it is designed for. Vyxal is my most recent esolang (which should be kind of obvious given its name), which focuses on performing well in code golf (competitions where participants try to answer questions with as short a program as possible). It is also designed to retain an aspect of "elegance" whilst remaining terse.

Alright, here's a pseudocode example of what our first approach at FizzBuzz will look like:

FOR i = 1 TO 100
IF i % 15 == 0 THEN
PRINT "FizzBuzz"
ELSEIF i % 5 == 0 THEN
PRINT "Buzz"
ELSEIF i % 3 == 0 THEN
PRINT "Fizz"
ELSE
PRINT i
ENDIF
NEXT i


As you can tell, this is a pretty stock-standard way of solving the problem. Here's the same algorithm but expressed in Vyxal:

1 101 r (i|           # FOR i = 1 TO 100
←i 15 % 0 = [       #   IF i % 15 == 0 THEN
FizzBuzz,       #       PRINT "FizzBuzz"
|
←i 5 % 0 = [      #   ELSEIF i % 5 == 0 THEN
Buzz,         #       PRINT "Buzz"
|
←i 3 % 0 = [    #   ELSEIF i % 3 == 0 THEN
Fizz,       #       PRINT "Fizz"
|               #   ELSE
←i ,          #       PRINT i
]
]
]
\n,
)


From this, a few things are seen:

• The main control structures are delimited by brackets: this is an intentional break away from the tendency of most golfing languages to use letters to designate things like if-statements and loops
• The pipe character (|) is used to branch to different parts of the control structure (the else statement in if-statements and the loop body in for-loops)
• [...|...] is an if-statement
• (...|...) is a for loop
• Integers are their own token
• The r command generates a range between 2 integers
• Whitespace doesn't matter, and is simply a NOP
• Variables are created with →name and their values retrieved with ←name
• Strings are delimited with backticks
• The , command prints the top of the stack

Now, seeing as how we are trying to shorten our program as much as possible, removing the whitespace and formatting gives:

1 101r(i|←i 15%0=[FizzBuzz,|←i 5%0=[Buzz,|←i 3%0=[Fizz,|←i ,]]]\n,)


(75 bytes: same length as the Mouse and Swift answer)

This program, whilst golfed, doesn't make Vyxal seem like the best language for code golf. Fortunately, I have a whole lot of tricks left to show y'all.

FizzBuzz Mark II

The part that seems to un-necessarily convolute our current program is the repeated usage of the loop variable i. To fix this, we can drop the explicit variable altogether and use the implicit context variable of the for loop.

Within Vyxal, the contextual variable (there is only one) is used to store values associated with different structures. In other words, the context variable has different values based upon its, well, context.

In a for loop, the context variable holds the current iteration value. In a while loop, the context variable holds the result of the most recent evaluation of the while loop's condition. If statements don't have a context variable assigned. In functions and lambdas, the context variable holds the argument(s) passed to the function upon calling.

The command to retrieve the value of the context variable is n.

Using this, our program becomes

1 101r(n15%0=[FizzBuzz,|n5%0=[Buzz,|n3%0=[Fizz,|n,]]]\n,)


(65 bytes: Just a byte longer than the Scala answer)

FizzBuzz Mark III

Our current approach is now shorter, but it still isn't short enough to be considered competitive. What if, instead of checking 3 different modulos, we only check 3 and 5, print each respective word depending on the divisibility and then, if nothing is printed, print the index:

FOR i = 1 TO 100
output = ""
IF i % 3 == 0 THEN
output += "Fizz"
ENDIF
IF i % 5 == 0 THEN
output += "Buzz"
ENDIF

IF output == "" THEN
PRINT i
ELSE
PRINT output
ENDIF
NEXT i


Translating this to Vyxal gives:

&1 101r(n3%0=[&Fizz+&]n5%0=[&Buzz+&]&:[,|_n,]&\n,)


(60 bytes: Same length as the MAWP 2.0, IPEL and the 33 answer)

In this iteration, a few new features are introduced:

• & acts as a register, and toggles between popping the top of the stack into the register and emptying the register onto the stack (much like ><>)
• Empty strings are regarded as falsey when tested as a boolean value

This approach is good, but what if instead of using a flag to keep track of the output, we short-circuit or'd the register with n? Here's a table of the three possible combinations (note that n is always >0):

register      register or n
---------------------------
"FizzBuzz"    "FizzBuzz"
"Buzz"        "Buzz"
"Fizz"        "Fizz"
""            n


This means that we can turn &:[,|_n,] into &n∨

Also, because our if statements only have one branch (an if statement without a pipe | consists of code to only be executed if the top of the stack is truthy), we can multiply the strings by the result of the comparison: 0 * string = empty string; 1 * string = string. Note that this wouldn't work if the result of n<>%0= had more than two possible results.

This means we turn n3%0=[&"Fizz"+&] into &"Fizz"n3%0=*+&, making our overall program:

&1 101r(&Fizzn3%0=*+&&Buzzn5%0=*+&&n∨&\n,)


(52 bytes: Same length as the O answer)

FizzBuzz Mark IV

Thus far, we've mostly been using variables/registers to keep track of values. However, we can make our program shorter by utilising the stack mechanics of Vyxal. Consider the following pseudocode:

FOR I = 1 TO 100
PUSH "Fizz"
PUSH I
PUSH 3
MODULO
PUSH 0
EQUALS
MULITPLY // "Fizz" * ((I % 3) == 0)
PUSH "Buzz"
PUSH I
PUSH 5
MODULO
PUSH 0
EQUALS
MULITPLY // "Buzz" * ((I % 5) == 0)
PUSH I
LOGICAL OR
PRINT TOP
PRINT "\n"
NEXT I


Translating this to Vyxal gives:

1 101r(Fizzn3%0=*Buzzn5%0=*+n∨,\n,)


(41 bytes: 2 bytes shorter than my current Keg answer)

However, we're still not finished yet. For the next byte reduction, we can look at minimizing the 0= right after each modulo.

If we look at the function of 0=, we can see that it is acting as a logical NOT operation, inverting the truthiness of the item it's comparing. Let's take a look at an example where we are testing for divisibility by 3:

When the result of n % 3 is 0, we want to say that we DO need to multiply the string "Fizz": 0 == 0 => 1. In this way, it NOTs the 0

Conversely, when the result of n % 3 is 1 or 2, we want to say that we DO NOT need to multiply the string "Fizz": 1 == 0 => 0 and 2 == 0 => 0. In this way, it NOTs the truthiness of 1 and 2.

The same can be seen for checking divisibility by 5, so we can replace 0= with the logical NOT operator ¬, making our program:

1 101r(Fizzn3%¬*Buzzn5%¬*+n∨,\n,)


(39 bytes: Same length as the second shortest Pyth answer, placing us in the top 30 [27th])

The savings of changing numerical comparisons to logical negation is marginal but still reduce the byte count nonetheless. But what if, instead of using any sort of boolean logic, we simply used a "is divisible" built-in:

1 101r(Fizzn3œ*Buzzn5œ*+n∨,\n,)


(37 bytes: same length as the shortest known APL FizzBuzz, placing us 25th on the leaderboard)

FizzBuzz Mark V

37 bytes seems the shortest we can get using loops and stack manipulation. So how are we going to get the byte count down to 18?

Well, we could always try using functions!

Consider the following:

BEGIN Function(index)
PUSH "Fizz" * is_divisible(index, 3)
PUSH "Buzz" * is_divisible(index, 5)
PUSH index
LOGICAL OR
RETURN
END

FOR I = 1 TO 100
PRINT Function(I)
PRINT "\n"
NEXT I


Translating this gives us:

@f:1|Fizzn3œ*Buzzn5œ*+n⟇;1 101r(n@f;,\n,)


(47 bytes)

Oops. We've actually made it longer. Notice how the for loop is applying the function to each number, essentially mapping it. Perhaps we can simply map the function instead of looping it:

@f:1|Fizzn3œ*Buzzn5œ*+n∨;1 101r°f;M⁌


(40 bytes)

It's shorter than applying the function in a for loop but still longer than a pure for loop.

Before we continue, let's quickly analyse what's happening:

@f:1|...;: This defines a function called f which takes a single parameter. Functions are defined as @name:parameters|code; and called as @name;

1 101r still produces a range between 1 and 100 (inclusive)

°f; pushes a function reference of f. Think of this as if you wrote the name of a function in python without the brackets: a = f(x) calls the function while a = f assigns the reference of function f to a.

M⁌ maps the function to the range and joins it with newlines.

You may be wondering how we can reduce this program when it's clear that the function definition can't be shortened. Notice that we use f straight away, we only pass it a single parameter and that we only want a single result. If this was a language like Python, one might suggest using a lambda to eliminate the need for clunky definition syntax. So why don't we do the same in this situation:

1 101rλFizzn3œ*Buzzn5œ*+n∨;M⁌


(33 bytes: 2 bytes shorter than the CJam FizzBuzz)

Here, λ...; defines a lambda (a function that is only accessible via being on the stack) and pushes its reference. Think of it like this: @name:p|... defines a function that is globally accessible and can be easily reused hundreds of times. λ...; pushes its function onto the stack as a single encapsulated block and is only usable when its reference is on the stack or in a variable.

Recall that the context variable for lambdas is its argument. This means that we can easily refer to the value passed to the lambda with n.

FizzBuzz Mark VI

Like most golfing languages, when there aren't enough values on the stack to complete an operation, Vyxal takes implicit input and uses that instead. However, this behaviour is different when control flows moves inside a function/lambda call: rather than cycling through the global input of the program, the implicit value provided is the argument(s) passed. (Side note: functions/lambdas operate on their own local stack initialised with the values passed).

With this knowledge, we can take advantage of the stack when the argument is the only value left.

But first, we need to reorder our 33-byte program to become:

1 101rλn3œFizz*n5œBuzz*+n∨;M⁌


At the start of the lambda, n is the only value on the stack, so we can turn n3œ into 3œ because the n is already provided. We can't do that with n5œ because the result of the previous multiplication will occupy the stack.

Our program is now:

1 101rλ3œFizz*n5œBuzz*+n∨;M⁌


(32 bytes: Same length as the ESMin FizzBuzz)

Another thing we can improve is the generation of the range between 1 and 100. Vyxal, like other golfing languages, has built-ins for different ranges based on a single number: [0, n], [0, n), [1, n], [1, n).

In the case of FizzBuzz, we want the range [1, 100], so we need the [1, n] range built-in. The reference page tells us that this command is ɾ. Therefore, 1 101r becomes 100ɾ.

Our full program is now:

100ɾλ3œFizz*n5œBuzz*+n∨;M⁌


(30 bytes: same length as the shortest Pyth FizzBuzz)

But 100 is such a common value that there is a 1 byte built-in for pushing the value 100:

Ĥɾλ3œFizz*n5œBuzz*+n∨;M⁌


(28 bytes: Same length as the golfing suggestion to my Charcoal FizzBuzz)

FizzBuzz Mark VII

We're still 10 bytes away from the shortest known Vyxal FizzBuzz. A quick golf that can be made is string compression: Vyxal has both dictionary and base 255 compression utilities. In this instance, we'll use dictionary compression.

Vyxal's dictionary has approximately 20,000 words that can be used within strings. Each word in the dictionary has a unique two-letter code called a "String Compression Code" (SCC). Really, the SCC is simply the index of the word in the dictionary converted to a bijective base with an alphabet based on the non-ASCII characters on the Vyxal codepage. To use an SCC, simply place it in a string. For example:

⎝Ũ, ¬Ô!


Turns into Hello, World. Note that the punctuation and whitespace are retained but the SCCs are converted to their respective words. The SCCs for Fizz and Buzz are ⍞« and ≕⊂ respectively. Using this gives us:

100ɾλ3œ⍞«*n5œ≕⊂*+n∨;M⁌


(24 bytes: same length as the 05AB1E FizzBuzz)

However, this can still be improved by changing the strings involved: because we only need one SCC per string, we can utilise a feature found in other golfing languages were a single dictionary string can be constructed without the need for a closing character. ı pushes a single uncompressed SCC to the stack:

Ĥɾλ3œı⍞«*n5œı≕⊂*+n∨;M⁌


(22 bytes: same length as the MathGolf FizzBuzz)

FizzBuzz Mark VIII At this stage, we are 2 bytes away from tying with Jelly. This byte reduction can be achieved through the introduction of a new structure: lambda maps.

A lambda map is a lambda that instantly maps its function to the top of the stack, removing the need for an explicit M. Its structure is ƛcode; and is equivalent to λcode;M (fun fact, the parser turns the lambda map into a lambda token followed by the M command - that's how equivalent it is). We can turn our program into:

Ĥɾƛ3œı⍞«*n5œı≕⊂*+n∨;⁌


(21 bytes: same length as the W FizzBuzz)

Another special function of the lambda map is that, when its argument is an integer, it maps its function over the range [0, n]...obviously, mapping over an integer doesn't make sense, and it would be a waste of features to have mapping on an integer error.

Therefore, we can write:

Ĥƛ3œıƊº*n5œıũľ*+n∨;⁌


FizzBuzz Mark IX (the last one I swear)

That works for 20 bytes except for the fact that it actually isn't a valid answer. It maps from 0 to 100 not 1 to 100. Luckily, there's a fix for this that doesn't require the addition of bytes: command-line flags. (We're getting into some contested territory now, so fasten your seatbelts!)

When the Vyxal interpreter is run on the command line with the h flag and no other file, a list of all available flags is printed to the console:

Usage: python3 Vyxal.py <file> <flags (single string of flags)> <input(s) (if not from STDIN)>
ALL flags should be used as is (no '-' prefix)
j       Print top of stack joined by newlines
L       Print top of stack joined by newlines(Vertically)
s       Sum/concatenate top of stack on execution
M       Use 1-indexed range [1,n] for mapping integers
m       Use 0-indexed range [0,n) for mapping integers
v       Use Vyxal encoding for input file
c       Output compiled code


(This feature is courtesy of Razetime: go upvote his posts and star his Github repositories please.)

The M flag looks like it will help our situation. It makes lambda maps map over the range [1, n] instead of [0, n]. Now our 20-byte answer is valid with the M flag. (I'm not going to show the program again as nothing has changed but the command-line flags).

We've tied with Jelly now. But I'm not done yet. Notice how there is a j flag which joins the top of the stack by newlines. We can use this to remove the Ĳ which explicitly joins with newlines:

Ĥƛ3œı⍞«*n5œı≕⊂*+n∨;


(19 bytes/Mj flags)

To knock off that final byte to get to 18, we can use the auto-completion of structures. If a structure is unbalanced (e.g. ...[... or ...ƛ... gets turned into ...[...] and ...ƛ...; at parse time).

Applying this gives us:

Ĥƛ3œı⍞«*n5œı≕⊂*+n∨


(18 bytes: unfortunately not the only 18-byte answer anymore D:)

Finally!! Vyxal! – null – 2020-08-29T05:53:44.137

@HighlyRadioactive I thought I'd introduce it in the best way possible: beating Dennis – Lyxal – 2020-08-29T05:54:07.493

Dennis (comes back): :( – null – 2020-08-29T05:54:57.580

@petStorm that isn't implemented yet – Lyxal – 2020-08-29T07:25:20.540

1@petStorm it's implemented now – Lyxal – 2020-08-29T07:44:33.773

2I don't think it counts as beating anyone if the language was designed after the challenge – Luis Mendo – 2020-08-31T12:33:08.153

1There's a debate to be had about whether it means anything for an answer to beat or be beaten by an answer in a different language, but the age of the language should be irrelevant in that determination. – pppery – 2020-09-02T02:59:02.600

The Jelly chain syntax is cluttered with unnecessary syntactical elements, so it's going to be quite easy to beat it with less cluttered language. – None – 2020-09-06T00:45:31.397

What does the M flag do? – Lynn – 2020-09-30T10:21:37.697

@Lynn it makes the map-lambda go from [1, n] rather than [0,n) – Lyxal – 2020-09-30T11:21:26.367

7I see. Well... I know how meta counts flags, but I'm not sure how sportsmanlike it is to compare your language (and say you "legitimately beat Dennis") to Jelly, which has no such flags, without counting the flags. You're basically tucking an implicit "increment" and "join by NL" instruction into the program flags, and then counting two fewer bytes. – Lynn – 2020-09-30T13:37:41.247

Ahh nice, you made an implicit operand for ⟇! – None – 2021-01-22T08:14:11.783

11

dc, 64 62 bytes

[[Fizz]P]sI[[Buzz]P]sU[dn]sNz[zdd3%d0=Ir5%d0=U*0<NAPz9B>L]dsLx


Ungolfed:

[[Fizz]P]sI  # macro I: print "Fizz"
[[Buzz]P]sU  # macro U: print "Buzz"
[dn]sN       # macro N: print current stack depth

z            # increase stack depth

[            # Begin macro
zdd           # Get current stack depth and ducplicate it twice
3%d0=I        # Check modulo 3 and leave a duplicate. If it's 0, run macro I
r             # Rotate top two elements, bringing up the stack depth again
5%d0=U        # Check modulo 5 and leave a duplicate. It it's 0, run macro U
*             # Multiply the duplicates of modulos of 3 and 5 ...
0<N           # ... if it's not 0, run macro N
AP            # Print a newline (A is 10)
# The macro leaves the stack with one more element each time
z9B>L      # Run macro L if stack depth is less than "ninety eleven" (101)
]         # End macro

dsLx  # store the macro in register L and execute it


11

PHP, 54 bytes

<?for(;$i++<100;)echo[Fizz][$i%3].[Buzz][$i%5]?:$i,~õ;


Valid for v5.5 onwards. The õ is character 245, a bit inverted \n.

I assume the default interpreter settings, as they are without any ini. If you are uncertain, you may disable your local ini with -n as in php -n fizzbuzz.php.

A version which will run error-free with absolutely any configuration file is 62 bytes:

<?php
for(;$i++<100;)echo@([Fizz][$i%3].[Buzz][$i%5]?:$i),"
";


The STFU operator @ does not necessarily mean that the code is error free. – sitilge – 2015-09-28T12:42:47.973

https://ideone.com/5rfNt0 – Kzqai – 2015-09-30T06:55:07.040

@Kzqai http://ideone.com/0zRA9e short_open_tag is off, E_NOTICE is on. Neither of these are default settings.

– primo – 2015-09-30T11:46:47.927

I'm getting a bunch of errors on 3v4l.org – a coder – 2016-01-27T23:42:43.063

@acoder relevant meta post. 3v4l.org seems useful.

– primo – 2016-01-28T09:32:15.337

Save two bytes: use -r and remove the tag. – Titus – 2017-02-11T17:27:54.017

@Titus From the description: "Write a program." I understand that many people in this community have chosen to willfully misinterpret this. – primo – 2017-02-11T19:20:59.103

11

Lua, 72 bytes

for i=1,100 do print(({'FizzBuzz','Buzz','Fizz',i})[i^2%3+i^4%5*2+1])end


Tied the world record! (Please don't cheat the rankings there.)

I stole this technique for my AppleScript answer.

– kernigh – 2017-10-25T02:38:30.833

2Cool answer. My 72 was for x=1,100 do print(({x,[0]="FizzBuzz",[6]="Fizz"})[x^4%15]or"Buzz")end, but looking at yours, I saw this 70: for x=1,100 do print(({"FizzBuzz",x,[7]="Fizz"})[1+x^4%15]or"Buzz")end – tehtmi – 2018-07-18T23:34:06.710

@tehtmi Oh, that’s so nifty! – Lynn – 2018-07-21T15:34:13.840

11

Vim, 44 bytes

33o<CR>Fizz<CR><Esc>qqABuzz<Esc>5kq19@q:%s/^$/\=line('.')<CR> On vimgolf.com we have the classic Remember FizzBuzz?, which is similar to this, but keeps the numbers on all the lines. There's also Neither Fizz nor Buzz, which uses a similar format, but provides a useful input file. Those small differences drastically change the optimal solution. I did exactly this same variation 2 years ago in the edit to this reddit post. I had to check whether visual increment (not available back then) creates an improvement, like it has for the other variations, but it looks like it hasn't. • 33o<CR>Fizz<CR><Esc>: Create the Fizz lines AND the blank lines with a simple insert mode repeat. Much quicker than a macro. AFAIK first discovered by @KersonHsiao in the vimgolf.com version, and used by every top solution since. • qqABuzz<Esc>5kq19@q: A very simple macro appends the Buzzes. • :%s/^$/\=line('.')<CR>: Replaces all blank lines with that line's line number. The expression replacement is very long, so this tactic is rarely used in vimgolf, but the alternatives are all worse.

10

Bubblegum, 131 129 bytes

0000000: 4d cd bb 0d c4 30 0c 03 d0 9e db e8 63 7d da 14 d9 e5  M....0......c}....
0000012: 06 b8 26 d3 e7 60 0b 38 56 a6 29 10 4f a0 b8 3f cf 03  ..&...8V.).O..?..
0000024: c7 f5 fd 3d 3b 27 ea 84 5d 89 9c 8f 18 c4 77 3c 75 40  ...=;'..].....w<u@
0000036: 72 2e 4d 63 55 a8 d1 5c 63 fa 82 f6 7f 6e 02 1b da d8  r.McU..\c....n....
0000048: b6 84 b1 ee a3 bb c1 49 f7 80 8f ee ac 2f c5 62 7d 8d  .......I...../.b}.
000005a: be 0a 8b f4 10 c4 e8 c1 7a 24 82 f5 1c 3d 0d 49 7a 06  ........z$...=.Iz. 000006c: 72 f4 64 bd 14 c5 7a 8d 5e 85 22 bd 05 3d 7a b3 de 89 r.d...z.^."..=z... 000007e: 26 fd 05 &..  The above hexdump can be reversed with xxd -r -c 18 > fizzbuzz.bg. Compression has been done with Python's zlib, which uses the DEFLATE format but obtains a better ratio than (g)zip. Thanks to @Sp3000 for -2 bytes! 28You could golf off about 43 bytes by breaking SHA-256. – lirtosiast – 2015-09-25T00:07:00.903 1@ThomasKwa: sounds easy. – ceased to turn counterclockwis – 2015-09-25T22:41:23.443 10 Python 2, 61 60 bytes for i in range(1,101):print"Fizz"*(i%3<1)+"Buzz"*(i%5<1)or i  This is invalid: it prints 0 at the start – Beta Decay – 2015-09-24T19:38:36.937 1You could use either i+1 or range(1,101) to fix it. – ASCIIThenANSI – 2015-09-24T19:40:03.450 Now it only goes up to 99. – Zach Gates – 2015-09-24T19:48:07.300 I already have 56 FYI. – feersum – 2015-09-24T19:48:41.500 2the output is also straight up incorrect. 89 prints out a FizzBuzz whereas 90 is printed as 90 – Kevin W. – 2015-09-24T19:50:45.463 3Have you actually tested this program? – Beta Decay – 2015-09-24T19:57:02.053 To whoever downvoted, the program works as it is now. – Blue – 2015-09-24T21:16:02.127 10 Hexagony, 112 bytes d{$>){*./;\.}<._.zi...><{}.;/;$@-/=.*F;>8M'<$<..'_}....>.3'%<}'>}))'%<..._>_.'<$.....};u..}....{B.;..;.!<'..>z;/  After unfolding and with colour-coded execution paths: Diagram created with Timwi's HexagonyColorer. Finally got around to finishing this. I had written an ungolfed solution weeks ago, but wasn't entirely happy with it so I never actually golfed it. After revisiting it the other day, I found a way to simplify the ungolfed solution slightly, and while I think there might still be a better way to approach the problem in general, I decided to golf it this time. The current solution is far from optimal, and I think it should actually fit in side-length 6 instead of 7. I'll give this a go over the next days, and when I'm happy with the result will add a full explanation. 1That execution is a mess :P – LegionMammal978 – 2015-11-08T21:12:26.033 @LegionMammal978 I've seen worse. ;) – Martin Ender – 2015-11-08T21:13:39.000 How do you create those diagrams? – LegionMammal978 – 2015-11-08T21:18:21.760 @LegionMammal978 Oh, I forgot to add the usual credits: https://github.com/Timwi/HexagonyColorer – Martin Ender – 2015-11-08T21:18:51.117 9 TrumpScript, 938 bytes As always nothing is, 1000001 minus 1000000; And Putin is, 1000003 minus 1000000; great Just as Trump is, 1000005 minus 1000000; even better Also as America is, Putin times Trump; the best Most importantly Ivanka is, 1000101 minus 1000000; And believe me that Hillary is nothing As long as, Hillary thinks less of Ivanka;: China is friends with Hillary Democrats are idiots like Hillary Obama is in line with Hillary As long as, China thinks its more than America;: Make China, China minus America;! As long as, Democrats fear more Trump;: Make Democrats, Democrats minus Trump;! As long as, Obama gets more arsenal against Putin;: Make Obama, Obama minus Putin;! If everybody thinks, America is China?;: Say "FizzBuzz"! Otherwise: if we ask, Democrats are Trump?;: Say "Buzz"! Otherwise: what if, Obama is Putin?;: Say "Fizz"! Otherwise do this: tell Hillary all her lies!!! Hillary is, as always Hillary plus nothing;! America is great.  Try it online! I was quite bored... Not too efficient, but fun! Pseudocode: var nothing = 1, Putin = 3, Trump = 5, America = Putin * Trump, Ivanka = 101, Hillary = nothing; while Hillary < Ivanka var China = Democrats = Obama = Hillary; while China > America China = China - America; while Democrats > Trump Democrats = Democrats - Trump; while Obama > Putin Obama = Obama - Putin; if China == America print "FizzBuzz"; else if Democrats == Trump print "Buzz"; else if Obama == Putin print "Fizz"; else print Hillary; Hillary = Hillary + nothing; America is great.  9 80386 machine code + DOS, 75 68 bytes NOTE: This is a reply to @anatolyg's really clever 2015 answer, with a few tweaks to reduce the score by 7 bytes. I'm only submitting this as a separate answer because it wouldn't be possible to explain fully in a comment. Changes: • Use SI to reset BX since DOS sets SI initially to 100H (ref) instead of an imm. (-1 byte) • Instead of using a 3/5 counter in DH/DL, use AAM for modulo operations on counter. AAM is a 2 byte instruction that's effectively a byte-length DIV that can accept an imm value as the divisor and also sets ZF if AL mod n = 0. @Peter Cordes touches on this in his very brilliant post about FizzBuzz in assembly. (-5 bytes) • Instead of CR/LF, use LF/CR (the order doesn't matter to DOS). This translates to an instruction that does not modify the startup value of AX (in fact it zeroes out AL) so we can eliminate the xor ax,ax and save two bytes. It does come at a cost because 0A 0D is only a two-byte instruction so the rest of the 24xx instruction needs to be padded with one more byte. (-1 byte) Unassembled: 0A 0D or cl, [di] ; LF and CR bytes (newline) 24 00 and al, 0 ; DOS string delim ('$') + pad byte
B1 64           mov cl, 100             ; set loop counter to 100

main_loop:
8B DE           mov bx, si              ; init bx to 100h
40              inc ax                  ; increment fizzbuzz counter
50              push ax                 ; save fizzbuzz counter

50              push ax                 ; save ax from getting clobbered by AAM
D4 05           aam 5                   ; AL = AL mod 5, ZF if AL = 0
58              pop ax                  ; restore ax
75 0A           jnz short buzz_done     ; jump if not a 'Fizz'
83 EB 04        sub bx, 4               ; offset for output string
66C707 7A7A7542 mov dword ptr [bx], 'zzuB'
buzz_done:

50              push ax
D4 03           aam 3                   ; AL = AL mod 3, ZF if AL = 0
58              pop ax
75 0A           jnz short fizz_done     ; jump if not a 'Buzz'
83 EB 04        sub bx, 4
66C707 7A7A6946 mov dword ptr [bx], 'zziF'

fizz_done:

84 FF           test bh, bh             ; either a Fizz or a Buzz? (BX not changed)
74 0C           jz short num_done       ; if so, do not display a digit

decimal_loop:
D4 0A           aam;                    ; AL = AL mod 10
04 30           add al, '0'             ; convert to ASCII
4B              dec bx
88 07           mov [bx], al
C1 E8 08        shr ax, 8               ; 'mov al, ah', ZF if AL = 0
75 F4           jnz decimal_loop

num_done:
8B D3           mov dx, bx              ; set dx to output string pointer
B4 09           mov ah, 9
CD 21           int 21h
58              pop ax                  ; restore fizzbuzz counter

E2 C3           loop main_loop
C3              ret


xxd binary:

00000000: 0a0d 2400 b164 8bde 4050 50d4 0558 750a  ..$..d..@PP..Xu. 00000010: 83eb 0466 c707 4275 7a7a 50d4 0358 750a ...f..BuzzP..Xu. 00000020: 83eb 0466 c707 4669 7a7a 84ff 740c d40a ...f..Fizz..t... 00000030: 0430 4b88 07c1 e808 75f4 8bd3 b409 cd21 .0K.....u......! 00000040: 58e2 c3c3 X...  5Of course it's a competing answer! It has nice ideas. Competition of this kind is exactly what this site needs! – anatolyg – 2019-08-27T22:47:44.120 9 R, 68 66 bytes for(i in 1:100)write(max(i,paste0("Fizz"[!i%%3],"Buzz"[!i%%5])),1)  I must be missing something here because this is way too simple. I know that you really shouldn't use loops in R but like this is a bit smaller than the first R one I saw so yeah. Edited about a day after the original: you can get rid of the curly braces to save 2 characters. 3Welcome to Code Golf StackExchange, nice first answer. (It's also the winning R answer here!) – None – 2020-07-17T10:34:29.543 @Third-party'Chef' Damn, it's incredible that it took five years for the shortest R solution to be found – Beta Decay – 2020-07-24T13:26:28.657 Eh, don't count it as the shortest ever. Some crazy guy will find some way to make something smaller haha – zydras – 2020-07-24T18:11:08.737 9 JavaScript, 65 bytes for(i=0;i++<100;console.log((i%3?'':'Fizz')+(i%5?'':'Buzz')||i));  The shortest approach I've found yet. Perhaps there's a better one; suggestions are welcome. This was originally flagged ES6, but this works in ES5, and to my knowledge there's not a shorter way with ES6 features. Here's another attempt, using .slice and some complicated maths for a total of 66 bytes: for(i=0;i++<100;console.log('FizzBuzz'.slice(i%3&&4,i%5?4:8)||i));  (Thanks to Ben Fortune for a couple of handy tricks!) 2You could shorten your second attempt to for(i=0;i++<100;console.log('FizzBuzz'.slice(i%3&&4,i%5?4:8)||i)); – Ben Fortune – 2015-09-25T10:13:20.757 If you move console.log(...) outside for(...;...;...), you can drop the semicolon. – Dennis – 2015-10-03T15:54:44.217 This is old, but ES6 plus Dennis= 61 bytes:  for(i=0;i++<100;)console.log(i%3?i:'fizz'+${i%5?'':'Buzz'}) I can't make it a code block because the template string won't show up correctly
 – Generic User  – 2015-11-15T18:23:08.503

@GenericUser That doesn't quite work; it never prints Buzz by itself. To insert code with backticks in it, just use 2 or 3 backticks on each end. – ETHproductions – 2015-11-15T18:31:34.407

8

Julia, 64 bytes

for i=1:100 x="Fizz"^(i%3<1)*"Buzz"^(i%5<1);println(x>""?x:i)end


7

Brainfuck, 425 bytes

-[>+>+<<-----]>--->-->++++++++++>->++++++++++>+++++++++>>>+++>>>+++++>>>>>-[<+<+>>-------]<---<--->---->>-[<++>-----]<+++>>>----[<+++<+++>>--]<-----<<<<<<<<<<<<<<[<++++++++++[>>[->>-<]>+[->>>>>-[<<<-[<<<<<<<<.>>>>>>>>>>-<]>+[->]<<+>>>>>-<]>+[->]<<+<<<<]>-[>>>-[<<<<<<<<<<.>>>>>>>>>>>>-<]>+[->]<<+<-<]>+[>>>>>.>>.>..<<<<<<<<<+++>->]>-[>>-<]>+[>>>.>>>.<..<<<<<<+++++>->]<<<<<<<<<<<<+>.>-]<<----------<+>>>>-]>>>>>>>>>>>.>>>.<..


Try it online!

Explanation

Cell indexes in comments are in hexadecimal to match numbering in bfdev debug view.

# #####################
# ##### VARIABLES #####
# #####################

# C1 & C2: 48 (ascii 0)
-[>+>+<<-----]>--->-->
# C3: 10 (ascii LF)
++++++++++>
# C4: Singles counter
->
# C5: Tens counter
++++++++++>
# C6: is1to9 if countdown
+++++++++>
# C7: 0 to enter/exit is1to9, or 1 to enter is10to99
>
# C8: 0 to not enter is10to99
>
# C9: isMultiOf3 if countdown
+++>
# CA: 0 to exit isMultiOf3, or 1 to enter !isMultiOf3
>
# CB: 0 to not enter !isMultiOf3
>
# CC: isMultiOf5 if countdown
+++++>
# CD: 0 to exit isMultiOf5, or 1 to enter !isMultiOf5
>
# CE: 0 to not enter !isMultiOf5
>
# CF: 70 F, and put C13 to 70
>>-[<+<+>>-------]<---<--->
# C10: 66 - ascii B
---->
# C11: 105 - ascii i
>-[<++>-----]<+++>
# C12: 122 - ascii z, and put C16 to 122
>>----[<+++<+++>>--]<
# C13: 117 - ascii u
-----
# Goto C5
<<<<<<<<<<<<<<

# #################
# ##### LOGIC #####
# #################

# While C5 (tens counter): Print 1-99
[
# Restore C4: singles counter
<++++++++++
# For 0 to 9, using singles counter
[
#   Goto C6
>>
#   If is1to9
[
#     Decrement is1to9 countdown
-
#     Prepare else condition at C8
>>-<
]
#   Goto C7 or C8
>+
#   Else If C7: is10to99
[
#     Decrement C7
-
#     Goto CC
>>>>>-
#     If is not multi of 5
[
#       Goto C9
<<<-
#       If is not multi of 3
[
#         Print C1: tens
<<<<<<<<.
#         Prepare else condition at CB
>>>>>>>>>>-
#         Goto CA
<
]
#       Goto CA or CB
>+
#       Else If is multi of 3
[
#         Goto CA, restore, goto CB
->
]
#       Goto C9 and restore
<<+
#       Prepare else condition at C1E
>>>>>-
#       Goto C1D
<
]
#     Goto CD or CE
>+
#     Else If is multi of 5
[
#       Goto CD, restore, goto CE
->
]
#     Goto CC and restore
<<+
#     Goto C8
<<<<
]
#   Goto C9
>-
#   If is not multi of 3
[
#     Goto CC
>>>-
#     If is not multi of 5
[
#       Print C2: singles
<<<<<<<<<<.
#       Prepare else condition at CE
>>>>>>>>>>>>-
#       Goto CD
<
]
#     Goto CD or CE
>+
#     Else If is multi of 5
[
#       Goto CD, restore, goto CE
->
]
#     Goto CC and restore
<<+
#     Prepare else condition at CB
<-
#     Goto CA
<
]
#   Goto CA or CB
>+
#   Else If is multi of 3
[
#     Print Fizz
>>>>>.>>.>..
#     Goto C9 (If is not multi of 3)
<<<<<<<<<
#     Restore C9
+++
#     Goto CA, decrease, goto CB
>->
]
#   Goto CC
>-
#   If is not multi of 5
[
#     Prepare else condition at CE
>>-
#     Goto CD
<
]
#   Goto CD or CE
>+
#   Else If is multi of 5
[
#     Goto C10 and print Buzz
>>>.>>>.<..
#     Goto CC (If is not multi of 5) and restore
<<<<<<+++++
#     Goto CD, decrease, goto CE
>->
]
#   Goto C2: singles, and increment
<<<<<<<<<<<<+
#   Print C3: LF
>.
#   Decrement C4: singles counter
>-
]
# Restore C2: singles ascii
<<----------
# Increment C1: tens ascii
<+
# Goto C5 (tens counter) and decrement it
>>>>-
]
# Goto C10 and print Buzz
>>>>>>>>>>>.>>>.<..


1

Thought I'd let you know I beat your score ;)

– Jo King – 2017-11-24T09:43:00.283

7

05AB1E, 29 bytes

тLʒ"Fizz"D'ÒÖ™DŠ«)¬ÑD5ås3å«è,


Try it online!

To my surprise (or my incapability to use the search function) there was no 05AB1E answer to this question.

Explanation

тLʒ"Fizz"D'ÒÖ™DŠ«)¬ÑD5ås3å«è,
тL                            # push [1,...,100]
ʒ                           # for each...
"Fizz"                      # Push Fizz (didn't find a way to shorten this one sadly)
D                     # Duplicate
'ÒÖ™                 # Push Buzz
D                # Duplicate
Š               # Move top item on the stack two slots down
«              # Concatenate the top items (Results in FizzBuzz)
)             # Wrap stack to array
¬Ñ           # Get Divisors of N
D5å        # Does 5 divide it?
s3å     # Does 3 divide it?
«    # Concatenate top two items
è,  # Gets item in the array at the index of the concatenated divisors (indexing wraps around) and prints



7

BuzzFizz, 86 bytes

$a++ if3$$\a:print"Fizz" if5\$$a:print"Buzz" else:print$a
print"\n"
if100\$a:# else:loop  Try it online! Explanation Despite being golfed, all you have to do is to add a bit of horizontal whitespace and a few comments to get possibly one of the clearest and most readable FizzBuzzes ever. (Vertical whitespace is significant in BuzzFizz, apart from (by popular demand) the trailing newline, so it's necessary even in a golfed program.) # Counters start at 0. So$a will be increased to 1 on the first iteration.
# On subsequent iterations, it counts up by 1 each time.
$a++ # BuzzFizz supports only one operator: \, the "divides into" relational # operator. So you'll be seeing that every time there's an if statement. # It's pretty helpful for a fizzbuzz! if 3$$\a: print "Fizz" if 5\$$a: print "Buzz" # The "else" statement attaches to *both* "if" statements simultaneously; # it'll only run if neither of them did. "else" always attaches to all # "if" statements since the preceding "else", so sometimes a dummy "else" # statement is needed in order to clear the state. We don't need to # resort to that for our FizzBuzz program, though. else: print$a

# Now we've printed Fizz/Buzz/FizzBuzz/the number, print a newline.
print "\n"

# Our loop ends when $a becomes 100. 100 is the lowest positive integer # that's divisible by 100, so we can use a divisibility test to find # the end of the loop. We negate the test via the use of a comment as # the body of the "if" statement (an "if" body cannot be empty in # BuzzFizz, but a comment counts as a statement). if 100\$a: # do nothing

# If $a is *not* divisible by 100, we have another iteration. So loop # back to the start of the program. else: loop  Discussion In addition to the commands seen in the FizzBuzz program above, BuzzFizz also supports input (if you use an identifier like a with no leading $, the program will ask for its value; you can use a statement like clear a to reset the value so that the program asks for it again the next time it's used). Other than that, the above program shows off all the features of the language; in other words, we have a complete language built entirely out of the operations you need to write a simple FizzBuzz program (thus the name).

Despite its inspiration, BuzzFizz is not specialised merely for FizzBuzzes; you can take the FizzBuzz program apart, put it together in other ways, and solve a surprisingly large range of problems. For example, the Esolang page for the language has a primality tester and a program which adds two positive numbers. (The primality tester is simpler than the addition program; given BuzzFizz's choice of operator, this probably shouldn't be too surprising.)

That said, the language is (intentionally) not Turing-complete; the original inspiration of the language was to act as a counterexample to people who made claims of the form "any language that can do X must be Turing-complete", as the most common choices of X don't actually require it. On the other hand, it's also (intentionally) very powerful for a sub-Turing language; it's fairly hard to come up with simple problems that BuzzFizz can't solve and Turing-complete languages can.

7

Bash, 8581787472 71 bytes

for((;i++<100;j=i%3&2|i%5/4)){
o=($i Buzz Fizz FizzBuzz) echo${o[j]}
}


Thanks to @Neil for saving 4 bytes!
Thanks to @manatwork for saving 3 bytes!
Thanks to @primo for saving 2 bytes!

Try it online!

for i in {1..100}\n{for((;100>i++;)){ – primo – 2018-11-21T14:59:29.650

1@primo Thanks! Found a way to save one more. – Dennis – 2018-11-21T23:05:58.373

7

Common Lisp, 123 116

(dotimes(i 100)(loop for(m s)in'((3"Fizz")(5"Buzz"))if(=(mod(1+ i)m)0)do(princ s))(do()((fresh-line))(princ(1+ i))))


Pretty-printed

(dotimes (i 100)
(loop for (m s) in '((3 "Fizz") (5 "Buzz"))
if (= (mod (1+ i) m) 0)
do (princ s))
(do () ((fresh-line)) (princ (1+ i))))


The do/fresh-line trick

The inner loop iterates over ((3 "Fizz") (5 "Buzz")) for each i and, according to the result of the two consecutive mod operations, eventually prints:

• nothing
• or Fizz
• or Buzz
• or FizzBuzz

fresh-line is a nice little function that as far as I know is only found in Common Lisp. It adds a newline only if necessary, and returns T only when the newline was added. For the above situations, according to whether we printed something or not, the return values of (fresh-line) are thus respectively:

• NIL
• T
• T
• T

So I know that the integer must be printed only when we did not print a fresh-line. But if I print the integer, I must also print a newline after it. That's why there is a DO.

DO is a basic yet almighty looping construct that iterates until a condition is met. Here, the condition is the return value of (fresh-line). It it tested before each iteration of the body of the loop, notably the first one. So if the test returns T, then we exit the DO. Otherwise, we execute the body, which prints the integer. Then, we execute the test once again and this time, it returns T because current line is "dirty" (there is an integer printed now).

Clever! I don't think I can change my CL answer to beat it. – nanny – 2015-09-25T16:42:00.593

@nanny If that can comfort you, I don't think I can either. I saw your answer, it was hard to beat. – coredump – 2015-09-25T16:47:33.490

Great answer. I learnt some from it and don't understand it fully yet. However I think I've managed to beat you by 13 bytes using different method.

– None – 2017-02-17T22:45:18.150

7

Mathematica, 83757367 62 bytes

Print/@(#/.(##&[15#->FizzBuzz,3#->Fizz,5#->Buzz]&)/@#&@Range@100)


I do not think that this could be golfed any further. Thanks to branislav for helping me golf this.

golf it down to 66 bytes by first removing all quotation marks, second using ...\\Column instead of Print/@(...) – sanchez – 2015-10-30T16:39:22.607

then how about Print/@% – sanchez – 2015-11-02T05:30:50.697

@branislav It doesn't end up saving any bytes. – LegionMammal978 – 2015-11-02T11:24:13.987

62 bytes: Print/@(#/.(##&[15#->FizzBuzz,3#->Fizz,5#->Buzz]&)/@#&@Range@100), a one-liner without exotic characters, you asked for it ;D I think now we're at the end – sanchez – 2015-11-02T12:52:39.827

6You mean Mathematica doesn't have a FizzBuzz builtin? – None – 2015-11-15T05:02:04.823

You can save 1 byte with Echo – shrx – 2016-03-07T10:22:28.357

@shrx Echo adds a leading >> to the output. – LegionMammal978 – 2016-03-07T12:28:34.527

This is a fantastic answer, but unfortunately I don't think it is valid in Mathematica 11 as it yields {Null, Null, Null.....Null} after the output. Is it saveable? Otherwise, I have Row@Pick[{Fizz,Buzz},#~Mod~{3,5},0]/.{}->{#}&~Array~100//Column which comes in at two bytes longer. – A Simmons – 2017-01-20T17:08:14.683

1I should make it clear that I don't think that not working in the up-to-date version in any way invalidates this answer! But I'm interested to know what the best solution is in 11. – A Simmons – 2017-01-20T17:10:13.333

Heavily inspired by a discussion on Mathematica SE, this comes in at 61 fizzbuzz[#,,fizz,,buzz][[#~GCD~15~Mod~15]]&~Array~100//Column – A Simmons – 2017-01-20T17:35:50.290

@ASimmons The list of Nulls doesn't get output to STDOUT, and neither does the actual output on your proposed solution. – LegionMammal978 – 2017-01-20T22:07:38.743

7

MoonScript, 83 82 bytes

[print(i%15==0and"FizzBuzz"or(i%3==0and"Fizz")or(i%5==0and"Buzz")or i) for i=1,100]


5Welcome to Programming Puzzles & Code Golf! – Dennis – 2015-09-26T05:27:54.717

7

Brainfuck, 16321 3602 1597

Almost as short as Java. This is just the trivial answer generated by another program, This is still a computer generated answer, but I am sure there are way shorter solutions! The general idea is initializing the cells to 4 B F i u z. If the program has to output a number, it just goes to the first cell and manipualtes it, if it is one of the letters, it will just jump to the corresponding cell and output it.

++++++++++<<+++++++[>+++++++<-]>[>>+>+>+>++>++>++<<<<<<<-]>>+++>+++++++++++++++++>+++++++++++++++++++++>+++++++>+++++++++++++++++++>++++++++++++++++++++++++<<<<<---.<.>+.<.>>>.>.>>..<<<<<<.>++.<.>>.>>>.>..<<<<<<.>>>.>.>>..<<<<<<.>+++.<.>+.<.>>>.>.>>..<<<<<<.>>.>>>.>..<<<<<<.>-------..<.>>>.>.>>..<<<<<<.>.++.<.>--.+++.<.>>>.>.>>..<<<<.>>>.>..<<<<<<.>---.+++++.<.>-----.++++++.<.>>>.>.>>..<<<<<<.>------.++++++++.<.>>.>>>.>..<<<<<<.>>>.>.>>..<<<<<<.>-------..<.>.+.<.>>>.>.>>..<<<<<<.>>.>>>.>..<<<<<<.>-.++++.<.>>>.>.>>..<<<<<<.>----.++++++.<.>------.+++++++.<.>>>.>.>>..<<<<.>>>.>..<<<<<<.>------.--.<.>++.-.<.>>>.>.>>..<<<<<<.>+.+.<.>>.>>>.>..<<<<<<.>>>.>.>>..<<<<<<.>-.++++.<.>----.+++++.<.>>>.>.>>..<<<<<<.>>.>>>.>..<<<<<<.>----.---.<.>>>.>.>>..<<<<<<.>+++.-.<.>+..<.>>>.>.>>..<<<<.>>>.>..<<<<<<.>.++.<.>--.+++.<.>>>.>.>>..<<<<<<.>---.+++++.<.>>.>>>.>..<<<<<<.>>>.>.>>..<<<<<<.>----.---.<.>+++.--.<.>>>.>.>>..<<<<<<.>>.>>>.>..<<<<<<.>++.+.<.>>>.>.>>..<<<<<<.>-.+++.<.>---.++++.<.>>>.>.>>..<<<<.>>>.>..<<<<<<.>---.-----.<.>+++++.----.<.>>>.>.>>..<<<<<<.>++++.--.<.>>.>>>.>..<<<<<<.>>>.>.>>..<<<<<<.>++.+.<.>-.++.<.>>>.>.>>..<<<<<<.>>.>>>.>..<<<<<<.>-.------.<.>>>.>.>>..<<<<<<.>++++++.----.<.>++++.---.<.>>>.>.>>..<<<<.>>>.>..<<<<<<.>+++.-.<.>+..<.>>>.>.>>..<<<<<<.>.++.<.>>.>>>.>..<<<<<<.>>>.>.>>..<<<<<<.>-.------.<.>++++++.-----.<.>>>.>.>>..<<<<<<.>>.>>>.>..<<<<<<.>+++++.--.<.>>>.>.>>..<<<<<<.>++..<.>.+.<.>>>.>.>>..<<<<.>>>.>..<<<<<<.>.--------.<.>++++++++.-------.<.>>>.>.>>..<<<<<<.>+++++++.-----.<.>>.>>>.>..<<<<<<.>>>.>.>>..<<<<<<.>+++++.--.<.>++.-.<.>>>.>.>>..<<<<<<.>>.>>>.>..<<<<<<.


1

Nice solution! I could get to 425 bytes by manually writing the brainfuck code.

– Forcent Vintier – 2016-12-27T13:04:49.167

6

Common Lisp, 1031019693 84 bytes

(dotimes(i 101)(format t"~v^~[Fizz~[Buzz~]~:;~[Buzz~:;~a~]~]
"i(mod i 3)(mod i 5)i))


Try it online!

It's shorter than other CL solution and it uses different method. Conditions are handled inside format function.

-5 bytes - shorter version of handling i=0

-3 bytes - ~^ with only one parameter seems to work as if second parameter was 0, which is saves 2 bytes. Last byte is saved by substituting ~% by <enter>

-9 bytes - by ASCII-only

You can use ~[ instead of ~:[ and remove the (= ... 0) to reduce it to 84 bytes (with a bit of rearrangement). (not posting link because it would spoiler current code-golf.io best) – ASCII-only – 2018-05-16T09:26:43.273

@ASCII-only Thank you for suggestion but it seems unobvious, how to do it. Without (=(mod i 5)0) I seem to need to handle residues of 1,2,3,4 separately (and similiarily for (=(mod i 3)0): 1 and 2). – None – 2018-05-24T20:08:22.180

1No... just use ~:; to add a default fallback: (dotimes(i 101)(format t"~v^~[Fizz~[Buzz~]~:;~[Buzz~:;~a~]~]<newline>"i(mod i 3)(mod i 5)i)) where <newline> is replaced with literal newline – ASCII-only – 2018-05-24T23:33:21.713

@ASCII-only Thank you, I edited the answer. – None – 2018-05-25T16:28:37.680

6

New Version, thanks to Bolce Bussiere:

(,&((;,>)FizzBuzz)@":{~+.&3-~0:<5&|)"0>:i.100


Old version (52 bytes):

(,&('Fizz'(,>@;;)'Buzz')@":{~+.&3-~0:~:5&|)"0>:i.100


Explanation

Best explained by breaking it up into smaller verbs. Overall the main working portion is a train:

getlist {~ getindex


where getlist i returns a 4-length list of the default format of i, 'FizzBuzz', 'Fizz', and 'Buzz'; and getindex i returns -1 if i is divisible by 5 only, -2 if divisible by 3 only, 1 if divisible by both, and 0 otherwise. The verb {~ grabs the right argumentth element from its left argument, the list created by getlist, where the index is modulo'd by the length of the list, meaning -1 will grab the last element, -2 the second-to-last, etc.

In

getlist=:,&('Fizz'(,>@;;)'Buzz')@":


": gets the default format of i, and then ,&('Fizz'(,>@;;)'Buzz') appends it to the beginning of the list created using the train ,>@;; on the two arguments 'Fizz' and 'Buzz' (append them and raze them, then raze those results together and unbox each item), in the new version ((;,>)FizzBuzz) does essentially the same thing but takes advantage of the  that boxes, then appends the two strings before applying the train ;,> on the resulting list of boxes (unbox each element; raze the elements together to get FizzBuzz; append the unboxed elements with FizzBuzz)

In

getindex=:+.&3-~0:~:5&|


+.&3 gets the GCD of i and 3, and 5&| returns i modulo 5. The train 0:~:5&| returns 1 if 5&| is unequal (~:, or in the new version < because the result of 5&| will always be greater than or equal to 0) to the result of the constant function 0: (which returns 0 for any argument) and 0 otherwise, then getindex is a train that, from this value, subtracts +.&3 resulting in the return values given above.

The boring parts are the "0 which simply tells the verb to operate on atoms of any argument given to it, and >:i.100, which returns a list of integers from 1 to 100 (inclusive).

Using < instead of ~: saves a byte – Bolce Bussiere – 2019-04-06T16:42:26.877

1And (;,>)Fizz\Buzzinstead of'Fizz'(,>@;;)'Buzz' saves another 5 – Bolce Bussiere – 2019-04-06T16:56:47.183

1@BolceBussiere < instead of :~:? – ASCII-only – 2019-04-08T04:17:56.677

@ASCII-only the first : belongs to the verb 0: that returns the constant 0. The verb ~: represents 'not equal' – Bailis Cremey – 2019-04-09T17:29:37.367

Idk, using just constant 0 worked for me – ASCII-only – 2019-04-09T23:02:02.827

6

Whispers v2, 150 bytes

> 100
>> (1]
> "Fizz"
> "Buzz"
>> 3+4
> 0
>> Then 5 6 6 3 6 4 3 6 6 3 4 6 3 6 6
>> 7ⁿR
>> Each 8 2
>> L∨R
>> Each 10 9 2
>> Output L
>> Each 12 11


Try it online!

Maybe it could be improved, but programming in Whispers is driving me crazy. I'm starting to hear voices...whispering...in my head

Explanation

In Whispers, numbers in lines beginning with >>  refer to line numbers. Here is what each line is computing:

> 100                                   1:100
>> (1]                                  2:[1,2,...,100]
> "Fizz"                                3:"Fizz"
> "Buzz"                                4:"Buzz"
>> 3+4                                  5:"FizzBuzz"
> 0                                     6:0
>> Then 5 6 6 3 6 4 3 6 6 3 4 6 3 6 6   7:["FizzBuzz",0,0,"Fizz",0,"Buzz","Fizz"...]
(FizzBuzz without numbers for values 0 to 15)
>> 7ⁿR                                  8:Modular indexing function into the previous array
>> Each 8 2                             9:[0,0,"Fizz",0,"Buzz","Fizz",...]
(FizzBuzz without numbers for values 1 to 100)
>> L∨R                                  10:OR function
>> Each 10 9 2                          11:Zip with OR the arrays in lines 9 and 2
(Complete list of FizzBuzz values)
>> Output L                             12:Print function
>> Each 12 11                           13:Print each value in line 11


6

C++, 130126119 115

#include<iostream>
int i;int main(){for(auto&o=std::cout;++i<101;o<<'\n')i%3?o:o<<"Fizz",i%5?i%3?o<<i:o:o<<"Buzz";}


6

Snowman 1.0.2, 97 chars

)1vn101nR:du*_/3NmO0eQ)(#5NmO0eQ}~(~%@or(%nO?_/)#%@{%@tS?)aRsP@@"Fizz"_aRsP\"Buzz"aRsP?)10wRsP;aE


How does it work, you ask? ... I have no idea. I might edit in a full explanation at some point if I ever decide to try to understand this again.

(Pulled directly from Snowman's examples directory.)

6

Japt, 4544433936353332 31 bytes

Japt is a shortened version of JavaScript.

Lò1@"Fizz"pXv3)+"Buzz"pXv5)ªXÃ·


Try it online!

How it works

Lò1@"Fizz"pXv3)+"Buzz"pXv5)ª XÃ ·
Lò1@"Fizz"pXv3)+"Buzz"pXv5)||X} qR

Lò1       // Create the inclusive array [1...100].
@         // Map each item X in this range to:
"Fizz"p  //  "Fizz" repeated:
Xv3)    //   if X is divisible by 3, 1 time, otherwise, 0 times;
+        //  concatenated with
"Buzz"p  //  "Buzz" repeated:
Xv5)    //   if X is divisible by 5, 1 time, otherwise, 0 times.
||X      //  If the result is an empty string, set it to X.
} qR      // Join the range with newlines.
// Implicit: output last expression


Old version, 32 bytes:

Lo@"FizzBuzz"s°X%3©4X%5?4:8 ªXÃ·
Lo@"FizzBuzz"s++X%3&&4X%5?4:8 ||X} qR

Lo            // Create the range [0..100).
@             // Map each item X in this array to:
"FizzBuzz"s  //  "FizzBuzz".slice(
++X%3&&4    //   if ++X is divisible by 3, 0; else, 4,
X%5?4:8     //   if X is divisible by 5, 8; else, 4).
||X          //  If the result is an empty string, set it to X.
} qR          // Join the range with newlines.
// Implicit: output last expression


Alternate version (45 44 40 38 bytes): (Note: this doesn't work in the current version of Japt)

1o#e £(X%3?":Fizz" +(X%5?":Buzz" ªX} ·
1o#e m@(X%3?":Fizz" +(X%5?":Buzz" ||X} qR

1o#e          // Create an array of 1 to 100.
m@            // Map each item X in this array to:
(X%3?":Fizz" //  If X is divisible by 3, "Fizz"; else, an empty string
+            //  concatenated to:
(X%5?":Buzz" //  if X is divisible by 5, "Buzz"; else, an empty string.
||X          //  If the result is an empty string, set it to X.
} qR          // Join the range with newlines.
// Implicit: output last expression


Suggestions welcome!

6

Rotor, 32 31 bytes

1N2{3%!"Fizz"~5%!"Buzz"N$?~N}\  This has one unprintable, so here's a hexdump: 0000000: 314e 7f32 7b33 2521 2246 697a 7a22 7e35 1N.2{3%!"Fizz"~5 0000010: 2521 2242 757a 7a22 4e24 3f7e 4e7d 5c %!"Buzz"N$?~N}\


Explanation:

1  Push a one to the stack.
N  Push a newline.
^? Spooky invisible unprintable that pushes 100 to the stack.
2  Pushes a two to the stack.
{  Starts block.
3%      Takes mod 3 of the top number on the stack.
!"Fizz" If falsy, push "Fizz".
~       Push the contents of the register.
5%      Takes mod 5.
!"Buzz" If falsy, push "Buzz".
N$Compares the top value of the stack to a newline. (this doesn't pop the values off the stack) ?~ If truthy, push the contents of the register. N Push a newline. }\ For loop between 2 and 100, pushing the counter to the register and stack each time.  Try it online. (note that it is very slow) Check out Rotor. 5 MathGolf, 24 22 bytes ♀{î╕Σ╠δ╕┌╠δ+Γî35α÷ä§p  Try it online! Explanation ♀ Push 100 { Start block î Push loop counter (1-indexed) ╕Σ╠δ Decompress "Σ╠" and capitalize to get "Fizz" ╕┌╠δ Decompress "┌╠" and capitalize to get "Buzz"  Duplicate top 2 elements of stack + Add (creating "fizzbuzz") Γ Wrap top 4 elements of stack in array î Push loop counter (1-indexed) 3 Push 3 5 Push 5 α Wrap last 2 elements in array ÷ Check divisibility (implicit mapping) ä Convert from binary to int § Get array item p print End block on code end, for loop implicit (100 iterations)  @dzaima Darn, I forgot about that completely. I have however had a capitalization operator in mind for a while. That should add one byte to the solution, but it is not yet implemented. – maxb – 2018-09-12T19:33:42.730 I fixed the capitalization, at the cost of two bytes. – maxb – 2018-09-13T06:58:27.157 5 brainfuck, 628 499 bytes +[>>+>>+++<<[>+>->+<[>]>[<+>-]<<[<]>-]>>>[>>]<[>-[------->+<]>---.[--<+++>]<.-[---<+>]<-..<<<<[-]>>>>>>]<[-]<[-]<[-<+>]>+++++<<[>+>->+<[>]>[<+>-]<<[<]>-]>>>[>>]<[-[++++>---<]>-.++[-----<+>]<+.+++++..<<<<[-]>>>>>>]<[-]<[-]<[-<+>]<<<[[-]>>[-<+>>+<]>>>++++++++++<<[->+>-[>+>>]>[+[-<+>]>+>>]<<<<<<]>>>>>++++++++++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]>>[>++++++[-<++++++++>]<.<<+>+>]<[<[->-<]++++++[->++++++++<]>.[-]]<<++++++[-<++++++++>]<.[-]<[-]<[-<+>]<[-]<<[->+<]<]++++++++++.>>[-<+>>+<]-[<-->-----]<++]  This took me WAY too long. It's an extremely naive implementation with two divmods and a printing bit for Fizz and Buzz, as well as an equality check for 100. All in all not really golfed. At all. Not even a little bit. But it was fun, as this was my first ever real brainfuck program. I started this by purposely not looking at any of the other brainfuck answers, partly so I wouldn't get discouraged, and partly so I wouldn't even subconsciously use any other ideas. Any feedback or shrinkings are appreciated! Badly commented source code Try it online! 1Some quick golfing; There's some leftover whitespace in the code, and all the [-]s can be replaced with ,s (if you're okay with EOF being 0). At least one of the [-]s isn't necessary. The not of the modulo will probably be shorter with forking the movement instead ([>>]<), making sure the tape ends up the same afterwards – Jo King – 2019-02-28T02:26:31.327 1I don't think any of my implementations support EOF as 0, but I am interested in the unnecessary [-] clear cell and the [>>]<. Is there a chance you can suggest an edit? – ThePlasmaRailgun – 2019-02-28T05:35:40.307 596 bytes without whitespace and redundant [-]s. I think you'll find that most implementations use 0 as the EOF, and even the ones that don't usually use -1/255, which is still one byte shorter. I guess there's also no change, but that's rare. I'll work on the [>>]< part – Jo King – 2019-02-28T06:11:40.763 499 bytes. I've changed it to the [>>]< method I mentioned above, and golfed some other parts. I didn't really touch the print as a number part, so you can probably golf something there. – Jo King – 2019-02-28T08:02:09.877 5 Seed, 6015 bytes 186 83944644497775792185807323999861330742900673481712359255839929374667216476568023851764637813248013688693896717275687232066153870107749175160194707761486575005885313952906442913325967953944535811512056079183251514390746052490451307246213606447865255212286265116943188690839445165359981774554198082946825007384980162551436390435260155582466874315352220541140434954811560506556477075852586817070090764184077321583489797358147025926992986354865415277367374043398355163643621296927936732212800075642321038031920620549375319366961667358107695950468557182519902148699776620624078332688843597417318685229781090303723160175745852091928346724348001020777912570918121340035523698691520422590527296248455779012094897281946771732844646467975422651655880202725095981882371807518829844157636552230152953535332201239998966830698645115246907049972204010095894629001206397276344975636564553238199728981112245810583644580269593382612869323054013019350314231784293448249910440692956496060253971880373279161390518237118507378691330341470412624728172421405109963475552981299919837091765136501358887135317778357279769289706821629750840213676581513947891276551415821187603189444230553630205086966993211879390093045277089486589385876312541940492767981701353769007246001400130719416118275492304807198011860072050303044225722194337717896831470037434122578382321765362062455130027125953869723625862069785410531287781468150359623495258126317807476517184801674197008747267394632928708383370640309530427431150403028006421518064783676469959724647961395869176187323826585310379142853088186864023708457159764123364029018721951815248751431170413579315400528983481702298849209797951129827235189965388114007169146563257209800975334610910397591190300324319540160364733177122449656422045835924029442449258975425381755648345550014417207471617919736685787448764321614059138375253980386335770138273578332418379763049794151811098188219754733324389355566317376598492318359989945589480418455750455469859956801589082779968271578522034926104268403877968397758570110853038536860556853388613997493905742068279137736678857073233174739380697685907170886092925173057794582407478105690770633669349947638020604803238951194381273510993928897230197983256465537488284258216944902276278712201715008765995404107536372438956009631805114079400698265046614085687812688769068889878215788959245601084883372435344000194364054441952170474833494604130017222942459218768152451353838900515646024764453476453552863938005162079649698291854043301771100462916706520075039044805956181705047266329114921035274711980897862579454154525144505597823262540025190878917613039796282312555295659294071407630514652646787462515667390800389392114746442068094785615537685660298361617697365653764669207754605147347324074541222276275532258194690926246437097055706104108319469003781845674958634242078791475826910418111428349167152839025683587469305219626924263962611094845308744968793376752461012553325189830937237777556407663277494722334379175044299145527685100424059993166500276116324651034389342857099326382267792125696063602436504279969923412378117936327869017861642388185619118723658181098871790872093500520584752433465443515989483851486224923341213990357424279098636563794743080022540640677640107176034203326304825856510242291526956869439836743210321616337131260522898066320086593786007891762080406650341513081903510025534886914361255147039463158189995500627220823997958074917925862170348467342212390436963261050291735696261617106196786273505443408966191019872244618002281427523777003325474230066462489531195157755555344637353155356279454281010364750875012491070816465270498678197434494849001514802132418781410405222031814823702582955264273367316636558580379660009282902598817700470535664545017234816209988594892835104965686956867851308392004044845547855039571721575449154495443479356960829759209226823917197487855397504141411230632224369201022681688301238065753737278463677847356448662974398206270856674118500884955014781944009536761710654880983265123955150729759406311220705702903728217724237231225228243114081826682040349685205121446193821261139703572900811243143912445467975694459999888915923116875430564637390061881889161512304819029656014338113772447267072899546161543780769850725712979853265124144813517511575434597175140160445249538753447856073028845070404104820699013418827593400549228758486817648053770622330987136941236768786640613654490823959024174575959620155957372041756651311988259843620347948677131103848960623371212015137053539005334518693964703094514744873758157905983139622925587291886231049371800498250086745691716656644176053612172113439907334397406577774498757112425437339205922869531575921611548158798375762386782843394828401126984185115349224303420458491251207091698634206841378497320259972637725826224808114267917428717816623368840721796784587349258491132128347823644310226457190477267965710821892576687103122134712656694901146343938508484308662925632874468476850854977933467327214644382364732022885458172449643330918925157997124690072012401561398600599725096512808715148150880033416494352767432615596760722206416684175988533830899565642405659319720681197534141300323187308210290375660950200938389996580887564670049743784962037885099514826194024014058093062057706139814777110125812527054724707373942053107785831307633110641398607263726549612409340127167852023607787965086360296071952107945138419803900924977980375619565210182772121849111987355981226968062629667279278470647719759267716675652568099185449478479471691254158308189631416224208590609150412906273490206303890853713104183863050119383440553687111132467944761189779633340481533657859382354192428154204487886313458547651002779223927726608436086877353829832057341247094095114657693381028772025327489391112902949559367893876211447144802835381133403893955836438518252858893637260806405255643702579004661210305919494653119109150790218729956868835489222681506976514342204634574313468575534020458319909578144280137077342941741913678288702984697189445809519253013406175446129538246339672293879388869701830984873958965248  Try it online! Oh, my generator must have glitched. I'll look on this – Kamila Szewczyk – 2019-09-08T11:46:51.640 @JoKing Well, I should have tested my stuff before. Now it works – Kamila Szewczyk – 2019-09-08T12:25:28.060 5 Arn-hm, 27 22 18 bytes ─=█BƒHXåõÝü»ÝÑÕ=!&  Try it! Explained Unpacked: "Fizz"^!%3|#&^!%5|| Set STDIN to the range [1, 100] "Fizz" Literal string ^ Repeat ! NOT _ Implied variable % Modulo 3 | Concatenated with #& Compressed string "Buzz" ^ ! _ Implied % 5 || OR _ Implied Mapped over STDIN with key_  I wasn't going to update this, but might as well. 5 JavaScript, 79 bytes After a long time I tried to use JS again... Thanks to @ShadowCat we made it to 79 bytes: for(i=0,s="";i++<100;s+=(i%5?i%3?i:'Fizz':i%3?'Buzz':'FizzBuzz')+"\n");alert(s)  Old solution, 87 bytes: for(i=2,s="1";i<101;s+="\n"+["FizzBuzz","Buzz","Fizz",i][(i%3>0)+2*(i++%5>0)]);alert(s)  I recommend dropping the semi-colon at the end. Also I just used conditionals i%5?i%3?i:'Fizz':i%3?'Buzz':'FizzBuzz' and I got 79 bytes, so I recommend trying that. I would also avoid s="1" and just start i=1,s="" to save an extra byte – ShadowCat7 – 2015-09-24T20:44:55.223 1I was working on a ?: solution but I was not able to get it to work before you commented=) Thank you very much! (Honestly I am still proud of my array indexing solution=P) – flawr – 2015-09-24T20:50:50.833 A trailing newline is acceptable, but a leading newline is not. I don't like this rule, but it's a rule nevertheless – edc65 – 2015-09-24T21:16:34.120 77: change starting part i=s="". 76 using ES6 and template string for newline – edc65 – 2015-09-24T21:42:54.693 75: i recomment this for(i=0,s="";i++<100;s+=((i%3?'':'Fizz')+(i%5?'':'Buzz')||i)+"\n");alert(s), because it saves 6 – Nina Scholz – 2015-09-29T12:00:20.740 @NinaScholz Thanks! I am no more updating as there is another JavaScript version that is way shorter, by ETHproductions – flawr – 2015-09-29T15:29:19.570 5 Befunge-93, 82 81 bytes I'm sure this could be golfed, but I think this is a good start. 1+:::3%:#v_"zziF"v>*|>25*,:"!"3*#@_ v _v#:%5\< ,,,,<^ >^ < >\"zzuB",,,, ^ .#  Try it in this online interpreter. Attempts that didn't work 1+:::3%: #v_"zziF" v>*#v_>25*,:"!"3*#@_ v _v#:%5\ <>#,,,,,#<^ >.^ < >\"zzuB"^ ^  Tries to combine the printing of Fizz and Buzz. Ends up at 88 bytes. Vertical rendition of the above Forgot about newlines. 122 bytes. Ick. Without newlines it would be 122-41=81 bytes. Welp. 5 SQL (PostgreSQL flavour), 107 bytes SELECT(array[n||'','Fizz','Buzz','FizzBuzz'])[1+(n%3=0)::int+(n%5=0)::int*2]FROM generate_series(1,100)a(n)  Same sort of logic as my R answer 5 bc, 83 bytes Undeclared variables are zero by default, so i=0 can be omitted. The three line breaks are required. for(;++i<101;){if(!i%15)"FizzBuzz "else if(!i%5)"Buzz "else if(!i%3)"Fizz "else i;}  5 Haskell, 105 97 bytes main=mapM(putStrLn.f)[1..100] a%b=aremb<1 f n|n%15="FizzBuzz"|n%3="Fizz"|n%5="Buzz" f n=show n  I'm kinda new to Haskell, so any advice would be appreciated! first line could be main=mapM(print . f)[1..100] – ogogmad – 2015-09-25T11:34:30.777 You can write all the guards of f in a single line: f n|n%15="FizzBuzz"|n%3="Fizz"|n%5="Buzz". – nimi – 2015-09-25T15:21:40.670 I count 96 bytes. If you write f 3++f 5 instead of "FizzBuzz", you can save two more. Also, henkma on anarchy golf has 82 somehow. – Lynn – 2015-09-26T22:12:01.027 1 I posted an 85 byte answer. – Lynn – 2015-09-27T14:45:10.233 5 MATLAB, 94 bytes for i=1:100 t=mod(i,3);f=mod(i,5);s=[(t&f)*num2str(i) ~t*'Fizz' ~f*'Buzz' ''];disp(s(s>0));end  So this new code is a slight improvement on the one below. Rather than using arrayfun() which is quite costly in characters as it requires 'UniformOutput','false' to get it to work, I have simply made it a for loop - because the range of numbers is hard coded, there is no need to use a function as I had done in my last edit. Removing it from the function saves another 10 characters. This does basically the same thing, but rather than making all the strings first, in makes them one by one in a for loop and displays them. This actually also means char() only has to be used once (in the other one it was used a second time to display everything). Having the loop means I can use variables to store the results of mod(i,3) and mod(i,5) so they don't need calculating twice. The nonzeros() function has also now been removed, instead opting for storing to a variable then only printing anything which is not equal to zero. This solution when you run it also doesn't print ans= before the first line. Thanks to @flawr for the tips, saved 4 bytes. Old code: MATLAB, 118 bytes char(arrayfun(@(x) char(nonzeros([(mod(x,3)&&mod(x,5))*num2str(x) ~mod(x,3)*'Fizz' ~mod(x,5)*'Buzz'])'),1:100,'Un',0))  A bit of fun with multiplying strings with scalars. Basically the output of ~mod(x,5) and ~mod(x,3) are multiplied by 'Fizz' and 'Buzz' respectively which produces either zeros (blanks) or one or both of the words. (mod(x,3)&&mod(x,5))) is basically when the number is neither a multiple of 3 nor 5 which is multiplied by the number as a string to get either zeros or the number. These are then concatenated into an array which then has all of the zeros removed using nonzeros() and then resulting array transposed to be in the right direction for conversion to a character string. Finally once all numbers have been processed by arrayfun(), the resulting cell array of arrays is passed to char() which converts it to a cell array of strings. Because there is no ; at the end of the string, the output is dumped to the console. It might be possible to make it smaller, I'm looking ;) I like your solution! Just some hints, you can use [s,''] instead of char(s) (I'd add that in the disp.) Then if you have arguments like UniformOutput it usually suffices to just write U or Un (just as many letters needed for discerning the different possible arguments) and instead of true,false you can use 1,0 (or for true any finite value bigger but zero). This also means instead of s~=0 you can use ~s or if this does not work s>0 or s<0 depending on the application. – flawr – 2015-09-25T22:50:45.987 @flawr Thanks for the tips. I hadn't realised that appending '' converted to a char string. I've saved 4 more bytes. Added the '' to the s=[ ] bit as it does the same as adding it in disp() but without the cost of the extra []. Also the s>0 was a bit of a duh moment on my part! – Tom Carpenter – 2015-09-26T04:29:59.503 There is a Tipps for golfing in Matlab (and linked there one for golfing in Octave) might be worth reading (and expanding=). Happy golfing=) – flawr – 2015-09-26T10:04:24.597 5 Fortran, 213 bytes character(len=8)::o do i=1,100 if(mod(i,15)==0)then;write(*,*)'FizzBuzz' elseif(mod(i,3)==0)then;write(*,*)'Fizz' elseif(mod(i,5)==0)then;write(*,*)'Buzz' else;write(o,'(i8)')i;write(*,*)adjustl(o) endif;enddo;end  Not as graceful as the golf languages. I could save bytes using print instead of write, but print indents 1 space without a format specifier which would increase the byte count instead. Likewise I lose bytes printing the number because Fortran doesn't like left-justified output for numbers. I didn't bother sticking it all on one line as newlines and semicolons are both 1 byte -- no savings. 5 TI-BASIC, 59 bytes For(X,1,ᴇ2 int(ln(gcd(X,15→J ;[3 divides X] + [5 divides X] X If J sub("FizzBuzz",7-2gcd(X,3),4J Disp Ans End  Or at the same length: For(X,1,ᴇ2 gcd(X,15→J X If ln(J sub("FizzBuzz",5^(J=5),4int(ln(J Disp Ans End  Both programs use the fact that ⌊ln(3)⌋ = ⌊ln(5)⌋ = 1 and ⌊ln(15)⌋ = 2. There could be another byte to golf off somewhere, but I can't find it. By comparison, here's the naïve approach at 67 bytes: For(X,1,ᴇ2 "Fizz If fPart(X/3:X If not(fPart(X/5:"Buzz If not(fPart(X/15:"FizzBuzz Disp Ans End  TI-BASIC's quirks lengthen the program in two ways: • TI-BASIC needs two bytes to encode every lowercase letter other than i (which represents the imaginary unit). • Empty strings are not supported: sub("FizzBuzz",5,0 and ""+"Buzz" both throw errors. Wouldn't moving X to the 2nd to last line shave a byte? (Disp X?) (For the seond one) – Conor O'Brien – 2015-09-29T00:08:32.353 Here are my suggested revisions (I don't have my calculator handy, so I'm not sure if it remains the same.) – Conor O'Brien – 2015-09-29T00:49:02.527 Ohhhh I see. The Ans functionality sometimes confuses me. Sorry if I sounded pretentious ;) – Conor O'Brien – 2015-09-29T00:53:21.457 I found a byte on the "naive" solution by storing "Buzz" to Str2 then "Fizz" to Str1 at the beginning of the loop, leaving "Fizz in Ans so lines 5 and 6 can use Str2 and Str1+Str2. Also by my byte counts following token size here: http://tibasicdev.wikidot.com/one-byte-tokens The naive solution is 70 bytes to the above 69. Between the optimal solutions, the one that does not precompute int(ln( on gcd(X,15 should be the smallest at 60 bytes to 61 for the other. – TiKevin83 – 2019-11-22T16:34:50.023 5 Groovy, 69 Bytes (1..100).each{i->println i%15?(i%5?(i%3?i:'Fizz'):'Buzz'):'FizzBuzz'}  2Can save 2 bytes using 1.upto(100){} and no parenthesis are needed in your answer, resulting in: 1.upto(100){i->println i%15?i%5?i%3?i:'Fizz':'Buzz':'FizzBuzz'}​ +1 though :). – Magic Octopus Urn – 2016-10-13T17:49:14.960 5 Bash + coreutils, 41 bytes seq 100|sed 5~5cBuzz|sed 3~3s/[^B]*/Fizz/  You can't seem to do better without cheating: the 12-byte answers on that server simply invoke its gs2 interpreter with a 1-byte FizzBuzz program... 5 GolfScript, 37 bytes 100,{)..3%!'Fizz'*\5%!'Buzz'*+\or n}/  5 Transact-SQL, 163143124 110 bytes This requires SQL Server 2012+ (thanks MickyT for the unnamed variable and the IIF suggestions, changed to muqo's GOTO loop instead of WHILE) declare @ int=1a:print iif(@%3*@%5>0,ltrim(@),iif(@%3=0,'Fizz','')+iif(@%5=0,'Buzz',''))set @+=1IF @<101GOTO a  Formatted and explained: declare @ int=1 --@ is a valid variable name a: --shorter than WHILE print iif(@%3*@%5>0, ltrim(@), --ltrim is shorter than explicit cast iif(@%3=0,'Fizz','') --nest the IIFs + iif(@%5=0,'Buzz','')) set @+=1 IF @<101 GOTO a  Hello, and welcome to PPCG! Great answer! Can you please add an explanation? – NoOneIsHere – 2016-05-06T02:06:08.947 Sure thing I'll include the ungolfed version, it's just a while loop – Phrancis – 2016-05-06T02:06:59.893 I feel a bit privileged that in many languages you can't use expressions in case statements, but also a bit sad that the Oracle SQL person got fewer bytes... – Phrancis – 2016-05-06T06:15:00.430 @MickyT thanks for the advice! However the way you wrote it produces FiBuzz for 15 and others, just FYI, and the @ number needs to be cast to a string – Phrancis – 2016-05-07T01:19:17.860 @MickyT got it down to 143 thanks to your suggestions! – Phrancis – 2016-05-07T01:34:08.957 Sorry about that, SQL fiddle didn't want to play for me.. – MickyT – 2016-05-07T01:34:51.200 You may want to try the last iif with no cast and a NULL instead of an empty string, otherwise the concat can be replaced with +. don't know what i was thinking when I first suggested it. also char may work if the cast can't be removed. – MickyT – 2016-05-07T01:53:50.583 I think casting to char might violate the rules of the contest, since it will pad with spaces when the number is less characters than the specified amount... – Phrancis – 2016-05-07T03:55:22.037 @MickyT the iif(@ % 3 * @ % 5 <> 0, @ , null) worked great, wow – Phrancis – 2016-05-07T03:59:58.263 Using + instead of concat made it to where the cast would be needed again, so based on character count I stayed with concat – Phrancis – 2016-05-07T04:08:01.107 1Good work, but this needs more golfing. Use GOTO, not WHILE. Skip CONCAT because you need to force only @ to be a string, so just enclose it in LTRIM or something. Use + for the Fizz and Buzz IIFs, and nest that in the IIF for the other numbers. Remove as many spaces as possible. I can get your entry down to 110 doing all that. – Muqo – 2016-07-21T13:59:29.513 1Code and explanation didn't match. Took the opportunity to edit in @Muqo's suggestions. – BradC – 2018-04-19T17:32:10.927 4 8086 machine code, 70 68 62 bytes 00000000 31 c0 40 50 89 c2 89 e5 68 0a 24 d4 05 75 06 68 |1.@P....h.$..u.h|
00000010  7a 7a 68 42 75 89 d0 d4  03 75 06 68 7a 7a 68 46  |zzhBu....u.hzzhF|
00000020  69 89 d0 83 fc fa 75 08  d4 0a 86 c4 0d 30 30 50  |i.....u......00P|
00000030  b4 09 89 e2 cd 21 89 ec  58 3c 64 75 c5 c3        |.....!..X<du..|
0000003e


How it works:

            |   org 0x100
|   use16
31 c0       |       xor ax, ax
40          |   aa: inc ax
50          |       push ax
89 c2       |       mov dx, ax
89 e5       |       mov bp, sp
68 0a 24    |       push 0x240a
d4 05       |       aam 5
75 06       |       jnz @f
68 7a 7a    |       push 0x7a7a
68 42 75    |       push 0x7542
89 d0       |   @@: mov ax, dx
d4 03       |       aam 3
75 06       |       jnz @f
68 7a 7a    |       push 0x7a7a
68 46 69    |       push 0x6946
89 d0       |   @@: mov ax, dx
83 fc fa    |       cmp sp, -6
75 08       |       jne @f
d4 0a       |       aam 10
86 c4       |       xchg al, ah
0d 30 30    |       or ax, 0x3030
50          |       push ax
b4 09       |   @@: mov ah, 0x09
89 e2       |       mov dx, sp
cd 21       |       int 0x21
89 ec       |       mov sp, bp
58          |       pop ax
3c 64       |       cmp al, 100
75 c5       |       jne aa
c3          |       ret


This is very nice and very clean work! Using the stack is quite elegant! Technically PUSH immediate was not available on the 8086, so this is really 80186+ machine code. Also, not sure if it's allowed or not, but this does show leading 0's on single digit numbers (01 02 Fizz 03, etc). – 640KB – 2019-08-28T01:04:05.917

4

Fortran, 188 bytes

do i=1,100
if(mod(i,3)==0.and.mod(i,5)==0)then;print'(a)','fizzbuzz'
elseif(mod(i,3)==0)then;print'(a)','fizz'
elseif(mod(i,5)==0)then;print'(a)','buzz'
else;print'(i0)',i
end if;enddo;end


2Welcome to PPCG! – Martin Ender – 2017-08-03T15:32:43.580

1...change print'(a)' etc. to print* to save 16 bytes – roblogic – 2019-04-05T14:49:04.297

I never used print* as it prints the characters with a space or two before hand, thus it doesn't match the required format. – lewisfish – 2019-04-15T14:09:38.537

4

Befunge-93, 61 bytes

1+::::3%|>.#_:"c"#@_55+,
,,:,,0\v>"ziF"
,:,,$01>>5%#v_"zuB",  Try it online! Decided to come back to this and make it conform to specification while shaving some bytes off. Look, no extra spaces! 4 Symbolic Python, 324 bytes I think I fried my brain making this... _____=_;_=-~(_==_);___=_**(_*_+_);____=___+___/_+_+_ ___=(('%'+'¬'[-_])*_)%(___+_,___*_-_*_-_) ___=_>_[_>_]+__[_*_+_]+___[~-_]*_,___[-_]+__[_]+___[~-_]*_ _=_>_ __('____=""'+(';_=-~_;____+=((_%-~-~(_==_)<(_==_))*___[_>_]+(_%-~-~-~-~(_==_)<(_==_))*___[_==_]'+_____[_==_]+_==_[_==_]+'_)+'+""" """)*____) _=____  Try it online! 4 Hexagony, 77 76 bytes =?3})"F\>%'5?\"\B;u;"}/4;d'%<>\g/"!{{\}.%<@>'...<>,}/${;;z;i;z;;$/<>?{$/"./_


Try it online!

Same side length as M L's solution, but a bit smaller.

Expanded:

      = ? 3 } ) "
. \ > % ' 5 ?
\ F \ B ; u ; "
} " / ; d ' % < >
\ g 4 / ! { { \ } .
% < @ . > " ' . < > ,
} / ${ ; ; z ; i ; z ; ;$ / < > ? {
$/ " . / _ . . . . . . . . . . . . . . .  Coloured 77 byte version (only difference is the bottom right corner): • Green: The general outline of the loop • Light Blue: "Fizz" printer • Dark Blue: "Buzz" printer • Yellow: Number printer • Red: Terminator path How it Works: Memory Model: • Num: The counter • Mod: The number we are moduloing(?) with the counter • Temp: Our calculation edge • Check: The FizzBuzz check Below I'll be referring to the instructions as they are executed, ignoring no-ops and direction changes. At the start we execute =?3})"%< which increments the counter (initially 0) and checks whether it is divisible by 3. If so, we branch up and execute "F;i;z;;{ which prints "Fizz" in the check edge and returns to the temp edge. }?5'%>: Now we check if the number is divisible by 5. If so, B;u;"z;; prints "Buzz" in the check edge (the " is out of place to prevent printing an excess character at termination). If not, we execute an extra instruction to switch to the check edge. If Fizz and/or Buzz has been printed, the check edge has a leftover "z" in it, else it is 0. If it is a 0, we execute z{{!"'} which puts a z in the check edge and prints the number before returning to the check edge and executing the check again. Now the check edge has a "z" in it no matter what, so we branch to the ?{}g4; which prints a newline. Finally, d'% checks if the number is divisible by 100. If so, it terminates. Otherwise, it moves to the start of the loop. 4 Brain-Flak, 474 470 446 438 420 412 bytes -18 bytes thanks to Nitroden! -8 thanks to Wheat Wizard (((()()()()()){}){}){({}[(()())]((((())))))}{}{({}<>)<>({}<>)<>({}()()<>)<>}<>{}{}{([{}]())({()<(({}())()){(<{}>)((((()()()())())((((({}{}){})[()]){}){}()))){({}<>)<>}}{}{(<{}>)(((((()()()())({})){}())(({})({}())({}{})))){({}<>)<>}}>}{}[()]){([](<>))<>((()()()()()){}){(({}<({}())>)){({}[()])<>}{}}{}<>([{}()]{}<>)<>{({}<>)(<>)}}{}(<>)<>}<>{}{{({}((((()()()){}){}){}){}<>)<>}({}(()()()()()){}<>)<>}<>{({}<>)<>}<>  Try it online! Gosh, it's nice to finally check this off my to-do list. Explanation: Brain-Flak is obviously not very good at getting the modulo of numbers, so I bypassed this by pushing all the elements first. (((()()()()()){}){}) Push 20 { Loop 20 times ({} [(()())] Push a 2 to represent a Buzz ((((())))) Push 4 1s ) And decrement loop counter }{} Pop the excess 0 { Loop over the list of numbers ({}<>)<>({}<>)<> Transfer two of the elements to the other stack ({}()()<>)<> And add 2 to the last one }<>{}{} Pop the excess two elements  Now 1 represents normal numbers, 2 represents Buzz, 3 is Fizz and 4 represents FizzBuzz. Initially I just pushed the values that repeat every 15 numbers 7 times and popped the excess 5, but this way turned out to be slightly shorter. { Loop over each element ([{}]()) Subtract one from the current element ({ Fizz and/or Buzz if num is not 1 <(({}())()) Subtract 1 and push, twice { Push Buzz if num was not 3 (<{}>)((((()()()())())((((({}{}){})[()]){}){}()))){({}<>)<>} }{} { Push Fizz if num is not 2 (<{}>)(((((()()()())({})){}())(({})({}())({}{})))){({}<>)<>} } > () }{}[()]) Push -1 if neither Fizz nor Buzz were pushed { ([](<>)) Push length of list to other stack <>((()()()()()){}) Push 10 as the mod Div/mod algorithm {(({}<({}())>)){({}[()])<>}{}}{}<>([{}()]{}<>)<> Pushes n%10 to output stack and n/10 to the list stack { If div is not 0 ({}<>) Push it to the other stack (<>) Push 0 } }{} Pop excess 0 (<>)<> Push 0 to other stack to represent a newline }<>{} Pop extra newline { Loop over values { ({}((((()()()){}){}){}){}<>)<> Add 48 to every value } ({}(()()()()()){}<>)<> Turn 0s into newlines } Until there's two 0s in a row <>{({}<>)<>}<> Reverse output  1Fizz in 44 bytes – Nitrodon – 2018-05-16T18:00:42.337 1Buzz in 44 bytes – Wheat Wizard – 2018-07-19T04:00:55.080 4 Rattle, 54 bytes Fizz&Buzz|!sSs1S1s2P3[g+R1bs%3[0b1b^0]g%5[0b2b^0]B]100  Try it online! This is my first answer in my new programming language! Please note: this language is not available yet on TIO, but because the interpreter itself is in Python 3, then I can still provide links to my answers. For these answers, the interpreter itself is in the header while the code for Rattle is in the actual code section. Eventually, Rattle will probably be added to TIO and the above code will run natively. If you hit run on TIO, this code will still produce the correct output. I am also still open to suggestions for what to name my language - Rattle is simply a placeholder. If you're interested in learning this new language, I would recommend you wait about a week. I admit, the documentation is not great yet but I'm working on improving it. Eventually, this programming language might have a more concise way to solve this challenge. Explanation Fizz&Buzz is a hard-coded input which gets split automatically into a list | signals the end of the input ! is a flag to disable implicit printing at EOF sS saves the list to memory slot 0, selects the first index of the list s1S1 saves this to memory slot 1, selects list index 2 s2P3 saves this to memory slot 2, moves pointer to slot 3 [ start outer loop g+R1bs gets value at slot 3 (initialized to zero), increments, reformats it as an integer, appends it to a buffer, saves it to slot 3 %3 takes the current value on stack and pushes the value mod 3 to stack [0b1b^0] if the value on stack is equal to 0, concatenates value from memory slot 1 to a buffer and nullifies the 0th element of the buffer g%5 pushes value from slot 3 to stack, takes the value and pushes the value mod 5 to stack [0b2b^0] if the value on stack is equal to 0, concatenates the value from memory slot 2 to the buffer and nullifies the 0th element of the buffer if not null already B if the buffer is non-empty, prints buffer ]100 end outer loop - repeats 100 times  4 Kakoune, 57 bytes !seq 100 %s[05]$
Ab<esc>%s(\w+\n){3}
<a-h>s\d+
cFizz<esc>%s\d*b
cBuzz


Explanation:

!seq 100               Call the external sh command seq 100, insert the output (numbers 1-100)
d                      ! inserts a trailing newline, delete it
%s[05]$Select all lines ending with 0 or 5, which is equivalent to being divisible by 5 Ab<esc> Append a b to these lines, signifying that they should be buzzed later on %s(\d+b?\n){3} Select every third line <a-h>s\d+ Select every third number (unselecting the b's) cFizz<esc> Replace with Fizz %s\d*b Select (including 0) digits followed by a b cBuzz Replace with Buzz  1Welcome back to CGCC! – Razetime – 2020-11-11T13:21:40.117 4 Java, 1009895 94 Bytes (only loop, full code is 136 bytes, see bottom) for(int i=0;i++<100;){var s=i%3<1?"Fizz":"";s=i%5<1?s+"Buzz":s;System.out.println(s==""?i:s);}  Try it here. Probably could be a lot smaller. I just started to learn java a few days ago (although I do have experience in other languages), this is the best I can do. Breakdown of how it works. Sorry if I get some terms wrong or explain stuff poorly: for(int i=0;i++<100;)  Just the loop - starts at 1 goes to 100: {var s=i%3<1?"Fizz":"";  Making a variable called "s", equal to a value, if "i" is divisible by 3 with a remainder of less than 1 (1 character/byte smaller than checking ==0), set "s" equal to "buzz". If it isn't, set it equal to "". s=i%5<1?s+"Buzz":s;  Set s equal to a value: if i is divisible by 5 with a remainder of less than 1, set s equal to s + "buzz", if it isn't, set it equal to itself. System.out.println(s==""?i:s);}  System.out.println is just a simple print statement. Inside it, check if s is equal to "" (if s wasn't divisible by 3 or 5, it would be "") print i (the number), otherwise print s. Feedback is greatly appreciated. Edit: 94 bytes for just the loop, below is what I think the full script would be, 136 bytes : ( interface f{static void main(String[]a){for(int i=0;i++<100;){var s=i%3<1?"Fizz":"";s=i%5<1?s+"Buzz":s;System.out.println(s==""?i:s);}}}  1 Welcome to Code Golf, nice first answer! You may want to check out Tips for golfing in Java. – Redwolf Programs – 2021-01-30T21:19:02.247 4 Perl 6, 109 93 bytes for$i(1..100){if($i%3<1){say"Fizz"};if($i%5<1){say"Buzz"};if($i%3>0&&$i%5>0){say$i};say"\n";}  There might be some more golfing potential here. Takes advantage the fact that 0 is the only way x % y can be less than 1 (thanks to Alex. A for shaving off 4 bytes with this) and Perl 6's say keyword. I didn't spot this somehow... Sorry, If you'd like to adopt some of the ideas in my answer you can save more bytes! say is available in Perl 5 too for free (http://meta.codegolf.stackexchange.com/q/273#answer-274) and it includes a newline (which would further shorten mine by 5 bytes). Happy to remove mine (since it's newer than yours). – Dom Hastings – 2015-09-24T20:26:12.677 4 Lua, 88 86 bytes Saved 2 bytes thanks to @Mauris I'm sure this can be golfed more, any suggestions are welcome. for i=1,100 do n=(i%3<1 and"Fizz"or"")..(i%5<1 and"Buzz"or"")print(n~=""and n or i)end  Try i%3<1 and i%5<1? – Lynn – 2015-09-26T22:25:09.157 82 bytes: for i=1,100 do s=('Fizz'):sub(i%3*5)..('Buzz'):sub(i%5*5)print(s==''and i or s)end – Lynn – 2015-09-27T21:56:24.357 I posted a 72-byte solution that ties the record on anarchy golf. – Lynn – 2015-09-27T22:19:51.457 4 PowerShell, 59 58 bytes Original used array selection, but was one byte longer than a minor variation of TimmyD's answer old: 1..100|%{@($_,"Fizz","Buzz","FizzBuzz")[!($_%3)+2*!($_%5)]}

new: 1..100|%{"Fizz"*!($_%3)+"Buzz"*!($_%5)+"$_"*!!($_%3*$_%5)}  The only real trick involving use of double negation to make anything non-zero a 1 while leaving a zero a zero. I would have left this as a comment on TimmyD's answer, but I lack the reputation. EDIT: GAH! I see, now, that the original array implementation was naive insofar as my not having read through the other solutions and realizing that it was already in use ... multiple times over. I leave it here, but shamefacedly admit my ignorance. Welcome to PPCG! Nice to see another PowerShell user around. Neat trick with the array-indexing, and further proof that PowerShell is nothing if not flexible. Note that, in this particular instance, you don't need to prepend the @ symbol, since PowerShell treats any comma-separated list as an array, saving a byte on that guy and making the two the same length. See an update on my answer as well, incorporating other suggestions. – AdmBorkBork – 2015-09-25T13:08:56.573 4 SWI-Prolog, 109 bytes forall(between(1,100,I),((I mod 3<1,print('Fizz');1=1),(I mod 5<1,print('Buzz');I mod 3>0,print(I);1=1),nl)).  How is this supposed to be run? I would suggest +X:-print(X)., but it appears this is run from the REPL. Néanmoins, I mod 3>0,print(I);1=1 can become I mod 3<1;print(I). Also anagol has 87 bytes (in anagol, the m/0 predicate is run) for FizzBuzz http://golf.shinh.org/p.rb?FizzBuzz#Prolog – user41805 – 2019-12-14T10:51:05.163 4 Beam, 307 288 bytes And now for the longest solution. I think I could compress this a bit more, but the brain is getting a little fried. I'm pretty happy I got it working though. Rearranged it slightly to gain a few. +P'++P'++P'''''''>++ \/+)@'''''>+++++++)@' \ vP'''----(+++++++++/+/P+++'L@@++(+++++<''/ >'p-n'''''''>++++++++/ ^ >'P'p-n' >'p-n'''''''''''>++++++)@'''''''>++ \ ^ < >p:L''p- >''Pv ^ HuP-p'''L@++++++++++LP+p <P+++++''L@@+++++@++(+++++/  var ITERS_PER_SEC = 100000; var TIMEOUT_SECS = 50; var ERROR_INTERRUPT = "Interrupted by user"; var ERROR_TIMEOUT = "Maximum iterations exceeded"; var ERROR_LOSTINSPACE = "Beam is lost in space"; var code, store, beam, ip_x, ip_y, dir, input_ptr, mem; var input, timeout, width, iterations, running; function clear_output() { document.getElementById("output").value = ""; document.getElementById("stderr").innerHTML = ""; } function stop() { running = false; document.getElementById("run").disabled = false; document.getElementById("stop").disabled = true; document.getElementById("clear").disabled = false; document.getElementById("timeout").disabled = false; } function interrupt() { error(ERROR_INTERRUPT); } function error(msg) { document.getElementById("stderr").innerHTML = msg; stop(); } function run() { clear_output(); document.getElementById("run").disabled = true; document.getElementById("stop").disabled = false; document.getElementById("clear").disabled = true; document.getElementById("input").disabled = false; document.getElementById("timeout").disabled = false; code = document.getElementById("code").value; input = document.getElementById("input").value; timeout = document.getElementById("timeout").checked; code = code.split("\n"); width = 0; for (var i = 0; i < code.length; ++i){ if (code[i].length > width){ width = code[i].length; } } console.log(code); console.log(width); running = true; dir = 0; ip_x = 0; ip_y = 0; input_ptr = 0; beam = 0; store = 0; mem = []; input = input.split("").map(function (s) { return s.charCodeAt(0); }); iterations = 0; beam_iter(); } function beam_iter() { while (running) { var inst; try { inst = code[ip_y][ip_x]; } catch(err) { inst = ""; } switch (inst) { case ">": dir = 0; break; case "<": dir = 1; break; case "^": dir = 2; break; case "v": dir = 3; break; case "+": ++beam; break; case "-": --beam; break; case "@": document.getElementById("output").value += String.fromCharCode(beam); break; case ":": document.getElementById("output").value += beam; break; case "/": dir ^= 2; break; case "\\": dir ^= 3; break; case "!": if (beam != 0) { dir ^= 1; } break; case "?": if (beam == 0) { dir ^= 1; } break; case "|": switch (dir) { case 2: dir = 3; break; case 3: dir = 2; break; } break; case "_": switch (dir) { case 0: dir = 1; break; case 1: dir = 0; break; } break; case "H": stop(); break; case "S": store = beam; break; case "L": beam = store; break; case "s": mem[beam] = store; break; case "g": store = mem[beam]; break; case "P": mem[store] = beam; break; case "p": beam = mem[store]; break; case "u": if (beam != store) { dir = 2; } break; case "n": if (beam != store) { dir = 3; } break; case "": --store; break; case "'": ++store; break; case ")": if (store != 0) { dir = 1; } break; case "(": if (store != 0) { dir = 0; } break; case "r": if (input_ptr >= input.length) { beam = 0; } else { beam = input[input_ptr]; ++input_ptr; } break; } // Move instruction pointer switch (dir) { case 0: ip_x++; break; case 1: ip_x--; break; case 2: ip_y--; break; case 3: ip_y++; break; } if (running && (ip_x < 0 || ip_y < 0 || ip_x >= width || ip_y >= code.length)) { error(ERROR_LOSTINSPACE); } ++iterations; if (iterations > ITERS_PER_SEC * TIMEOUT_SECS) { error(ERROR_TIMEOUT); } } } <div style="font-size:12px;font-family:Verdana, Geneva, sans-serif;">Code: <br> <textarea id="code" rows="6" style="overflow:scroll;overflow-x:hidden;width:90%;">+P'++P'++P'''''''>++ \/+)@'''''>+++++++)@' \ vP'''----(+++++++++/+/P+++'L@@++(+++++<''/ >'p-n'''''''>++++++++/ ^ >'P'p-n' >'p-n'''''''''''>++++++)@'''''''>++ \ ^ < >p:L''p- >''Pv ^ HuP-p'''L@++++++++++LP+p <P+++++''L@@+++++@++(+++++/ </textarea> <br> <input id="run" type="button" value="Run" onclick="run()"> <input id="stop" type="button" value="Stop" onclick="interrupt()" disabled="disabled"> <input id="clear" type="button" value="Clear" onclick="clear_output()">&nbsp; <span id="stderr" style="color:red"></span> </p>Output: <br> <textarea id="output" rows="6" style="overflow:scroll;width:90%;"></textarea> <br>Input: <br> <textarea id="input" rows="1" style="overflow:scroll;overflow-x:hidden;width:90%;"></textarea> <p>Timeout: <input id="timeout" type="checkbox" checked="checked">&nbsp; <br> </div> Explanation +P'++P'++P'''''''>++ \ vP'''----(+++++++++/  Initializes the program, presetting values in memory Memory 0, value 1, count incrementer Memory 1, value 3, div 3 decrementer Memory 2, value 5, div 5 decrementer Memory 3, value 99, loop decrementer >'p-n >'P'p-n >p:L''p-  Gets value from Memory 1, decrements it, sets Store to 0. If value <> 0 change direction down, otherwise pass though. Do the same with Memory 2. Finally if it gets down there, print out the current counter from memory 0.  /+)@'''''>+++++++)@' \ +/P+++'L@@++(+++++<''/ '''''''>++++++++/  Prints Fizz and resets memory slot 1 to 3.  >'p-n'''''''''''>++++++)@'''''''>++ \ P+++++''L@@+++++@++(+++++/  Another div 5 checker to catch FizzBuzzs. Prints out Buzz and resets memory slot 2 to 5.  >''Pv HuP-p'''L@++++++++++LP+p <  Increments the counter, prints a newline, decrements the loop counter and exits if required. 4 Pip, 32 31 bytes LhP J["Fizz""Buzz"]X!*++i%^35|i  Try it online! Explanation LhP J["Fizz""Buzz"]X!*++i%^35|i Preinitialized variables: h=100, i=0 Lh Loop 100 times: ^35 Split 35 into a list of digits: [3 5] ++i Pre-increment i (thus starting at 1, not 0) % Mod (vectorizing); our list is now [i%3 i%5] !* Map logical not to that list (1 if mod was 0, else 0) ["Fizz""Buzz"] List containing Fizz and Buzz X Repeat string (vectorizing) Our two items are now: "Fizz" if i is divisible by 3, "" otherwise "Buzz" if i is divisible by 5, "" otherwise J Join that list into a single string P |i Logical or with i, and print  4 Python 3, 59 bytes Based on @feersum's answer. for i in range(100):print(i%3//2*"fizz"+i%5//4*"buzz"or-~i)  1looks like this has the wrong capitalization – ASCII-only – 2020-05-08T06:57:53.580 4 C (83 characters) Because misusing a (POSIX conformant) printf is not that bad, after all: i;main(){while(++i<101)printf(i%3?i%5?"%2$d\n":"%s\n":"Fizz%s\n",i%5?"":"Buzz",i);}


4

SQL (Oracle), 112 108 bytes

SELECT NVL(DECODE(MOD(LEVEL,3),0,'Fizz')||DECODE(MOD(LEVEL,5),0,'Buzz'),LEVEL)FROM DUAL CONNECT BY LEVEL<101


db<>fiddle here

1''||LEVEL can be simple replaced with level – Dr Y Wit – 2019-08-28T14:15:55.633

4

Seriously, 36 bytes

2╤R;;3@%Y"Fizz"*)5@%Y"Buzz"*(+;IMi


Explanation:

2╤   push the value 10**2 (100)
R       pop a: push range(1,a+1)
       start function literal
;;      duplicate the top of the stack twice
3       push the value 3
@       swap the top 2 values
%       pop a,b: push a%b
Y       pop a: push 1 if a==0, else 0
"Fizz"  push the string "Fizz"
*       pop a,b: push a*b (in this case, "Fizz" repeated b times)
)       rotate the stack right by one ([a,b,c] -> [c,a,b])
5@%Y"Buzz"*   Do the same thing as above, but with divisibility testing for 5 and using "Buzz"
(       rotate the stack left by one
+       pop a,b: push a+b (string concatenation here)
;       dupe top of stack
I       pop a,b,c: push b if a is truthy, else c (here, a and b are the same string, either "", "Fizz", "Buzz", or "FizzBuzz", and c is the original integer)
end function literal
M       pop f,[a]: using each element of [a] as a temporary stack, evaluate f, and push the result
i       flatten [a] (push each value in [a] to the stack, starting from the end to preserve order)


Methinks you need a logical NOT in Seriously. – lirtosiast – 2015-11-10T23:11:17.673

@ThomasKwa Maybe. I was wishing it had one while I was writing this. Seriously has ~, which is unary bitwise negation, which is not quite the same thing. I might add one. – None – 2015-11-10T23:13:31.280

4

Perl 6, 46 bytes

say "Fizz"x $_%%3~"Buzz"x$_%%5||$_ for 1..100  2You can remove the spaces after x – Jo King – 2019-01-06T03:27:42.827 4 Word VBA, 124 189 bytes Sub f() For i=1 To 100 r="" If i Mod 3=0 Then r="Fizz" If i Mod 5=0 Then r=r & "Buzz" If r="" Then r=i Debug.?r Next End Sub  The code breakdown is fairly simple (yay, BASIC). 1. Loop from 1 to 100 For i=1 To 100  2. Set a variable to be an empty string r=""  3. Check the value on the counter to see if we should set the variable to Fizz If i Mod 3=0 Then r="Fizz"  4. Check the counter to see if we need to add Buzz (adding it to an empty string is the same as setting that variable to Buzz) If i Mod 5=0 Then r=r & "Buzz"  5. Check to see if the variable is still empty and therefore needs to be set to the counter value If r="" Then r=i  6. Prints the results to the immediate window t = t & r & vbCr  EDIT: Used @Taylor-Scott's suggestions to tighten it up. Relies on the meta discussion about counting characters when your IDE forces whitespace. Specifically the conclusion that if you can paste the code from the answer into the IDE and run it without issues, then you don't have to count the results of autoformatting. Actually, the spacing after paragraphs is just a display thing. The plain text output will not have this spacing. :-) If you could add a code breakdown and explanation, this would have my upvote. – wizzwizz4 – 2016-04-22T16:47:39.400 Yes, those are the words I was looking for. Ta! – phrebh – 2016-04-22T17:57:19.050 +1, as promised! I have however noticed some irritating spaces around certain operators; can those be removed, or is it a language "feature"? – wizzwizz4 – 2016-04-22T19:15:08.677 @wizzwizz4 Unfortunately, those spaces are a limitation of the language. The IDE forces them in there and you can't get around using the IDE. One of the many, many reasons that VBA is not a good candidate for code golf. – phrebh – 2016-04-25T19:03:33.437 @phrebh can you write in a non-IDE e.g. notepad++, textedit, etc. and run as VB? – Rɪᴋᴇʀ – 2016-05-05T21:09:34.037 @phrebh the spaces are a "readability feature" of the VBE, not a limitation of the language AFAIK; I believe the code would still be valid VBA (per language specs) without the extra spaces that the VBE puts in. – Mathieu Guindon – 2016-05-07T01:43:22.040 You can drop quite a few bytes by following the tips that the community has outlined here, - of note you should consider outputting via Debug.? rather than to the document - using this you should be able to get this down to 110 bytes or less – Taylor Scott – 2017-12-07T07:56:15.457 The IDE force-converts Debug.? to Debug.Print – Selkie – 2019-02-25T22:53:07.143 @Selkie Yes, but as pointed out by Taylor Scott, the entered number of characters is what matters. – phrebh – 2019-02-27T22:10:56.400 4 Javascript, 64 bytes for(i=0;++i<101;)console.log((i%5?'':'fizz')+(i%3?'':'buzz')||i)  I'm not sure, but I think we allow alert for js output which would save you a few bytes. Nice answer btw. – Maltysen – 2016-05-06T01:43:19.730 1We do allow alert. – Rɪᴋᴇʀ – 2016-05-06T01:48:19.893 1All of the other JS answers on this particular challenge use console.log, except for one that outputs the entire text at once. – ETHproductions – 2016-11-26T15:09:50.523 3 Javascript, 56 bytes for(f=0;f++<100;alert(f%5?b||f:b+'Buzz'))b=f%3?'':'Fizz'  Assuming 100 alerts is an acceptable output method. 1 Nice answer, but it's already been posted (That one originally used alert as well, but it was changed to console.log because all the other JS answers do the same) – ETHproductions – 2017-03-22T21:46:24.690 3 APL, 41 bytes ⊣{⎕←∊(z,⍱/z←0=3 5|⍵)/'Fizz' 'Buzz'⍵}¨⍳100  Tested on GNU-APL (ver 1.7/980M) Do you need the space between ' and ⍵? – Zacharý – 2017-08-03T20:34:47.280 Oh, I haven't used GNU APL in a while, is the ⊣ needed, since you display directly to STDOUT? – Zacharý – 2017-08-04T22:15:23.457 @Zacharý In GNU-APL monadic 'left tack' discards the value of the right argument. I read it as return nothing (since it points to left). I hope this is the correct way to phrase it. on the other hand, I do not have experience with Dyalog or a ready-setup to play with. – Ala'a Mohammad – 2017-08-06T18:45:49.440 Oh, for some reason I was thinking the return value was not written to STDOUT by default. – Zacharý – 2017-08-06T19:05:29.220 3 TeX, 304 bytes \documentclass[9pt,a4paper]{article}\pagestyle{empty}\begin{document}\count0=0\count1=0\count3=3\count5=5\loop\advance\count1 by1\count0=0 \ifnum\count1=\count3 Fizz\advance\count3 by3\count0=1\fi\ifnum\count1=\count5 Buzz\advance\count5 by5\count0=1\fi\the\count1 \ifnum\count1<100\repeat\end{document}  Somehow count0 is necessary but I didn't check whether it is zero. It works and I have no idea why. I'm assuming that extra newline is there for a reason, but what's the reason? – Stephen – 2017-08-20T00:06:00.257 1@StepHen two newlines is a new paragraph – Leaky Nun – 2017-08-20T00:06:23.247 3 Excel VBA, 88 Bytes Anonymous VBE immediate window function that takes no input and outputs to the VBE immediate window. For i=1To 100:o="":o=IIf(i Mod 3,o,"Fizz"):o=IIf(i Mod 5,o,o+"Buzz"):?IIf(o="",i,o):Next  Ungolfed For i=1To 100 '' iterate from 1 to 100 o="" '' reset out var at each var o=IIf(i Mod 3,o,"Fizz") '' set the out var to Fizz if i Mod 3 = 0 o=IIf(i Mod 5,o,o+"Buzz") '' append Buzz to out var if i Mod 5 = 0 ?IIf(o="",i,o) '' If out var is non-empty, output the out var '' else output i Next  Worksheet Version, 97 Bytes Anonymous VBE immediate window function that takes no input and outputs to the range [C1:C100] [A1:C100]=Array("=ROW()","=IF(MOD(A1,3),,""FIZZ"")&IF(MOD(A1,5),,""BUZZ"")","=IF(B1="""",A1,B1)")  Ungolfed [A1:A100]="=ROW()" [B:B]="=IF(MOD(A1,3),,""FIZZ"")&IF(MOD(A1,5),,""BUZZ"")" [C:C]="=IF(B1="""",A1,B1)"  Subroutine Version, 110 Bytes Declared Subroutine that takes no input and outputs to the VBE immediate window Sub F For i=1To 100 o="" If i Mod 3=0Then o="Fizz If i Mod 5=0Then o=o+"Buzz Debug.?IIf(o="",i,o) Next End Sub  1You can remove o="": and change your first iif to IIf(i Mod 3,"","Fizz") – seadoggie01 – 2018-09-07T20:53:01.237 For the Subroutine version, the () after F isn't optional, and gets added in automatically. Same with the ? in debug. – Selkie – 2019-02-26T18:14:57.307 1 @Selkie, the behavior you are describing is known as autoformatting, and it is generally accepted in this community for VBA and for all languages that exhibit autoformatting, one may post their code from before it is autoformatted. in this case, that would mean that a couple of spaces may be removed, terminal "s dropped, changing print to ? and removal of the () from the Sub declaration. I suggest that you take a look at the Tips for Golfing in VBA page for more info – Taylor Scott – 2019-02-26T21:30:37.393 3 AppleScript, 104102 100 bytes "" repeat with i from 1to 100 result&{"FizzBuzz",i,"Fizz","Buzz"}'s item((i^4mod 15+7)div 4)&" " end  If you run it in Script Editor, the result has "quotes" around it. If you run it with osascript, there are no "quotes", but the result ends with an extra blank line. I steal the technique from Lynn's Lua answer, where the script picks from a list of possible values to print. I use (i^4mod 15+7)div 4 to calculate the index 1, 2, 3, or 4. It's different from Lua's i^2%3+i^4%5*2+1. In AppleScript, i^4 raises i to 4th power. It returns a real, which is a floating-point number, but the value is equal to the correct integer. The values of n = i^4mod 15 with i from 1 to 15 are i = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 n = 1 1 6 1 10 6 1 1 6 10 1 6 1 1 0  So n is 0.0 for "FizzBuzz", 1.0 for i, 6.0 for "Fizz", or 10.0 for "Buzz". This pattern continues with i from 16 to 100. I need to map the values 0.0, 1.0, 6.0, 10.0 to a list index; lists in AppleScript start at index 1. n = 0.0 1.0 6.0 10.0 (n+2)mod 7 = 2.0 3.0 1.0 5.0 (n+7)div 4 = 1 2 3 4  My 104-byte answer used (n+2)mod 7, but that mapping had 5.0 instead of 4.0, so it needed a list of 5 items, where the extra item 0, cost 2 bytes. My 102-byte answer uses (n+7)div 4. My 100-byte answer deletes 2 extra spaces. 3 ><>, 59 bytes 0v!oo:oo"Fiz"\ 1<oan?*/!?%5$\!?%3;?)*aa::::::+
o"Buzz"/$0oo Also push a 0 to the stack .......... Multiply the top two values of the stack. ..oan?*... If the counter was divisible by 5 or 3 print the number .......... Print a newline and loop around again  As time goes, the stack fills up, with an extra copy of the counter for each Fizz or Buzz (and two for FizzBuzzes). This is due to the extra copy(s) of the counter that don't end up being printed. 3 SNOBOL4 (CSNOBOL4), 137121 114 bytes I X =X + 1 O =EQ(REMDR(X,3)) 'Fizz' O =O EQ(REMDR(X,5)) 'Buzz' O =IDENT(O) X OUTPUT =O O =LT(X,100) :S(I) END  Try it online! Explanation:  ;* uninitialized variables start as '' ;* which is coerced to 0 in computations I X =X + 1 ;* Increment X O =EQ(REMDR(X,3)) 'Fizz' ;* if X mod 3 == 0, O = 'Fizz' O =O EQ(REMDR(X,5)) 'Buzz' ;* if X mod 5 == 0, concatenate O and 'Buzz' O =IDENT(O) X ;* if O is IDENTical to the empty string, ;* set O to X OUTPUT =O ;* print O O =LT(X,100) :S(I) ;* set O to '' and if X < 100, goto I END  3 Forth, 107101 98 bytes : f 101 1 do i 5 mod i 3 mod if dup if i . then else ." Fizz" then 0= if ." Buzz" then cr loop ; f  Ungolfed + close Python equivalent: : f \ def f(): 101 1 do \ for i in range(1, 101): i 5 mod \ a = i % 5 # Not an actual variable, pushed onto the stack i 3 mod \ b = i % 3 if \ if b: # b is popped dup \ c = a if \ if c: i . \ print(i, end='') then else \ else: ." Fizz" \ print('Fizz', end='') then 0= \ a = (a == 0) if \ if a: ." Buzz" \ print('Buzz', end='') then cr \ print() loop ; f \ f()  Run it! 1To Taylor Scott: sorry for deleting the edit. I thought adding another language would be more meaningful – Alex – 2018-04-18T23:25:35.393 1Alex, while this is definitely a more interesting answer you should feel free to leave multiple responses to challenges. – Taylor Scott – 2018-05-16T14:18:27.220 3 12-BASIC, 7355 50 bytes FOR I=1TO 100?"FIZZ"*!(I%3)+"BUZZ"*!(I%5)OR I NEXT  The first code golf program I've written in the language I'm creating. I should probably avoid code golf while working on it though... 3 Julia 1.0, 72 bytes (n->println([n,"Fizz","Buzz","FizzBuzz"][sum(n.%[1,3,5,5].<1)])).(1:100)  Not the shortest solution possible, but I like the obfuscation. Try it online! Explanation We apply an anonymous function (n->...) itemwise .( ) to the range 1:100. The function body does this (using sample input n=5): n.%[1,3,5,5] # Modulo n by each of these numbers [0,2,0,0] .<1 # Itemwise, is each remainder zero? [true,false,true,true] sum( ) # Count number of trues in the array 3 # This will be 4 for multiples of 15, 3 for multiples # of 5, 2 for multiples of 3, and 1 for other numbers [n,"F","B","FB"][ ] # Index (1-based) into this array "Buzz" println( ) # Print, with a newline  3 Javascript, 80 bytes for(i=1;i<101;i++){console.log(i%3==0?i%5==0?"FizzBuzz":"Fizz":i%5==0?"Buzz":i)}  To whoever downvoted this; you really should explain why. Especially considering Jey is a new contributor. – Marie – 2019-02-27T19:27:09.550 3 Zsh, 105786866 61 bytes Try it online! for i ({1..100})(((i%3))||w=Fizz;((i%5))||w+=Buzz;<<<${w-$i})  -27 using simpler approach -10 using parameter fallback -2 thanks to @Dennis - kudos for the bash solution -5 thanks to @GammaFunction Original solution, using weird r flag... try it online for ((;i++<100;));{f=$[i%3>0?0:4] b=$[i%5>0?0:4] echo${(r:$f::Fizz:)}${(r:$b::Buzz:)}((f+b>0))||<<<$i}


1

You don't need the last ; on the first line. A port to Bash takes 70 bytes, thus beating my answer.

– Dennis – 2019-08-28T14:49:53.383

1

Also, you don't need the newline before the last } (which is missing in your answer). Try it online!

– Dennis – 2019-08-28T14:56:20.267

the bash solution still wins for originality.. I couldn't port that crazy for expression to zsh – roblogic – 2019-08-28T15:01:24.417

161, mostly thanks to subshells – GammaFunction – 2019-10-15T02:03:41.867

3

DIVSPL, 22 bytes

1..100
fizz=3
buzz=5


3

Bash, 58 bytes

eval i={1..100}';a=([i%3]=Fizz [i%5]+=Buzz);echo ${a-$i};'


Try it online!

3

Spaghetti, 522 bytes

main:0"n"goto store goto l l:100"n"goto retrieve goto areEqual"EOF"goto jumpIfTrue"n"goto retrieve 1 2 goto add"n"goto store 15"n"goto retrieve 2 goto modulus 0 goto areEqual"f"goto jumpIfTrue 3"n"goto retrieve 2 goto modulus 0 goto areNotEqual"b"goto jumpIfTrue"Fizz"1 goto print goto b t:3"n"goto retrieve 2 goto modulus 0 goto areEqual"l"goto jumpIfTrue"n"goto retrieve 1 goto print goto l b:5"n"goto retrieve 2 goto modulus 0 goto areNotEqual"t"goto jumpIfTrue"Buzz"1 goto print goto l f:"FizzBuzz"1 goto print goto l



Requires a newline at the end, cause otherwise the interpreter throws a hissy fit.

Spaghetti is a stack based language that promotes using goto extensively. That means, every single operation you use requires a goto statement along with it.

That being said, this took a while.

Commented version is at the Spaghetti examples.

Try it on the online interpreter! (Code must be pasted in)

3

LolCode, 392383 353 bytes

This LolCode follows the 1.3 standard used by the lci interpreter.

Unfortunately, no online interpreter.

Not the best language to golf with, but it's fun!

Update 1: changed for loop to while loop

Update 2: removed newlines in favor of commas (soft command break)

HAI 1.3,CAN HAS STDIO?,I HAS A v ITZ 1,IM IN YR s,BOTH SAEM 0 AN MOD OF v AN 15,O RLY?,YA RLY,VISIBLE "FizzBuzz",NO WAI,BOTH SAEM 0 AN MOD OF v AN 3,O RLY?,YA RLY,VISIBLE "Fizz",NO WAI,BOTH SAEM 0 AN MOD OF v AN 5,O RLY?,YA RLY,VISIBLE "Buzz",NO WAI,VISIBLE v,OIC,OIC,OIC,BOTH SAEM v AN 100,O RLY?,YA RLY,GTFO,OIC,v R SUM OF v AN 1,IM OUTTA YR s,KTHXBYE


Nice first post, welcome to the site! – Redwolf Programs – 2020-11-03T15:32:47.187

3

Python 3, 888577 73 bytes

i=0
exec("i+=1;print(i%3*i%5and i or(i%3<1)*'Fizz'+(i%5<1)*'Buzz');"*100)


Try it online!

2

Welcome to the site, and nice first answer! Be sure to check out our Tips for golfing in Python page for more ways you could golf your answer.

– caird coinheringaahing – 2021-01-16T14:57:46.817

3

GNU sed 4.2.2, 126 bytes

This answer is in response to the bounty offered by @user41805 to golf further his sed script for this challenge.

s/^/@@,/;h
:
y/@123456789';,/123456789@;,'/
/@.$/!{x;G;s/..\n.//} h s/[@5].$/&Buzz/
s/.*,/Fizz/
s/.*\WB/B/
s/\W*//gp
g;/@@/d
t


Try it online!

The trick was to notice that no '0' will be printed, so I replaced it with '@' to be able at line 9 to refer to the extra characters [0';] as \W, thus shaving 3 bytes. Please check his description on how the code works.

3

Mouse, 75 bytes

1I:(I.101<^0J:I.3\0=["Fizz"J.1+J:]I.5\0=["Buzz"J.1+J:]J.0=[I.!]"!"I.1+I:)$ Ungolfed: 1 I: ~ Start a loop index at 1 ( I. 101 < ^ ~ While I < 101... 0 J: ~ Begin a divisibility indicator at 0 I. 3 \ 0 = [ ~ If I % 3 == 0 "Fizz" ~ Print "Fizz" to STDOUT J. 1 + J: ~ Increment J ] I. 5 \ 0 = [ ~ If I % 5 == 0 "Buzz" ~ Print "Buzz" to STDOUT J. 1 + J: ~ Increment J ] J. 0 = [ ~ If neither 3 nor 5 divides I I. ! ~ Print I to STDOUT ] "!" ~ Print a newline I. 1 + I: ~ Increment I )$


1I'm gonna upvote if you add a cat-program. – flawr – 2015-09-24T20:16:53.123

1@flawr You should submit your own cat program. It will be a game of cat and mouse. – Alex A. – 2015-09-24T20:44:35.950

1@flawr Not quite cat, but I did add a zcat program. – Daniel Wagner – 2015-09-25T02:23:30.093

3

Processing, 74 bytes

This is based on the Java answer by Geobits. I converted it into Processing and since Processing is similar to Java, the code is a lot similar to Geobits'.

for(int i=0;i++<100;)println((i%3<1?"Fizz":"")+(i%5<1?"Buzz":i%3<1?"":i));


8Ah, Processing. Java's willful son, stubbornly insisting that he's going to grow up to be an artist :D – Geobits – 2015-09-24T20:24:44.157

3

Ruby, 827270 68 bytes

puts (1..100).map{|i|(x=(i%3<1?"Fizz":"")+(i%5<1?"Buzz":""))>""?x:i}


old solution:

(1..100).map{|i|$><<"Fizz"if f=i%3<1$><<"Buzz"if b=i%5<1
$><<i if !(f||b) puts()}  I posted a 50-byte solution. – Lynn – 2015-09-27T22:44:34.750 3 awk, 62 END{for(x="Fizz";i<100;y="Buzz")print++i%15?i%5?i%3?i:x:y:x y}  Pretty sure there's no surprises here. Call awk 'END{for(x="Fizz";i<100;y="Buzz")print++i%15?i%5?i%3?i:x:y:x y}'  then press Ctrl-D to signal end of input. 1I'm curious if the Ctrl-D should be included in the byte-count. Using a BEGIN block and rearranging the operators a bit adds 1 byte, i.e. BEGIN{for(x="Fizz";i<100;y="Buzz")print++i%3?i%5?i:y:i%5?x:x y} – Robert Benson – 2017-05-30T16:19:09.140 3 Common Lisp, 121 (dotimes(x 100)(flet((d(n)(= 0(mod(1+ x)n))))(princ(cond((d 15)"FizzBuzz")((d 3)"Fizz")((d 5)"Buzz")(t(1+ x)))))(terpri))  Readable: (dotimes (x 100) (flet ((d (n) (= 0 (mod (1+ x) n)))) (princ (cond ((d 15) "FizzBuzz") ((d 3) "Fizz") ((d 5) "Buzz") (t (1+ x))))) (terpri))  3 Ruby, 59 I wanted to make a Ruby version using the slick modulo/integer-division/string-multiplication trick from feersum's Python answer (though unfortunately Ruby doesn't handle string multiplication the same way, so I spent some bytes on that): 100.times{|i|puts "#{i+1}\r"+"Fizz"*(i%3/2)+"Buzz"*(i%5/4)}  Note that this uses a carriage return \r without a newline. I don't know how portable this is; it works on my Linux and should work on Linux in general, as well as on Mac, but I'm not sure how Windows handles it. Without that, here's a 61-byte version: 100.times{|i|puts ("Fizz"*(i%3/2)+"Buzz"*(i%5/4))[/.+/]||i+1}  You don't need space after puts. – Vasu Adari – 2015-12-07T03:20:31.283 3 Commodore Basic, 87 bytes 1F┌I=1TO100:F=F+1:B=B+1:IFF=3T|?"FIZZ";:F=0 2IFB=5T|?"BUZZ";:B=0 3IFF>0A/B>0T|?I; 4?:N─  Or in "shifted mode" to get both lower- and upper-case letters, but with the byte values of lowercase and uppercase swapped relative to ASCII-1967 (press COMMODORE+SHIFT): 1fOi=1to100:f=f+1:b=b+1:iff=3tH?"Fizz";:f=0 2ifb=5tH?"Buzz";:b=0 3iff>0aNb>0tH?i; 4?:nE  Usual PETSCII-to-Unicode substitutions: ┌ = SHIFT+O, | = SHIFT+H, / = SHIFT+N, ─ = SHIFT+E Commodore Basic doesn't have a "modulus" operation, so I need to use alternate methods to figure out when to print what: keeping a pair of counters turns out to be fewer bytes than dividing and checking for integer-ness. It also doesn't have a true logical "and" (despite the manual saying otherwise), so I need to do an explicit comparison against zero to decide if I should print the plain number. @DLosc, you can switch into "shifted mode" which gives access to both upper- and lower-case, but with the character positions reversed relative to the ASCII-1967 which people are familiar with (eg. character #65 is lowercase "a" rather than uppercase). – Mark – 2015-09-28T02:27:14.260 3 Windows Batch, 149 bytes @for /l %%N in (1 1 100)do @(set s=&set/a1/(%%N%%3^)||set s=Fizz&set/a1/(%%N%%5^)&&(if defined s (echo Fizz)else echo %%N)||call echo %%s%%Buzz)2>nul  The SET /A statements test the modulo 3 and 5 without using IF by intentionally dividing by zero and using && and || conditional command concatenation. Of course stderr must be disabled, but it still saves bytes vs an IF statement. Windows Batch (unusual cmd.exe configuration, and environment assumption), 166165 133 bytes My original answer used delayed expansion, but the code to enable delayed expansion takes 32 bytes all on its own. However, some people have their cmd.exe configured to have delayed expansion enabled by default. For the small minority of people that configure cmd.exe this way, then the following is significantly shorter. @for /l %%N in (1 1 100)do @(set 1=&set/a1/(%%N%%3^)||set 1=Fizz&set/a1/(%%N%%5^)||set 1=!1!Buzz&>nul set 1&&echo !1!||echo %%N)2>nul  Besides relying on an unusual cmd.exe configuration, it is also reliant on the absence of any environment variable names that begin with 1. This is normally safe because batch treats something like %1var% as batch parameter %1 followed by a string constant var - the trailing % would get stripped. So people are taught to never begin variable names with a digit. 3 Go, 130129 134 bytes package main;import."fmt";func main(){for i:=1;i<101;i++{o:="";if i%3<1{o+="Fizz"};if i%5<1{o+="Buzz"};if o==""{Print(i)};Println(o)}}  I wish i had ternary operators... Edit: @Dust pointed out that I printed to stderr so my solution actually increased in size :( Try it online! I think this prints to STDERR which he said is not allowed. – Dust – 2018-04-19T19:14:28.043 @Dust you are right, I'll have to revise – Kristoffer Sall-Storgaard – 2018-04-20T07:32:24.727 3 Gol><>, 40 bytes e2RFL5%zR"zzuB"L3%zR"zziF"lQlRoaoC|LN|;  Updated for 0.4.0! I'm still tinkering with loops and trying to figure out how to do things best, but this is looking good so far. Explanation e Push 'e', or 101 2RF ... | Execute F for loop twice - the first time activates the loop, and the second time updates it. This effectively makes the loop start from 1 L5%z Push 1 if loop counter % 5 is 0, else 1 R"zzuB" Push "Buzz" (top of stack) number of times L3%z Push 1 if loop counter % 3 is 0, else 1 R"zziF" Push "Fizz" (top of stack) number of times lQ ... | If the stack is not empty... lRo Output stack ao Output newline C Continue for loop LN Otherwise, print loop counter with newline ; Terminate program  As we can see, there's a lot of abuse of R, which pops the top of the stack and executes the next instruction that many times. That's a smart idea! Mind if I use it? – Conor O'Brien – 2015-10-28T12:16:48.887 3 Jolf, 4233 31 bytes Try it here! Replace ƒ with \x9f. I'm stealing ETHproduction's method of fizzbuzzing. ƒΜz~1d|]"FizzBuzz"?%H340?%H548H  Old version, 42 bytes γ"Fizz"ƒΜz~1d?mτͺ35H+γζ?m|3Hγ?m|5HΖ"Buzz"H γ"Fizz" γ = "Fizz" Μz~1d map 1..100 with the following function ?mτͺ35H if both 3 and 5 | H +γζ return γ + ζ m|3H else if 3 | H γ return γ ?m|5H else if 5 | H Ζ"Buzz" return ζ = "Buzz" H else return H ƒ join by newlines  I might be able to golf it down by using the dictionary in Jolf, but who would want to with such a perfect score? 3 D, 130 bytes import std.stdio,std.conv;void main(){string x;for(int i;i++<100;x=((i%3?"":"Fizz")~(i%5?"":"Buzz")),writeln(x?x:i.to!string)){};}  Ungolfed: module FizzBuzz; import std.stdio; import std.conv; void main() { string x; for ( int i; i++ < 100; x = ((i % 3 ? "" : "Fizz") ~ (i % 5 ? "" : "Buzz")), writeln(x ? x : i.to!string) ){}; }  Or, building a string, for 142 bytes, import std.stdio,std.conv;void main(){string x,y;for(int i;i++<100;x=((i%3?"":"Fizz")~(i%5?"":"Buzz")),y~=(x?x:i.to!string)~"\n"){};write(y);}  Ungolfed: module FizzBuzz; import std.stdio; import std.conv; void main() { string x,y; for ( int i; i++ < 100; x = ((i % 3 ? "" : "Fizz") ~ (i % 5 ? "" : "Buzz")), y ~= (x ? x : i.to!string) ~ "\n" ){}; write(y); }  3 Hoon, 126 bytes %+ turn (gulf [1 100]) |= a/@ =+ [=((mod a 3) 0) =((mod a 5) 0)] "{?:(-< "Fizz" "")}{?:(-> "Buzz" "")}{?:(=(- [| |]) <a> "")}"  Map over the list [1...100] with the function, interpolating the strings "Fizz" and "Buzz". If both mods are false, then it also interpolates the number. This uses the fact that =+ pushes the value to the top of the context, which you can access with - and navigate with -< or -> for head/tail. Unfortunately, it looks pretty ugly because it needs a newline after runes to minimize byte count, along with not having built in operator functions. I'm not entirely sure if this counts as a valid entry: It simply returns a list of strings to be printed by the shell, which is optimal. The other way would be to use ~& to print each element as it's mapped over, but it would still be rendered as "Fizz" or "Buzz" (with quotes) since it's a typed print, along with the shell then printing out the entire list anyways since it's the return value. 3 Python 2 REPL, 54 0;exec"print _%3/2*'Fizz'+_%5/4*'Buzz'or-~_;_+=1;"*100  Based on this answer by feersum. Essentially the same technique, only using Python's underscore variable to save 2 chars at the start. You should probably specify this answer as "Python 2 REPL", as opposed to feersum's which is a full program. – Sp3000 – 2016-03-07T02:26:16.513 @Sp3000 Done and done. – Tersosauros – 2016-03-07T02:37:42.240 3 Vim, 66, 57 56 keystrokes i1<esc>qqYp<C-a>q98@q3Gqy:s/\d*/Fizz<CR>3j@yq@y5Gqz:s<CR>ABuzz<esc>5j@zq@z  Further golfing, and explanation on the way. A bit too late, but apparently this doesn't output correctly: Try it online! – user41805 – 2017-05-16T09:47:13.010 2 Befunge, 65 bytes _1+::3%^>55+,:"c"#@ >"zuB"vv.#,,:,,< |!:%5\ _:!"ziF"^ <,,:,,<:|*  Try it online! 2 Valyrio, 13 bytes s∫main [CF]  This is a fairly basic (and slightly unimaginative) answer. Explanation C pushes 100 to the stack, which means that ... F is the FizzBuzz builtin. This was mainly added in as a basic stack based program but got left in as a command and I never got rid of it. 2 SmileBASIC, 70 bytes Printing "Fizz" and "Buzz" is easy, the slightly more difficult part is to only print the number when required. There are basically 2 ways to do this (and they end up being the same length) 1: Print the number when I isn't divisible by 3 or 5 FOR I=0TO 100A=I MOD 3B=I MOD 5?"Fizz"*!A;"Buzz"*!B;STR$(I)*(A&&B)NEXT


2: Print the number if the cursor is at column 0:

FOR I=1TO 100?"Fizz"*!(I MOD 3);"Buzz"*!(I MOD 3);
?STR$(I)*!CSRX NEXT  In a previous version of SB, % was used for MOD, making the program shorter: Petit Computer BASIC, 62 bytes FOR I=0TO 100?"Fizz"*!(I%3);"Buzz"*!(I%5); ?STR$(I)*!CSRX
NEXT


1The language name should probably be "SmileBASIC 2.x" or something. – snail_ – 2017-02-06T13:39:02.050

2

Cardinal 217 bytes

%x>+ v  >+++++~M! 8# "buzz"
0    #~0#+++~>M! # V  "fizz"
+ ^jM<  ~        V>#
+       V      > #xV
= 0              V
t ~             >#x
t t       v      V
* =   > #}#}     /
> ^              >}/
.


Try it Online

Explanation

%x
0
+
+
= 0
t ~
t t
* =
> ^


Initializes a pointer with an inactive value of 100 and active value of 0

>+ v
#
^jM<


Loops around, incrementing the active value of the pointer and sending out a duplicate until the active value is equal to the inactive value (100)

  >+++++~M!
~0#+++~>M!


Checks if the value mod 3 or mod 5 is equal to 0

                   # "buzz"
#        # V  "fizz"
~        V>#
V      > #xV
V
>#x
v      V
> #}#}     /
>}/
.


Uses reflectors and splitters in order to print only numbers that are not divisible by 3 or 5. Printing fizz when divisible by 3 and buzz when divisible by 5.

2

Java, 153 145 bytes

enum f{;static{for(int i=1;i<101;i++)System.out.println(i%3>0&i%5>0?i:(i%3<1&i%5<1?"FizzBuzz":(i%3<1?"Fizz":(i%5<1?"Buzz":0))));System.exit(0);}}


Not as long as I expected it to be, maybe because I ommited main function and used an enum. Quite overcomplicated print statement.

enum f {;                                       // Required because it is an enum
static {                                    // static block
for (int i = 1; i < 101; i++) {         // loop from 1 to 100 inclusive
boolean by3 = i % 3 == 0;
boolean by5 = i % 5 == 0;

if (!by3 && !by5)                   // Not divisible by 3 and 5
System.out.println(i);          // Just show the number
else if (by3 && by5)                // Divisible by both
System.out.println("FizzBuzz"); // Show FizzBuzz
else if (by3)                       // Divisible only by 3
System.out.println("Fizz");     // Show Fizz
else                                // Divisible only by 5
System.out.println("Buzz");     // Show Buzz
}
System.exit(0);                         // Required because there can't be output to stderr and it would crash trying to run main function
}
}


Ungolfed not modified:

enum f {;
static {
for (int i = 1; i < 101; i++)
System.out.println(i % 3 > 0 & i % 5 > 0 ? i : (i % 3 < 1 & i % 5 < 1 ? "FizzBuzz" : (i % 3 < 1 ? "Fizz" : (i % 5 < 1 ? "Buzz" : 0))));
System.exit(0);
}
}


EDIT: Saved 8 bytes by replacing ==0 with <1, !=0 with >0 and && with &

2

Julia, 70 bytes

for i=1:100 println("$(i%3<1?"Fizz":"")$(i%5<1?"Buzz":i%3>0?i:"")")end


Julia has perl-like string formatting. Very nice for challenges like these.

2

REXX 81 Bytes

f.=""
f.0="buzz"
t.=""
t.0="fizz"
do i=1 to 100
f=i//5
t=i//3
say overlay(t.t||f.f,i)
end


You can golf away four characters by removing the empty strings: f.= instead of f.="". – idrougge – 2017-05-16T11:54:32.220

I tested f.= on a couple of online interpreters and they didn't like it. – theblitz – 2017-05-16T12:06:34.177

All right, I only tested it with Regina. – idrougge – 2017-05-16T12:11:01.537

2

q/kdb+, 5856 49 bytes

Solution:

0{$[sum i:0=y mod 3 5;FizzBuzz(&)i;y]}'1+(!)100  Example: q)0{$[sum i:0=y mod 3 5;FizzBuzz(&)i;y]}'1+(!)100
1
2
,Fizz
4
,Buzz
,Fizz
7
8
,Fizz
,Buzz
11
,Fizz
13
14
FizzBuzz
16
...etc


Explanation:

3?S$4NextI  Try it online! 2 Whitespace, 307 bytes [S S S N _Push_0][N S S N _Create_Label_LOOP][S S S T N _Push_1][T S S S _Add][S N S _Duplicate][S N S _Duplicate][S S S T T N _Push_3][T S T T _Modulo][N T S T N _Jump_to_Label_FIZZ_if_0][N S S S N _Create_Label_RETURN_FIZZ][S N S _Duplicate][S N S _Duplicate][S S S T S T N _Push_5][T S T T _Modulo][N T S T T N _Jump_to_Label_BUZZ_if_0][N S S S S N _Create_Label_RETURN_BUZZ][S S S T T S S T S S N _Push_100][T S S T _Subtract][N T S T T T N _Jump_to_Label_EXIT_WITH_ERROR_if_0][N S T T T T T N _Call_Label_PRINT_INT][S S S T S T S N _Push_10][T N S S _Print_as_character][N S N N _Jump_to_Label_LOOP][N S S T _Create_Label_FIZZ][S S S T S S S T T S N _Push_70][T N S S _Print_as_character][S S S T T S T S S T N _Push_105][T N S S _Print_as_character][S S S T T T T S T S N _Push_122][S N S _Duplicate][T N S S _Print_as_character][T N S S _Print_as_character][N S N S _Return_to_Label_FIZZ_RETURN][N S S T T N _Create_Label_BUZZ][S S S T S S S S T S N _Push_66][T N S S _Print_as_character][S S S T T T S T S T N _Push_117][T N S S _Print_as_character][S S S T T T T S T S N _Push_122][S N S _Duplicate][T N S S _Print_as_character][T N S S _Print_as_character][N S N S S N _Return_to_Label_BUZZ_RETURN][N S S T T T T N _Create_Label_PRINT_INT][S N S _Duplicate][S S S T T N _Push_3][T S T T _Modulo][N T S S T N _Jump_to_Label_LOOP_if_0][S N S _Duplicate][S S S T S T N _Push_5][T S T T _Modulo][N T S S T N _Jump_to_Label_LOOP_if_0][T N S T _Print_as_integer][N T N _Return][N S S S T N _Create_Label_RETURN][N T N _Return]  Letters S (space), T (tab), and N (new-line) added as highlighting only. [..._some_action] added as explanation only. Try it online (with raw spaces, tabs and new-lines only). Can definitely be golfed. If-checks are rather annoying in Whitespace, and I still have to get used to them some more. EDIT: Fixed TIO version. Will try to golf it some more later. General explanation in Pseudo-code: Integer i = 0 Start LOOP Increase i by 1 If i modulo 3 is 0: Call function FIZZ() If i modulo 5 is 0: Call function BUZZ() If i is 100: Stop program Call function PRINT_INT(i) Print new-line Go to next iteration of the LOOP function FIZZ(): Print "Fizz" Return function BUZZ(): Print "Buzz" Return function PRINT_INT(integer i): If i modulo 3 is 0: Return If i modulo 5 is 0: Return Print i Return  Example run: Command Explanation Stack STDOUT STDERR SSSN Push 0 [0] NSSN Create Label_LOOP [0] SSSTN Push 1 [0,1] TSSS Add (0+1) [1] SNS Duplicate (1) [1,1] SNS Duplicate (1) [1,1,1] SSSTTN Push 3 [1,1,1,3] TSTT Modulo (1%3) [1,1,1] NTSTN Jump to Label_FIZZ if 0 [1,1] NSSSSN Create Label_RETURN_FIZZ [1,1] SNS Duplicate (1) [1,1,1] SNS Duplicate (1) [1,1,1,1] SSSTSTn Push 5 [1,1,1,1,5] TSTT Modulo (1%5) [1,1,1,1] NTSTTN Jump to Label_BUZZ if 0 [1,1,1] NSSSSN Create Label_RETURN_BUZZ [1,1,1] SSSTTSSTSSN Push 100 [1,1,1,100] TSST Subtract (1-100) [1,1,-99] NTSTTTN Jump to Label_EXIT if 0 [1,1] NSTTTTTN Call Label_PRINT_INT [1,1] NSSTTTTN Create Label_PRINT_INT [1,1] SNS Duplicate (1) [1,1,1] SSSTTN Push 3 [1,1,1,3] TSTT Modulo (1%3) [1,1,1] NTSSTN Jump to Label_RETURN if 0 [1,1] SNS Duplicate (1) [1,1,1] SSSTSTN Push 5 [1,1,1,5] TSTT Modulo (1%5) [1,1,1] NTSSTN Jump to Label_RETURN if 0 [1,1] TNST Print as integer [1] 1 NTN Return [1] SSSTSTSN Push 10 [1,10] TNSS Print as character [1] \n NSNN Jump to Label_LOOP [1] SSSTN Push 1 [1,1] TSSS Add (1+1) [2] SNS Duplicate (2) [2,2] SNS Duplicate (2) [2,2,2] SSSTTN Push 3 [2,2,2,3] TSTT Modulo (2%3) [2,2,2] NTSTN Jump to Label_FIZZ if 0 [2,2] NSSSSN Create Label_RETURN_FIZZ [2,2] SNS Duplicate (2) [2,2,2] SNS Duplicate (2) [2,2,2,2] SSSTSTn Push 5 [2,2,2,2,5] TSTT Modulo (2%5) [2,2,2,2] NTSTTN Jump to Label_BUZZ if 0 [2,2,2] NSSSSN Create Label_RETURN_BUZZ [2,2,2] SSSTTSSTSSN Push 100 [2,2,2,100] TSST Subtract (2-100) [2,2,-98] NTSTTTN Jump to Label_EXIT if 0 [2,2] NSTTTTTN Call Label_PRINT_INT [2,2] NSSTTTTN Create Label_PRINT_INT [2,2] SNS Duplicate (2) [2,2,2] SSSTTN Push 3 [2,2,2,3] TSTT Modulo (2%3) [2,2,2] NTSSTN Jump to Label_RETURN if 0 [2,2] SNS Duplicate (2) [2,2,2] SSSTSTN Push 5 [2,2,2,5] TSTT Modulo (2%5) [2,2,2] NTSSTN Jump to Label_RETURN if 0 [2,2] TNST Print as integer [2] 2 NTN Return [2] SSSTSTSN Push 10 [2,10] TNSS Print as character [2] \n NSNN Jump to Label_LOOP [2] SSSTN Push 1 [2,1] TSSS Add (3+1) [3] SNS Duplicate (3) [3,3] SNS Duplicate (3) [3,3,3] SSSTTN Push 3 [3,3,3,3] TSTT Modulo (3%3) [3,3,0] NTSTN Jump to Label_FIZZ if 0 [3,3] NSST Create Label_FIZZ [3,3] SNS Duplicate (3) [3,3,3] SNS Duplicate (3) [3,3,3,3] SSSTSSSTTSN Push 70 [3,3,3,3,70] TNSS Print as character [3,3,3,3] F SSSTTSTSSTN Push 105 [3,3,3,3,122] TNSS Print as character [3,3,3,3] i SSSTTTTSTSN Push 122 [3,3,3,3,122] SNS Duplicate (122) [3,3,3,3,122,122] TNSS Print as character [3,3,3,3,122] z TNSS Print as character [3,3,3,3] z NSNS Jump to Label_RETURN_FIZZ [3,3,3,3] NSSSSN Create Label_RETURN_FIZZ [3,3,3,3] SSSTSTN Push 5 [3,3,3,3,5] TSTT Modulo (3%5) [3,3,3,3] NTSTTN Jump to Label_BUZZ if 0 [3,3,3] NSSSSN Create Label_RETURN_BUZZ [3,3,3] SSSTTSSTSSN Push 100 [3,3,3,100] TSST Subtract (3-100) [3,3,-97] NTSTTTN Jump to Label_EXIT if 0 [3,3] NSTTTTTN Call Label_PRINT_INT [3,3] NSSTTTTN Create Label_PRINT_INT [3,3] SNS Duplicate (3) [3,3,3] SSSTTN Push 3 [3,3,3,3] TSTT Modulo (3%3) [3,3,0] NTSSTN Jump to Label_RETURN if 0 [3,3] Stack contains additional leading [3, but we'll ignore it in this explanation SSSTN Push 1 [3,1] TSSS Add (3+1) [4] SNS Duplicate (4) [4,4] SNS Duplicate (4) [4,4,4] SSSTTN Push 3 [4,4,4,3] TSTT Modulo (4%3) [4,4,1] NTSTN Jump to Label_FIZZ if 0 [4,4] NSSSSN Create Label_RETURN_FIZZ [4,4] SNS Duplicate (4) [4,4,4] SNS Duplicate (4) [4,4,4,4] SSSTSTN Push 5 [4,4,4,4,5] TSTT Modulo (4%5) [4,4,4,4] NTSTTN Jump to Label_BUZZ if 0 [4,4,4] NSSSSN Create Label_RETURN_BUZZ [4,4,4] SSSTTSSTSSN Push 100 [4,4,4,100] TSST Subtract (4-100) [4,4,-96] NTSTTTN Jump to Label_EXIT if 0 [4,4] NSTTTTTN Call Label_PRINT_INT [4,4] NSSTTTTN Create Label_PRINT_INT [4,4] SNS Duplicate (4) [4,4,4] SSSTTN Push 3 [4,4,4,3] TSTT Modulo (4%3) [4,4,1] NTSSTN Jump to Label_RETURN if 0 [4,4] SNS Duplicate (4) [4,4,4] SSSTSTN Push 5 [4,4,4,5] TSTT Modulo (4%5) [4,4,4] NTSSTN Jump to Label_RETURN if 0 [4,4] TNST Print as integer [4] 4 NTN Return [4] SSSTSTSN Push 10 [4,10] TNSS Print as character [4] \n NSNN Jump to Label_LOOP [4] SSSTN Push 1 [4,1] TSSS Add (4+1) [5] SNS Duplicate (5) [5,5] SNS Duplicate (5) [5,5,5] SSSTTN Push 3 [5,5,5,3] TSTT Modulo (5%3) [5,5,2] NTSTN Jump to Label_FIZZ if 0 [5,5] NSSSSN Create Label_RETURN_FIZZ [5,5] SNS Duplicate (5) [5,5,5] SNS Duplicate (5) [5,5,5,5] SSSTSTN Push 5 [5,5,5,5,5] TSTT Modulo (5%5) [5,5,5,0] NTSTTN Jump to Label_BUZZ if 0 [5,5,5] NSSTTN Create Label_BUZZ [5,5,5] SSSTSSSSTSN Push 66 [5,5,5,66] TNSS Print as character [5,5,5] B SSSTTTSTSTN Push 117 [5,5,5,117] TNSS Print as character [5,5,5] u SSSTTTTSTSN Push 122 [5,5,5,122] SNS Duplicate (122) [5,5,5,122,122] TNSS Print as character [5,5,5,122] z TNSS Print as character [5,5,5] z NSNS Jump to Label_RETURN_FIZZ [5,5,5] NSSSSN Create Label_RETURN_BUZZ [5,5,5] SSSTTSSTSSN Push 100 [5,5,5,100] TSST Subtract (5-100) [5,5,-95] NTSTTTN Jump to Label_EXIT if 0 [5,5] NSTTTTTN Call Label_PRINT_INT [5,5] NSSTTTTN Create Label_PRINT_INT [5,5] SNS Duplicate (5) [5,5,5] SSSTTN Push 3 [5,5,5,3] TSTT Modulo (5%3) [5,5,2] NTSSTN Jump to Label_RETURN if 0 [5,5] SNS Duplicate (5) [5,5,5] SSSTSTN Push 5 [5,5,5,5] TSTT Modulo (4%5) [5,5,0] NTSSTN Jump to Label_RETURN if 0 [5,5] ... etc. etc. SSSTN Push 1 [99,1] TSSS Add (99+1) [100] SNS Duplicate (100) [100,100] SNS Duplicate (100) [100,100,100] SSSTTN Push 3 [100,100,100,3] TSTT Modulo (100%3) [100,100,1] NTSTN Jump to Label_FIZZ if 0 [100,100] NSSSSN Create Label_RETURN_FIZZ [100,100] SNS Duplicate (100) [100,100,100] SNS Duplicate (100) [100,100,100,100] SSSTSTN Push 5 [100,100,100,100,5] TSTT Modulo (100%5) [100,100,100,0] NTSTTN Jump to Label_BUZZ if 0 [100,100,100] NSSTTN Create Label_BUZZ [100,100,100] SSSTSSSSTSN Push 66 [100,100,100,66] TNSS Print as character [100,100,100] B SSSTTTSTSTN Push 117 [100,100,100,117] TNSS Print as character [100,100,100] u SSSTTTTSTSN Push 122 [100,100,100,122] SNS Duplicate (122) [100,100,100,122,122] TNSS Print as character [100,100,100,122] z TNSS Print as character [100,100,100] z NSNS Jump to Label_RETURN_FIZZ [100,100,100] NSSSSN Create Label_RETURN_BUZZ [100,100,100] SSSTTSSTSSN Push 100 [100,100,100,100] TSST Subtract (100-100) [100,100,0] NTSTTTN Jump to Label_EXIT if 0 [100,100] error  2 Husk, 35 bytes m§Ysλṁ!⁰₇ḣ3)ḣ100 ¶Σfm%⁰NC2¨¶¶¶⌈iΩZu  Try it online! I feel like I'm missing some opportunities for cleverness here. Like, I'm not really pleased with that lambda sitting there on the first line and having to be manually closed. But anyway, here we are. Explanation I'll explain the second line first. It's a function TNum -> [[TChar]] that maps 1 -> [] 2 -> ["","","Fizz"] 3 -> ["","","","","Buzz"]  It works like this: ¶Σfm%⁰NC2¨¶¶¶⌈iΩZu ¨¶¶¶⌈iΩZu --The compressed string "\n\n\n\nFiBuzz" C2¨¶¶¶⌈iΩZu --cut; the list ["\n\n", "\n\n", "Fi", "Bu", "zz] m%⁰N --nats mod input, i.e, with input 3, [1,2,0,1,2,...] fm%⁰NC2¨¶¶¶⌈iΩZu --filter;so grab (1) nothing, (2) pairs 135, (3) pairs 1245 Σfm%⁰NC2¨¶¶¶⌈iΩZu --concat;now at (1) [] (2) ["\n\nFizz"] (3) ["\n\n\n\nBuzz"] ¶Σfm%⁰NC2¨¶¶¶⌈iΩZu --split by newlines to return claimed result  Next, the lambda in the first line. It has type TNum -> [TChar]; given an integer, it returns "", "Fizz", "Buzz", or "FizzBuzz" as appropriate. In detail: λṁ!⁰₇ḣ3) ḣ3 --heads; the list [1,2,3] ₇ḣ3 --call 2nd line with map overflow: [[],["","","Fizz"],["","","","","Buzz"]] ṁ!⁰₇ḣ3 --index the lambda argument to each list (modularly) and concat the results  And pulling it together: m§Ysλṁ!⁰₇ḣ3)ḣ100 λṁ!⁰₇ḣ3) --"","Fizz","Buzz",or"FizzBuzz" s --string representation of the number §Ysλṁ!⁰₇ḣ3) --apply both and take max; "" < numeric strings < alphabet m§Ysλṁ!⁰₇ḣ3)ḣ100 --map across [1,..,100]  Then Husk's default output style for an object of type [[TChar]] turns out to be just what we want. This could have been -3 bytes if we didn't need to hardcode it for 100 lines! Ah well. – Sophia Lechner – 2018-03-23T23:48:09.210 2 sed, 275272270260254249 245 bytes s/.*/t0u123456789/ :1 s/(tu?(.).*)/\1\n\2/ s/u(.)(t?)(.*)/\1\2u\3\1/ /9u/{s/t(.)/\1t/;s/u//;s/^/u/} /99/!b1 s/$/\n10/
s/[0-9][05]/&Buzz/g
s/[0369]{2}/&Fizz/g
s/[147][258]/&Fizz/g
s/[258][147]/&Fizz/g
s/[0-9]+([FB])/\1/g
s/\n0/\n/g
s/[^\n]+\n//
q


Try it Online

This is a pure sed script which discards all input, if any, and then prints all the necessary output lines and quits.

Explanation

The script is divided into a sequence of three main parts: 1. Numeral generation; 2. "Fizz/Buzz/FizzBuzz" insertion; and 3. Formatting.

1. Numeral generation (lines 1 through 6)

The purpose of this part is to generate 99 lines containing the base 10 numerals corresponding to numbers 1 through 99. For that, we first set the entire pattern space to the following string:

t0u123456789


We will call the above string our state string. Next, we enter a loop in which each iteration goes like this:

1. A newline is appended to the pattern space;
2. A copy of the first numeral character after the "t" in the state string is appended to the pattern space;
3. A copy of the first numeral character after the "u" in the state string is appended to the pattern space;
4. The "u" in the state string is moved from its current position to the immediate right of the first numeral character after it or, if a "t" is already in said position, the "u" is instead moved to the immediate right of that "t";
5. If the "u" in the state string is immediately at the right of the "9" in the state string, the "t" is moved from its current position to the immediate right of the first character after it, and the "u" is moved from its current position to the immediate left of the "0" in the state string;
6. If there isn't a "99" anywhere in the pattern space (i.e., the loop has not finished its job of generating all the 99 lines), control goes back to line 2 (label :1) and so this enumeration of procedures is repeated from step 1; otherwise, control flow continues into the next line.

2. "Fizz/Buzz/FizzBuzz" insertion (lines 7 through 11)

The purpose of this part is to append "Fizz" immediately after each two-digit numeral in the pattern space which corresponds to a number which is a multiple of 3 but not of 5; to append "Buzz" immediately after each two-digit numeral in the pattern space which corresponds to a number which is a multiple of 5 but not of 3; and to append "FizzBuzz" after each two-digit numeral in the pattern space which corresponds to a number which is a multiple of both 3 and 5. This is how the computations go:

1. We append a newline followed by "10" to the pattern space.
2. Next, we search for all substrings of the pattern space formed by a digit between 0-9 on the left and either a 0 or a 5 on the right. We insert "Buzz" into the pattern space immediately after each such substring;
3. Finally, we insert "Fizz" into the pattern space immediately after each substring which matches either of the following criteria:
• Substrings formed by two digits which may be 0, 3, 6, or 9;
• Substrings formed by a digit which is either 1, 4 or 7 on the left and a digit which is either 2, 5 or 8 on the right;
• Substrings formed by a digit which is either 2, 5 or 8 on the left and a digit which is either 1, 4 or 7 on the right.

3. Formatting (lines 12 through 15)

This part is straight forward. Here we remove all of the following substrings from the pattern space:

1. Every contiguous sequence of numeral characters on the immediate left of a "F" or a "B";
2. All 0's on the immediate right of a newline character;
3. All characters from the beginning of the pattern space up to and including the first newline character (remember that the state string is still there and there's a newline immediately before the first output numeral).

And then sed just prints the final contents of the pattern space and calls it quits.

2

///, 198 bytes

/%/!"
//$/ "!//#/ Fizz" //"/Buzz//!/ Fizz /1 2!4$7
8%11!13
14#16
17!19$22 23%26!28 29#31 32!34$37
38%41!43
44#46
47!49$52 53%56!58 59#61 62!64$67
68%71!73
74#76
77!79$82 83%86!88 89#91 92!94$97
98!"


2

with Ada.Text_IO;use Ada.Text_IO;procedure T is begin for I in Integer range 1..100 loop if I mod 15 = 0 then Put_Line("FizzBuzz");elsif I mod 3 = 0 then Put_Line ("Fizz");elsif I mod 5 = 0 then Put_Line ("Buzz");else Put_Line (Integer'Image (I)(2 ..Integer'Image(I)'Last));end if; end loop; end T;


Try it online!

Ungolfed:

with Ada.Text_IO;use Ada.Text_IO;

procedure Test is begin
for I in Integer range 1 .. 100 loop
if I mod 15 = 0 then
Put_Line ("FizzBuzz");
elsif I mod 3 = 0 then
Put_Line ("Fizz");
elsif I mod 5 = 0 then
Put_Line ("Buzz");
else
Put_Line (Integer'Image (I)(2 .. Integer'Image(I)'Last));
end if;
end loop;
end Test;


Pretty vanilla, but I didn't see an Ada solution yet. Probably because Ada might just be the worst real-world language to golf with!

Oh, I love Ada. It is definitely my favourite language. It just sucks for code golf. And yeah, I wish more people knew about it. :) – LambdaBeta – 2018-04-18T22:11:31.083

Well, it can't possibly be as bad as Java :P – ASCII-only – 2018-04-18T22:12:48.803

also on your profile: "am familiar with a majority of commonly used programming languages". which ones exactly? :P – ASCII-only – 2018-04-18T23:05:59.690

207 – ASCII-only – 2018-04-24T09:56:58.167

204 – ASCII-only – 2018-04-24T10:15:28.410

203 – ASCII-only – 2018-04-24T10:16:34.553

You should post that as a separate answer. I didn't abuse Ada2012 as much and forgot to be a child of I/O package. Take credit where its due :) – LambdaBeta – 2018-04-24T12:51:24.190

>

• I already did :P and 2. I stole the idea from Lynn's Hello World actually
• < – ASCII-only – 2018-04-24T12:54:56.803

2

Groovy, 63 bytes

Stand-alone program, prints result to STDOUT.

100.times{n->s=(++n%3?'':'Fizz')+(n%5?'':'Buzz')
println s?s:n}


I'd have preferred to use (1..100).each{ instead of 100.times{, so that I didn't have to ++n at the start of each iteration, but this is golf and that saves me two bytes.

Other than that, a pretty standard truthy-based submission. 'Fizz' and 'Buzz' are added when remainder is 0 because 0 is falsy, and '' is a falsy string, so I can print n when the first line hasn't had either of 'Fizz' or 'Buzz' added.

Try it online!

2

Ink, 777057 48 bytes

-(n){n%3:{n%5:{n}}|Fizz}{n%5: |Buzz}
{n<100:->n}


Try it online!

2

Brachylog, 48 bytes

100⟦₁{f{∋15∧"FizzBuzz"|∋3∧"Fizz"|∋5∧"Buzz"|t}ẉ}ᵐ


Try it online!

Probably not golfed too well but it works.

2

Java 8, 129 bytes

interface I{static void main(String[]s){for(int i=0;++i<101;)System.out.println(i%15<1?"FizzBuzz":i%3<1?"Fizz":i%5<1?"Buzz":i);}}


Try it online

2

C, 98 94 bytes

i;main(){for(;++i<101;)i%3*i%5?printf("%d\n",i):printf("%s%s\n",i%3?"":"Fizz",i%5?"":"Buzz");}


Pretty simple stuff...

Thanks to Yoris Fresh for helping me save a couple bytes. Thanks to Jerry Jeremiah for pointing out a mistake in the ungolfed version.

Ungolfed:

i;
main() {
for (; ++i < 101;)
i % 3 && i % 5 ?
printf("%d\n",i) :
printf("%s%s\n", i % 3 ? "" : "Fizz", i % 5 ? "" : "Buzz");
}


the ungolfed version increments i twice each loop. – Jerry Jeremiah – 2019-06-04T03:33:26.360

2

Scheme, 118 bytes

(for-each(lambda(i)(printf"~a~a~%"(if(=(mod i 3)0)'Fizz"")(if(=(mod i 5)0)'Buzz(if(=(mod i 3)0)""i))))(cdr(iota 101)))


Try it online!

Ungolfed:

(for-each
(lambda (i)
(printf
"~a~a~%"
(if (= (mod i 3) 0) 'Fizz "")
(if (= (mod i 5) 0) 'Buzz
;; else
(if (= (mod i 3) 0) "" i))))
(cdr (iota 101)))


2

05AB1E, 24 bytes

тÝ3Å€"Fizz"}5Å€á”ÒÖ”J}¦»


Try it online!

Explanation:

тÝ                  # range 0..100
3Å€      }        # for every 3rd element...
"Fizz"         # replace it with Fizz
5Å€      }        # for every 5th element...
á              # keep only letters...
”ÒÖ”J         # and append "Buzz"
¦       # drop the first element
»      # join with newlines
# implicit output


Or alternatively:

тÝ35vyÅ€á”FizzÒÖ”#NèJ]¦»


Try it online!

35vy iterates over the digits of 35, which avoids repeating Å€}. ”FizzÒÖ” is the string Fizz Buzz, and then #Nè selects the appropriate element.

Legacy 05AB1E doesn’t have Å€, so neither of those work for it. However, legacy Ã (set intersection) implicitly splits numbers, which lets us get a 26 that only works on legacy:

тLεDÑ35Ãvá”Fizz ÒÖ”#yèJ},


Try it online!

тLε                         # for y in 1..100
DÑ                       # divisors of y
35Ã                    # keep only those in [3, 5]
v               }   # for each...
á                  # keep only letters
”Fizz ÒÖ”#yèJ     # append either Fizz or Buzz
,  # print with newline


2

APL (Dyalog Unicode), 37 bytesSBCS

↑{∨/d←4/0=3 5|⍵:d/'FizzBuzz'⋄⍕⍵}¨⍳100


Try it online!

⍳100ɩndices 1…100

{}¨ apply the following anonymous lambda to each of those:

⍵ the argument; e.g. 20

3 5| the division remainder when that is divided by 3 and 5; e.g. [2,0]

0= Boolean mask where that is equal to 0; e.g. [0,1]

4/ replicate those numbers for 4 copies of each; e.g. [0,0,0,0,1,1,1,1]

d← assign that to d

∨/: if any of those are true (OR-reduction); e.g. true:

d/'FizzBuzz' use d to mask the characters of the string; e.g. "Buzz"

⋄ else:

⍕⍵ stringify the argument; e.g. "20"

↑ mix the list of strings into a matrix, so it prints right

2

Pip, 43 41 bytes

Fa1,101{i:0a%3?i:1O"FIZZ"a%5?i?PaPxP"BUZZ"}

Lh{i:0o%3?i:1O"FIZZ"o%5?i?PoPxP"BUZZ"++o}


Try it online!

2

MineFriff, 240 bytes

0,
>I1,+:a*a1,=?;~             o,aC            <
>:f,%?Ca*c2,:a*b7,7*e,a*c2,:f*7,a*7,oooooooo^
>:5,%?Ca*c2,:a*b7,6*b,oooo                  ^
>:3,%?Ca*c2,:f*7,a*7,oooo                   ^
>:o                                          ^


Try it online!

What it actually looks like:

It's.. beautiful. – Razetime – 2020-10-02T04:33:56.870

2

Julia, 87 bytes

z(i)=(f=i .%[3,5] .==0;sum(f)>0 ? foldl(*,["Fizz","Buzz"][f]) : i)
println.(z.(1:100))


Or we could kind of cheat to drop 3 bytes and use show instead of println. Julia 83 bytes

z(i)=(f=i .%[3,5] .==0;sum(f)>0 ? foldl(*,["Fizz","Buzz"][f]) : i)
show(z.(1:100))


or a more legible FP style, poor performing, 91 bytes

F(x)=foldl(*,["Fizz","Buzz"][x .%[3,5] .==0])
N(y)=F(y)=="" ? y : F(y)
println.(N.(1:100))


prod is better than foldr(* – H.PWiz – 2019-11-23T23:45:53.703

Nice! I didn't think that'd work. Either way my solution is 10s of bytes away from the best Julia one :). – caseyk – 2019-11-23T23:51:41.700

Sure. My score is here

– H.PWiz – 2019-11-24T12:25:12.390

Woah! How'd you do it? Or is that a secret? :) We have a thread that divulged into codegolf on julia discourse! – caseyk – 2019-11-24T13:10:47.043

Sort of a secret. Although I have discussed julia golfing in a chat room on this site.

– H.PWiz – 2019-11-24T21:56:41.580

2

Keg, 5840+4 43 bytes

1(d|0&:3%[|Fizz,⑹]:5%[|Buzz,⑹]&[|:.]
,⑨


Try it online!

-14 bytes thanks to @EdgyNerd and then -1 byte due to using register

58 bytes

1(d|:\“%0=[FizzBuzz|:5%0=[Buzz|:3%0=[Fizz|:⅍]]],
,⑨)


Try it online!

String compression and string formatting are both useless here. Just a standard implementation of Fizzbuzz in Keg.

1Idea to golf some bytes: couldn't you push an empty string, and then concatenate 'Fizz' if it's a multiple of 3, and then concat 'Buzz' if it's a multiple of 5, to save the FizzBuzz in your code (and probably some other bytes) – EdgyNerd – 2019-12-01T11:08:57.403

2

Python 3, 80 bytes

for x in range(1,101):print(("Fizz"if x%3==0else"")+("Buzz"if x%5==0else"")or x)


2

Wd, 29 23 bytes

&ó╞╟↨5O╓46N☻»½_49ƒZÄ▬«Σ


A raw source is here.

After decompression:

2^                         E % Foreach in the 1..100 range
a3m!                 % If the current item is divisible by 3:
"Fizz"    *                % Return "Fizz"
"Buzz"a5m!*     % If the current item | 3 -> "Buzz".
+    % Join those results
a|  % Logical OR this result with the current item
% Implicit print


2

MC6000 ASM (Shenzhen I/O), 133 Bytes

add 1
mov acc x3
mov 51 x2
mov acc x2
mov 3 x2
teq x2 0
+mov 1 x1
mov 51 x2
mov acc x2
mov 5 x2
teq x2 0
+mov 2 x1
slp 1
mov -999 x1


Uses an MC4010 co-processor on x2, numeric display on x3, and a custom fizzbuzz display on x1.

"Hardware":

Custom LCD:

Technically doesn't follow the rules as MCxxxx don't have a STDOUT, but I did the best I could.

2

Javascript 78 (but kinda 58) bytes

Produces the required string, then prints it. The function that produces the string is 58 bytes, another 20 are used to call console.log.

z=n=>n?z(n-1)+((n%3?'':'Fizz')+(n%5?'':'Buzz')||n)+'\n':'';console.log(z(100))


Javascript 72 71 bytes (thanks, Jo King!)

Prints the required lines as it goes. Interweaving console.log with the logic creates a shorter, though less elegant, program.

z=n=>n&&(z(n-1),console.log((n%3?'':'Fizz')+(n%5?'':'Buzz')||n));z(100)


It can also be written like the following, to the same effect and byte count.

z=n=>n&&console.log((z(n-1),(n%3?'':'fizz')+(n%5?'':'buzz')||n));z(100)


De-golfed version:

z = n =>           // take n as argument
n && (           // if n is not falsey (e.g. if it is not 0)
z(n-1),        // use the comma operator to call the previous fizzbuzz
console.log(   // then print a line
(n%3 ? '' : 'Fizz')   // 'Fizz' if n is a multiple of 3, otherwise empty
+ (n%5 ? '' : 'Buzz') // Concatenated with 'Buzz' if multiple of 5
|| n         // Or just the number n if the previous string is empty, which implies that n is not divisible by 3 or 5
)
);
z(100)             // Run fizzbuzz from 100


You can save 5 bytes (on every solution) by using alert instead of console.log – VFDan – 2020-05-19T00:46:54.620

2

APL, 52 chars/bytes

generate integers from 1 to n

⍳


b is a 2 by n boolean matrix highlighting multiples of 3 and 5

b←0=3 5∘.|⍵


c is a boolean vector highlighting multiples of either 3 or 5

c←∨⌿b


format each integer into a character vector

⍕¨⍵


where a number is a multiple of either 3 or 5...

@{c}


...put either Fizz or Buzz (i.e. discard the last 4, the first 4 or no character at all from the string "FizzBuzz" according to b)

(↓∘'FizzBuzz'¨¯4 4+.×c/b)


transform the nested vector into a matrix

↑


2

sed 4.2.2, 129 bytes

A 400-rep bounty for those who outgolf this solution https://codegolf.meta.stackexchange.com/a/18428/

s/^/00,/;h
:
y/0123456789';,/1234567890;,'/
/0.$/!{x;G;s/..\n.//} h s/[05].$/&Buzz/
s/.*,/Fizz/
s/.*\WB/B/
s/[0';]*//gp
g;/00/d
t


Try it online!

s/^/00,/;h


Each number is stored as three characters, the first two store the two-digit padded decimal number, and the last character stores its modulo 3.

: ... t


In a loop,

y/0123456789';,/1234567890;,'/


the modulo is cycled, and the number is incremented using transliteration. Each digit is increased modulo 10, then

/0.$/!{x;G;s/..\n.//}  a simple conditional corrects the first digit on the number if necessary, using the fact each number is stored with exactly 3 characters. h  This incremented form is stored in the hold space. s/[05].$/&Buzz/


Buzzs are added by looking at the last base-10 digit of the number.

s/.*,/Fizz/


Fizzs are added by looking at the modulo-3.

s/.*\WB/B/


There is some cleanup of the number, remove the base-10 digits if needed and

s/[0';]*//gp


remove leading 0s and the modulo-3 so that it is print-ready, and print it.

g;/00/d


Finally retrieve the number from the hold space and exit if 00 is present, i.e. 100 has been reached

2

Rust, 114 bytes

It's not the shortest one available (on code-golf.io someone managed to somehow solve it in 99 bytes, but I have no idea how).

fn main(){(1..101).for_each(|i|println!("{}",["FizzBuzz","Fizz","Buzz",&i.to_string()][1.min(i%5)+2.min(i%3*2)]))}


First off, the obvious part

fn main() {/*..*/}


Then we iterate from 1 to 100 (inclusive) and println! an element of the array

(1..101).for_each(|i| println!("{}", ["FizzBuzz", "Fizz", "Buzz", &i.to_string()][/*..*/]))


To choose the right index, we use the following, where i is the current number

1.min(i % 5) + 2.min((i % 3) * 2)


The first part is 0 if i is a multiple of 5. Otherwise it's 1.

The second part is 0 if i is a multiple of 3. Otherwise it's 2.

Examples:

1.min(1 % 5) + 2.min((1 % 3) * 2) == 1 + 2 == 3 => "1"
1.min(3 % 5) + 2.min((3 % 3) * 2) == 1 + 0 == 1 => "Fizz"
1.min(4 % 5) + 2.min((4 % 3) * 2) == 1 + 2 == 3 => "4"
1.min(5 % 5) + 2.min((5 % 3) * 2) == 0 + 2 == 2 => "Buzz"
1.min(15 % 5) + 2.min((15 % 3) * 2) == 0 + 0 == 0 => "FizzBuzz"


This way, if both parts produce 0, we get the string FizzBuzz. If the sum is 1 we get Fizz, if it's 2 Buzz, if it's 3 we get &i.to_string() (the stringified number).

You can replace println! with print! and add a literal (as in press ENTER/RETURN) newline after the {} in the format string to save a byte. Also, if you're allowed to use a closure, it'd save quite a few bytes over using fn main(). Finally, you save some bytes using a for loop. 99 bytes: TIO

– TehPers – 2020-08-03T22:15:29.147

2

Wn, 22 21 bytes

Seems like nobody ties with Dennis. Just 1 byte away...

♥:jΓƒ¢D╦Γ%%lOvhI♣BAE§


Uncompressed:

3m!?SY%?*?SZ%?a5m!*+a|2^N


Explanation

                      2^N For Each: 1 to 100
3m!                       Repeat whether current item is divisible by 3
?SY%?*                 Repeat that bool by the compressed "Fizz"
?SZ%?a5m!*       Do that for "Buzz" too
+      Join the results
a|    If the result is empty,
turn it to the current item value.

Flag: n                   Join the resulting list with newlines
Implicit output
$$$$


2

Stax, 27 bytes

éeO├φ☻mRàzΦ╛φ#2àáÿ²øΔ=L←§b


Run and debug it

Unpacked and Uncompressed

A2#F~;3%z"Fizz"?;5%z"Buzz"?+cz=,a?P


2

International Phonetic Esoteric Language, 61 60 bytes

{2T}1ɑeb3ⱱɐbʌɔ|a|"Fizz"u|a|q5ⱱɐbʌɔ|b|"Buzz"u|b|ɞʌue1sø"\n"uɒ


Explanation:

{2T}1                                                        (push loop bounds 1 to 2T == 101 base36)
ɑ                                                       (start loop)
eb                                                     (push and dup loop index)
3ⱱɐbʌɔ|a|"Fizz"u|a|                                  (print if fizzy)
q                                 (OVER)
5ⱱɐbʌɔ|b|"Buzz"u|b|              (print if buzzy)
ɞʌu           (else print the number)
e1sø       (increment loop index)
"\n"u  (print a newline)
ɒ (end loop)


-1 byte for using base 36 for 101.

2

MAWP, 120 bytes

[!!3P3WA<75W2W;73W5W;65W2W1M2W;65W2W1M2W;~0~>%!!5P5WA<92M6W;94M9W;65W2W1M2W;65W2W1M2W;~0~>%~{~!:~}~!554WWA?.%1M25W;~(%)]


Try it!

Created this while testing my new online interpreter!

Explanation:

[                                              Start loop
!!3P3WA                                        Is divisible by 3? (Homemade modulo
function)
<                                              If top of stack is not 0 (number is
75W2W;73W5W;65W2W1M2W;65W2W1M2W;               Print 'Fizz'
~0~                                            Add 0 to the bottom of stack by
double reversing
>                                              End conditional
%                                              Remove modulo function result
!!5P5WA<92M6W;94M9W;65W2W1M2W;65W2W1M2W;~0~>%  Do the same for 'Buzz'
~                                              Reverse stack
{                                              If there are no 0 on the top of
stack (not 'Fizz' nor 'Buzz' was
printed),
~!:~                                           then print the current number
}~                                             End conditional and reverse stack
!554WWA?.%                                     If the number is 100, then terminate
program
1M25W;                                         Print newline
~(%)                                           Remove all 0 from bottom of stack
]                                              End of loop


2

Python 2, 73 77 bytes, link

edit:

Even shorter, thanks to @Dingus + removing parenthesis:

for n in range(1,101):print[[n,"Buzz"],["Fizz","FizzBuzz"]][n%3<1][n%5<1]


original:

Here's my matrix-inspired approach:

for n in range(1,101):
print([[n,"Buzz"],["Fizz","FizzBuzz"]][n%3<1][n%5<1])


It avoids double checking modularity for 15. Written out a bit more elaborately, this becomes

for n in range(1,101):
matrix=[[n     ,"Buzz"    ],
["Fizz","FizzBuzz"]]

print(matrix[n%3==0][n%5==0]) # checking ==0 adds 1 byte versus <1.


Welcome to the site, and nice first answer! You might like to include a link to Try It Online (TIO). It seems you can save 2 bytes by putting all your code on one line.

– Dingus – 2020-08-03T11:25:57.733

1Thank you @Dingus for the encouragement and improvement. I also removed the parenthesis since it's Python 2. – Thomas – 2020-08-03T11:50:19.947

2

Integral, 416 Bytes

⌡1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz 16 17 Fizz 19 Buzz Fizz 22 23 Fizz Buzz 26 Fizz 28 29 FizzBuzz 31 32 Fizz 34 Buzz Fizz 37 38 Fizz Buzz 41 Fizz 43 44 FizzBuzz 46 47 Fizz 49 Buzz Fizz 52 53 Fizz Buzz 56 Fizz 58 59 FizzBuzz 61 62 Fizz 64 Buzz Fizz 67 68 Fizz Buzz 71 Fizz 73 74 FizzBuzz 76 77 Fizz 79 Buzz Fizz 82 83 Fizz Buzz 86 Fizz 88 89 FizzBuzz 91 92 Fizz 94 Buzz Fizz 97 98 Fizz Buzz⌡[j


Try it

Integral doesn't have very many ways of doing this challenge yet, so this'll have to do for now.

I'll update it once there's a better way.

ah, beautiful solution. what an algorithm. – Razetime – 2020-09-21T12:57:26.213

2

LiveScript, 57 bytes

I noticed nobody had done LiveScript. This may not be the shortest possible answer, but it's my best attempt.

for i to 99
console.log \Fizz *!(++i%3)+\Buzz *!(i%5)||i


2

MAWP 2.0, 60 bytes

[!3%<"Fizz":1=M>!5%<"Buzz":1=M>M1-{/!:\}0=M10;!100-?.1+]


Explanation:

[                start of loop
!3%              is top of stack divisible by 3?
<"Fizz":1=M>    if yes, print "Fizz" and set variable M to 1
!5%              is top of stack divisible by 5?
<"Buzz":1=M>    if yes, print "Buzz" and set variable M to 1
M1-              push value of M and subtract 1
{/!:\}          if not 0 then print the current number
0=M              set variable M to 0
10;              print a newline
!100-?.         if current number is 100 then terminate program
1+               add 1 to current number
]                end of loop


2

Charcoal, 37 29 bytes

Ｅ…¹¦¹⁰¹∨⁺×Fizz¬﹪ι³×Buzz¬﹪ι⁵Ｉι


Try it online!

How there isn't a charcoal answer yet amazes me. -8 bytes thanks to @Neil

Verbose

There are other minor variants such as Print(Map(100, Or(Add(Ternary(Modulo(Incremented(i), 3), "", "Fizz"), Ternary(Modulo(Incremented(i), 5), "", "Buzz")), Cast(Incremented(i))))); also for 29 bytes, but I do have a 28 byte solution... – Neil – 2020-09-05T23:52:50.590

I guess it's about time I reveal my 28 byte solution: Ｅ¹⁰⁰∨⭆⪪FiBu²⎇﹪⊕ι⁺³⊗μω⁺λzzＩ⊕ι. – Neil – 2020-10-18T18:04:02.073

2

Add++-i, 46 bytes

L,100Rdd3€Ω%€!"Fizz"€*$5€Ω%€!"Buzz"€*z£+z£obUn  Try it online! The flag simply invokes the function for us and outputs its return value, so we don't have to include the invocation in the program. How it works L, ; Anonymous function 100R ; Push [1 2 3 4 ... 99 100] STACK = [[1 2 ... 99 100]] dd ; Triplicate STACK = [[1 2 ... 99 100] [1 2 ... 99 100] [1 2 ... 99 100]] € € ; Over the first, check ... 3 Ω% ! ; divisibility by 3 STACK = [[1 2 ... 99 100] [1 2 ... 99 100] [0 0 ... 1 0]] "Fizz"€* ; Replace 1 with "Fizz" and 0 with "" STACK = [[1 2 ... 99 100] [1 2 ... 99 100] ["" "" ... "Fizz" ""]$ €  €		; Over the second, check ...
5 Ω% !		;     divisibility by 5			STACK = [[1 2 ... 99 100] ["" "" ... "Fizz" ""] [0 0 ... 0 1]]
"Buzz"€*	; Replace 1 with "Buzz" and 0 with ""	STACK = [[1 2 ... 99 100] ["" "" ... "Fizz" ""] ["" "" ... "" "Buzz"]]
z£+		; Zip and concatenate			STACK = [[1 2 ... 99 100] ["" "" ... "Fizz" "Buzz"]]
z£o		; Replace "" with the right number	STACK = [[1 2 ... "Fizz" "Buzz"]]
bUn		; Join with newlines			STACK = ["1\n2\nFizz\n...\n98\nFizz\nBuzz"]
; Return the top of the stack		"1\n2\nFizz\n...\n98\nFizz\nBuzz"


2

l:100
Fl,f,i%3,f=0,"Fizz"*f,b,i%5,b=0,"Buzz"*b,p,f+b,p="",Ip,,Oi,c,f+b,P,p=0,IP,,Oc,


Try it online!

"But there's a shorter Add++ answer" I hear you say. Well, this is flagless and doesn't have a Lambda, so I'd thought I'd post it for comparison.

2

AppleSoft BASIC, 112 bytes

0A$(1)="FIZZ":A$(2)="BUZZ":A$(3)="FIZZBUZZ":FORN=1TO100:A$(0)=STR$(N):?A$((N/3=INT(N/3))+(N/5=INT(N/5))*2):NEXT


Verified on https://www.calormen.com/jsbasic/

2

Forth (gforth), 95 bytes

: f 'e 1 DO 1 i 3 mod 0= if ." Fizz"0 then i 5 mod 0= if ." Buzz"0 then if i . then cr LOOP ; f


Try it online!

With help from @Bubbler, it's shorter than the other forth answer. Explanation coming soon.

2

!@#$%^&*()_+, 378 bytes No TIO link, since the language has been updated to include the = command. ^!!($!!!!(!_++_^^^_$_^_$!!^^_+=!!_+^$!!_+$(+$_^_$!!_+)+!_++!!^^_+=!!_+^$!!_+$(+$_^_$!!_+)+!_+++!!_+^_$+_)+!!_+^$!!_+$(+$_^_$!!_+)+!_++$!_++(zziF@@@@ &!_+%!_+)+!!(!_++_^^^^^_$_^_$!!^^_+=!!_+^$!!_+$(+$_^_$!!_+)+!_++!!^^_+=!!_+^$!!_+$(+$_^_$!!_+)+!_+++!!_+^_$+_)+!!_+^$!!_+$(+$_^_$!!_+)+!_++$!_++(zzuB@@@@ &!_+%!_+)+ &($!#$!_+)
@^%$!_++!d_+!!_+^$!!_+$(+$_^_$!!_+)+!_++!!_+^_$+_$^$)


There are unprintables in this code. Here's an xxd dump:

00000000: 5e21 2128 2421 2121 2128 215f 2b2b 5f5e  ^!!($!!!!(!_++_^ 00000010: 5e5e 5f24 5f5e 5f24 2121 5e5e 5f2b 3d21 ^^_$_^_$!!^^_+=! 00000020: 215f 2b5e 2421 215f 2b24 282b 245f 5e5f !_+^$!!_+$(+$_^_
00000030: 2421 215f 2b29 2b21 5f2b 2b21 215e 5e5f  $!!_+)+!_++!!^^_ 00000040: 2b3d 2121 5f2b 5e24 2121 5f2b 2428 2b24 +=!!_+^$!!_+$(+$
00000050: 5f5e 5f24 2121 5f2b 292b 215f 2b2b 2b21  _^_$!!_+)+!_+++! 00000060: 215f 2b5e 5f24 2b5f 292b 2121 5f2b 5e24 !_+^_$+_)+!!_+^$00000070: 2121 5f2b 2428 2b24 5f5e 5f24 2121 5f2b !!_+$(+$_^_$!!_+
00000080: 292b 215f 2b2b 2421 5f2b 2b28 7a7a 6946  )+!_++$!_++(zziF 00000090: 4040 4040 0026 215f 2b25 215f 2b29 2b21 @@@@.&!_+%!_+)+! 000000a0: 2128 215f 2b2b 5f5e 5e5e 5e5e 5f24 5f5e !(!_++_^^^^^_$_^
000000b0: 5f24 2121 5e5e 5f2b 3d21 215f 2b5e 2421  _$!!^^_+=!!_+^$!
000000c0: 215f 2b24 282b 245f 5e5f 2421 215f 2b29  !_+$(+$_^_$!!_+) 000000d0: 2b21 5f2b 2b21 215e 5e5f 2b3d 2121 5f2b +!_++!!^^_+=!!_+ 000000e0: 5e24 2121 5f2b 2428 2b24 5f5e 5f24 2121 ^$!!_+$(+$_^_$!! 000000f0: 5f2b 292b 215f 2b2b 2b21 215f 2b5e 5f24 _+)+!_+++!!_+^_$
00000100: 2b5f 292b 2121 5f2b 5e24 2121 5f2b 2428  +_)+!!_+^$!!_+$(
00000110: 2b24 5f5e 5f24 2121 5f2b 292b 215f 2b2b  +$_^_$!!_+)+!_++
00000120: 2421 5f2b 2b28 7a7a 7542 4040 4040 0026  $!_++(zzuB@@@@.& 00000130: 215f 2b25 215f 2b29 2b00 2628 2421 2324 !_+%!_+)+.&($!#$00000140: 215f 2b29 0a40 5e25 2421 5f2b 2b21 645f !_+).@^%$!_++!d_
00000150: 2b21 215f 2b5e 2421 215f 2b24 282b 245f  +!!_+^$!!_+$(+$_ 00000160: 5e5f 2421 215f 2b29 2b21 5f2b 2b21 215f ^_$!!_+)+!_++!!_
00000170: 2b5e 5f24 2b5f 245e 2429                 +^_$+_$^$)  Alternatively, here's a version with no unprintables (387 bytes): ^!!($!!!!(!_++_^^^_$_^_$!!^^_+=!!_+^$!!_+$(+$_^_$!!_+)+!_++!!^^_+=!!_+^$!!_+$(+$_^_$!!_+)+!_+++!!_+^_$+_)+!!_+^$!!_+$(+$_^_$!!_+)+!_++$!_++(zziF@@@@!!_+&!_+%!_+)+!!(!_++_^^^^^_$_^_$!!^^_+=!!_+^$!!_+$(+$_^_$!!_+)+!_++!!^^_+=!!_+^$!!_+$(+$_^_$!!_+)+!_+++!!_+^_$+_)+!!_+^$!!_+$(+$_^_$!!_+)+!_++$!_++(zzuB@@@@!!_+&!_+%!_+)+!!_+&($!#$!_+)
@^%$!_++!d_+!!_+^$!!_+$(+$_^_$!!_+)+!_++!!_+^_$+_$^$)


Notes

There's likely still room for golfing. I decided to approach this by manually calculating mod 3 and mod 5 for each integer from 1 to 100, whereas an approach by maintaining separate counters for mod 3 and mod 5 might save tons of bytes. This was more of a proof of concept.

I made this snippet using a templating language of my own creation, which I will publish at some point. Here's the metaprogram:

;let ~ !!_+^$!!_+$(+$_^_$!!_+)+!_++
;let DROP !_++
;let omx !!_+^_$+_ ^ !! ($
!!
!!(
DROP
_ 3{^} _
$_ 1{^} _$

-2=~-2=~+ omx
)+~$DROP ( @"Fizz" 0&!_+% !_+ )+ !!( DROP _ 5{^} _$ _ 1{^} _
$-2=~-2=~+ omx )+ ~$DROP
(
@"Buzz"
0&!_+%
!_+
)+

0& ($!#$!_+)

10@

^%
$DROP ! -100 +~omx$^$)  2 GNU AWK, 1 input byte + 60 bytes = 61 bytes An approach different from Cabbie407's, that golfed 2 bytes off thanks to the more flexible parsing of the GNU's implementation. Still needs one EOF input. END{for(;++n<101;print i?i:n)i=(n%3?e:"Fizz")(n%5?e:"Buzz")}  Try it online! END # starts after commanding the EOF (Ctrl+D). { for(; ++n<101; # the _n_ variable is started here on the conditional, at the value 1. print i?i:n # in the end of each loop, prints _i_ if non-null, or _n_. ) i=(n%3?e:"Fizz")(n%5?e:"Buzz") # two ternary conditionals that concatenates Fizz and Buzz accordingly. # by the way, _e_ is a not assigned variable, which will return a null string (""). # if n != 0 (mod 15), then _i_ will return null at the print statement above. }  For no input, use the BEGIN pattern instead (62 bytes total): BEGIN{for(;++n<101;print i?i:n)i=(n%3?e:"Fizz")(n%5?e:"Buzz")}  2 JavaScript, 69 68 bytes -1 byte: inspired by this answer for(i=0;++i<101;)console.log(i%3?i%5?i:"Buzz":i%5?"Fizz":"FizzBuzz") In a readable form: for (i = 0; ++i < 101; ) { // iterates from 1 to 100 console.log( i % 3 != 0 ? i % 5 != 0 // if i is not divisible by 3 ... ? i // ... and not divisible by 5, print i : "Buzz" // ... but divisible by 5, print Buzz : i % 5 != 0 // if i is divisible by 3 ... ? "Fizz" // ... but not divisible by 5, print Fizz : "FizzBuzz" // ... and divisible by 5, print FizzBuzz ) }  Omit all  != 0 comparison and unnecessary whitespaces. Welcome to the site, and nice first answer! Be sure to check out our Tips for golfing in Javascript page for more ways you could golf your answer. – caird coinheringaahing – 2021-01-31T13:21:08.497 2 Java 9492 91 Bytes (loop without class declaration or main function) by Alex North small optimizations by Alexander Lemieux first the fully golfed/optimized code (the best I could do) for(int i=0;i++<100;System.out.println(i%3<1|i%5<1?(i%3<1?"fizz":"")+(i%5<1?"buzz":""):i));  for reference here is what he posted to wiki.c2 (exactly copied and pasted from there) for(int i = 0; i < 100; i++, System.out.println(i % 3 == 0 || i % 5 == 0 ? ((i % 3) == 0 ? "fizz" : "")  first I removed all of the spaces and changed the logical "or" to a bitwise "or" (changed || to |) for(int i=0;i<100;i++,System.out.println(i%3==0|i%5==0?((i%3)==0?"fizz":"")+((i%5)==0?"buzz":""):i));  then I changed i%3==0 and i%5==0 to i%3<1 and i%5<1 ( I also removed unnecessary parenthesis), for(int i=0;i<100;i++,System.out.println(i%3<1|i%5<1?(i%3<1?"Fizz":"")+(i%5<1?"Buzz":""):i));  lastly, I changed the loop from (int i=0;i<100;i++)  to (int i=0;i++<100;)  how it works for(int i=0;i++<100;  regular java for loop System.out.println(  print statement (i%3<1|i%5<1?(i%3<1?"Fizz":"")+(i%5<1?"Buzz":""):i));  this is a little more complicated, it's roughly equivalent to the pseudo code: if i is evenly divisible by 3 or 5 then if i is evenly divisible by 3 then "Fizz" + if i is evenly divisible 5 then "Buzz" else i hope that wasn't too confusing. THIS IS NOT MY CODE, I JUST CHANGED A FEW CHARACTERS, ALL CREDIT SHOULD GO TO ALEX NORTH! my current best for FizzBuzz using java is 94 characters that can be found here I did this because I thought his code deserved to be shown off because it is a smart solution. 2 Turing Machine Code, 5743 bytes 0 * * * 1 1 * 1 r # # * # * f f * * l f f 1 1 l ! f 2 2 l " f 3 3 l £ f 4 4 l$
f 5 5 l %
f 6 6 l ^
f 7 7 l &
f 8 8 l
f 9 9 l (
f 0 0 l )
f F F l f
f i i l f
f z z l f
f B B l f
f u u l f
) 1 1 * ¬
) 2 2 * -
) 3 3 * =
) 4 4 * +
) 5 5 * {
) 6 6 * }
) 7 7 * [
) 8 8 * ]
) 9 9 * :
! _ _ r '
! 1 1 r @
! 2 2 * ~
! 3 3 r \
! 4 4 r /
! 5 5 * ,
! 6 6 r .
! 7 7 r <
! 8 8 * >
! 9 9 r ?
" _ _ r a
" 1 1 * b
" 2 2 r c
" 3 3 r d
" 4 4 * e
" 5 5 r ƒ
" 6 6 r g
" 7 7 * h
" 8 8 r ï
" 9 9 r j
£ _ _ r k
£ 1 1 r l
£ 2 2 r m
£ 3 3 * n
£ 4 4 r o
£ 5 5 r p
£ 6 6 * q
£ 7 7 r r
£ 8 8 r s
£ 9 9 * t
$_ _ r ü$ 1 1 r v
$2 2 * w$ 3 3 r x
$4 4 r y$ 5 5 * ž
$6 6 r A$ 7 7 r Ɓ
$8 8 * C$ 9 9 r D
% _ _ r E
% 1 1 * Ϝ
% 2 2 * G
% 3 3 * H
% 4 4 * I
% 5 5 * J
% 6 6 * K
% 7 7 * L
% 8 8 * M
% 9 9 * N
^ _ _ r O
^ 1 1 r P
^ 2 2 r Q
^ 3 3 * R
^ 4 4 r S
^ 5 5 r T
^ 6 6 * U
^ 7 7 r V
^ 8 8 r W
^ 9 9 * X
& _ _ r Y
& 1 1 r Z
& 2 2 * α
& 3 3 r β
& 4 4 r γ
& 5 5 * δ
& 6 6 r ε
& 7 7 r ζ
& 8 8 * η
& 9 9 r θ
 _ _ r ι
1 1 * κ
 2 2 r λ
3 3 r μ
 4 4 * ν
5 5 r ξ
 6 6 r ο
7 7 * π
 8 8 r ρ
9 9 r ς
( _ _ r σ
( 1 1 r τ
( 2 2 r υ
( 3 3 * φ
( 4 4 r χ
( 5 5 r ψ
( 6 6 * ω
( 7 7 r Α
( 8 8 r Β
( 9 9 * Γ
@ * * r @
@ # _ r Δ
Δ _ 1 r Ε
Ε _ 2 r F
' * * r '
' # _ r 2
2 _ 2 r #
~ * * r ~
~ 2 _ r ~
~ 1 _ r ~
~ # _ r Ζ
Ζ _ 2 r 2
\ * * r \
\ # _ r Η
Η _ 3 r 2
/ * * r /
/ # _ r Θ
Θ _ 4 r Ε
, * * r ,
, 5 _ r ,
, 1 _ r ,
, # _ r Ι
Ι _ 5 r 2
. * * r .
. # _ r Κ
Κ _ 6 r 2
< * * r <
< # _ r Λ
Λ _ 7 r Ε
> * * r >
> 8 _ r >
> 1 _ r >
> # _ r Μ
Μ _ 8 r 2
? * * r ?
? # _ r Ν
Ν _ 9 r 2
a * * r a
a # _ r Ξ
Ξ _ 3 r F
3 _ 3 r #
b * * r b
b 1 _ r b
b 2 _ r b
b # _ r Ο
Ο _ 1 r 3
c * * r c
c # _ r Π
Π _ 2 r 3
d * * r d
d # _ r Ρ
Ρ _ 3 r Ξ
e * * r e
e 4 _ r e
e 2 _ r e
e # _ r Σ
Σ _ 4 r 3
ƒ * * r ƒ
ƒ # _ r Τ
Τ _ 5 r 3
g * * r g
g # _ r Υ
Υ _ 6 r Ξ
h * * r h
h 7 _ r h
h 2 _ r h
h # _ r Φ
Φ _ 7 r 3
ï * * r ï
ï # _ r Χ
Χ _ 8 r 3
j * * r j
j # _ r Ψ
Ψ _ 9 r Ξ
k * * r k
k 3 _ r k
k # _ r 4
4 _ 4 r #
Ω _ 4 r F
l * * r l
l # _ r ¤
¤ _ 1 r 4
m * * r m
m # _ r ¥
¥ _ 2 r Ω
n * * r n
n 3 _ r n
n # _ r ¦
¦ _ 3 r 4
o * * r o
o # _ r ¨
¨ _ 4 r 4
p * * r p
q * * r q
q 6 _ r q
q 3 _ r q
q # _ r ª
ª _ 6 r 4
r * * r r
r # _ r «
« _ 7 r 4
s * * r s
s # _ r ®
® _ 8 r Ω
t * * r t
t 9 _ r t
t 3 _ r t
t # _ r °
° _ 9 r 4
ü * * r ü
ü # _ r ±
± _ 5 r B
v * * r v
v # _ r ²
² _ 1 r ³
³ _ 5 r Ƒ
5 _ 5 r #
w * * r w
w 2 _ r w
w 4 _ r w
w # _ r ¶
¶ _ 2 r ±
x * * r x
x # _ r ·
· _ 3 r ±
y * * r y
y # _ r ¸
¸ _ 4 r ³
ž * * r ž
ž 5 _ r ž
ž 4 _ r ž
ž # _ r ¹
¹ _ 5 r ±
A * * r A
A # _ r »
» _ 6 r ±
Ɓ * * r Ɓ
Ɓ # _ r ¼
¼ _ 7 r ³
C * * r C
C 8 _ r C
C 4 _ r C
C # _ r ½
½ _ 8 r ±
D * * r D
D # _ r ¾
¾ _ 9 r ±
E * * r E
E # _ r ¿
E 5 _ r E
¿ _ 6 r F
6 _ 6 r #
Ϝ * * r Ϝ
Ϝ 1 _ r Ϝ
Ϝ 5 _ r Ϝ
Ϝ # _ r À
À _ 1 r 6
G * * r G
G 2 _ r G
G 5 _ r G
G # _ r Á
Á _ 2 r 6
H * * r H
H 3 _ r H
H 5 _ r H
H # _ r Â
Â _ 3 r ¿
I * * r I
I 4 _ r I
I 5 _ r I
I # _ r Ã
Ã _ 4 r 6
J * * r J
J 5 _ r J
J # _ r Ä
Ä _ 5 r 6
K * * r K
K 6 _ r K
K 5 _ r K
K # _ r Å
Å _ 6 r ¿
L * * r L
L 7 _ r L
L 5 _ r L
L # _ r Æ
Æ _ 7 r 6
M * * r M
M 8 _ r M
M 5 _ r M
M # _ r Ç
Ç _ 8 r 6
N * * r N
N 9 _ r N
N 5 _ r N
N # _ r È
È _ 9 r ¿
O * * r O
O 6 _ r O
O # _ r 7
7 _ 7 r #
É _ 7 r F
P * * r P
P # _ r Ê
Ê _ 1 r 7
Q * * r Q
Q # _ r Ë
Ë _ 2 r É
R * * r R
R 3 _ r R
R 6 _ r R
R # _ r Ì
Ì _ 3 r 7
S * * r S
S # _ r Í
Í _ 4 r 7
T * * r T
T # _ r Ï
Ï _ 5 r É
U * * r U
U 6 _ r U
U # _ r Ð
Ð _ 6 r 7
V * * r V
V # _ r Ñ
Ñ _ 7 r 7
W * * r W
W # _ r Ò
Ò _ 8 r É
X * * r X
X 9 _ r X
X 6 _ r X
X # _ r Ó
Ó _ 9 r 7
Y * * r Y
Y # _ r 8
8 _ 8 r #
Z * * r Z
Z # _ r Ô
Ô _ 1 r Õ
Õ _ 8 r F
α * * r α
α 2 _ r α
α 7 _ r α
α # _ r Ö
Ö _ 2 r 8
β * * r β
β # _ r ×
× _ 3 r 8
γ * * r γ
γ # _ r Ø
Ø _ 4 r Õ
δ * * r δ
δ 5 _ r δ
δ 7 _ r δ
δ # _ r Ù
Ù _ 5 r 8
ε * * r ε
ε # _ r Ú
Ú _ 6 r 8
ζ * * r ζ
ζ # _ r Û
Û _ 7 r Õ
η * * r η
η 8 _ r η
η 7 _ r η
η # _ r Ü
Ü _ 8 r 8
θ * * r θ
θ # _ r Ý
Ý _ 9 r 8
ι * * r ι
ι # _ r Ā
Ā _ 9 r F
9 _ 9 r #
κ * * r κ
κ 1 _ r κ
κ 8 _ r κ
κ # _ r Ă
Ă _ 1 r 9
λ * * r λ
λ # _ r Ą
Ą _ 2 r 9
μ * * r μ
μ # _ r Ć
Ć _ 3 r Ā
ν * * r ν
ν 4 _ r ν
ν 8 _ r ν
ν # _ r Ĉ
Ĉ _ 4 r 9
ξ * * r ξ
ξ # _ r Ċ
Ċ _ 5 r 9
ο * * r ο
ο # _ r Đ
Đ _ 6 r Ā
π * * r π
π 7 _ r π
π 8 _ r π
π # _ r Ē
Ē _ 7 r 9
ρ * * r ρ
ρ # _ r Ĕ
Ĕ _ 8 r 9
ς * * r ς
ς # _ r Ė
Ė _ 9 r Ā
Č _ 0 r #
σ * * r σ
σ # _ r Ę
σ 9 _ r σ
Ę _ 1 r Ď
Ď _ 0 r B
τ * * r τ
τ # _ r Ě
Ě _ 2 r Ď
υ * * r υ
υ # _ r Ĝ
Ĝ _ 3 r Ğ
Ğ _ 0 r Ƒ
φ * * r φ
φ 3 _ r φ
φ 9 _ r φ
φ # _ r Ġ
Ġ _ 4 r Ď
χ * * r χ
χ # _ r Ģ
Ģ _ 5 r Ď
ψ * * r ψ
ψ # _ r Ĥ
Ĥ _ 6 r Ğ
ω * * r ω
ω # _ r Ħ
ω 6 _ r ω
ω 9 _ r ω
Ħ _ 7 r Ď
Α * * r Α
Α # _ r Ĩ
Ĩ _ 8 r Ď
Β * * r Β
Β # _ r Ī
Ī _ 9 r Ğ
Γ * * r Γ
Γ 9 _ r Γ
Γ # _ r Ĭ
Ĭ _ B r Į
Į _ u r İ
İ _ z r Ĳ
Ĳ _ z r halt
Ĵ _ 1 r #
Ķ _ 1 r F
¬ * * r ¬
¬ 1 _ r ¬
¬ 0 _ r ¬
¬ # _ r Ĺ
Ĺ _ 1 r Ĵ
- * * r -
- 2 _ r -
- 0 _ r -
- # _ r Ļ
Ļ _ 2 r Ķ
= * * r =
= 3 _ r =
= 0 _ r =
= # _ r Ľ
Ľ _ 3 r Ĵ
+ * * r +
+ 4 _ r +
+ 0 _ r +
+ # _ r Ŀ
Ŀ _ 4 r Ĵ
{ * * r {
{ 5 _ r {
{ 0 _ r {
{ # _ r Ł
Ł _ 5 r Ķ
} * * r }
} 6 _ r }
} 0 _ r }
} # _ r Ń
Ń _ 6 r Ĵ
[ * * r [
[ 7 _ r [
[ 0 _ r [
[ # _ r Ň
Ň _ 7 r Ĵ
] * * r ]
] 8 _ r ]
] 0 _ r ]
] # _ r Ņ
Ņ _ 8 r Ķ
: * * r :
: 9 _ r :
: 0 _ r :
: # _ r Ŋ
Ŋ _ 9 r Ĵ
F _ F r i
i _ i r ȥ
ȥ _ z r ź
ź _ z r #
Ƒ _ F r í
í _ i r ż
ż _ z r ƶ
ƶ _ z r B
B _ B r u
u _ u r z
z _ z r ź


Try it online!

2

Mathematica, 103 86 73 bytes

With 30 bytes saved thanks to @A Simmons!

f="Fizz";b="Buzz";Range@100/.{x_/;15∣x->f<>b,x_/;3∣x->f,x_/;5∣x->b}


You can use g=Divisible instead of the function definition, there's a leading space (and another one right after f<>b,), and you can use x~g~15 instead of x~g~3&&x~g~5. So f="Fizz";b="Buzz";g=Divisible;Range@100/.{x_/;x~g~15->f<>b,x_/;x~g~3->f,x_/;x~g~5->b} – CalculatorFeline – 2016-03-02T16:28:23.010

You can use f="Fizz";b="Buzz";Range@100/.{x_/;15∣x->f<>b,x_/;3∣x->f,x_/;5∣x->b} for 73 bytes in 67 characters. – A Simmons – 2016-03-02T17:51:12.403

CatsAreFluffy, It turns out that your code gives incorrect answers for 5 and 100, for example. – DavidC – 2016-03-02T22:28:51.730

It's a pair of zero width characters right after the g. Here's code for correcting that: FromCharacterCode[ToCharacterCode@#/.{8204|8203->(##&[])}]& (Don't worry, no zero widths here.) – CalculatorFeline – 2016-03-02T22:34:49.053

2

JavaScript, 73 bytes

for(i=s='';i++<100;s+=((i%3?'':'Fizz')+(i%5?'':'Buzz')||i)+"\n");alert(s)


2

for i in 1..100:echo max(["Fizz","",""][i%%3]&["Buzz",""][ord i%%5>0],$i)  Hm... still trying to learn Nim, and I'm thinking there's got to be a better way... ["Fizz",""][i*i%%3] saves 1. Using ord on a boolean is a useful tip, thanks for that. – primo – 2019-06-19T10:02:39.457 2 PHP, 73 71 bytes <?for($i=0;$i++<100;)echo$i%3?$i%5?$i:@Buzz:@Fizz.($i%5?"":@Buzz)," ";  All the most terrible things. I wanted the wrongheaded ternary to do something magical, but it did not. 2 VB.Net, 147 146 bytes Module F Sub Main() For i=1To 100 Dim a=i Mod 3,b=i Mod 5 Console.WriteLine("{0:#}{1:;;Fizz}{2:;;Buzz}",If(a*b>0,i,0),a,b) Next End Sub End Module  It uses the same conditional formatting trick as the C# answer by Pierre-Luc Pineault. UPDATED: saved 1 byte thanks to Brian J you can save a byte by using If instead of IIf. The difference is that IIf is a function that will evaluate both the true and false options, while If is an operator that will only evaluate the option it needs. Functionally doesn't make a difference in this case, but does save a character. – Brian J – 2015-09-25T13:13:26.153 2 Ceylon, 368144123 96 bytes shared void z(){for(i in 1..100){print(["FizzBuzz","Buzz","Fizz",i][(i%5).sign*2+(i%3).sign]);}}  Here we have the ungolfed original of 368 bytes: shared void fizzBuzz() { for(i in 1..100) { if(3.divides(i)){ if(5.divides(i)) { print("FizzBuzz"); } else { print("Fizz"); } } else { if(5.divides(i)) { print("Buzz"); } else { print(i); } } } }  In Ceylon, Integers are also just objects, so one can call methods on them (like the divides method here). 1..100 is syntactic sugar for span(1, 100), which is a Range<Integer>, which implements Iterable<Integer>, and can therefore be used with the for loop. The print function takes one argument (of type Anything), stringifies it (i.e. if it's an object, calls its .string attribute, if it's null, takes "<null>") and prints it to the standard output. Removing whitespace, using a shorter function name, and replacing x.divides(y) by the shorter y%x==0, which is essentially how divides is implemented, gives us this (144 bytes): shared void f(){for(i in 1..100){if(i%3==0){if(i%5==0){print("FizzBuzz");}else{print("Fizz");}}else{if(i%5==0){print("Buzz");}else{print(i);}}}}  Of course, this is not the best which is possible ... this uses print and if much too often, and also does the check for divisibility by 5 twice. Integers (or Numbers types in general) have also the .sign attribute, which is 1 for positive numbers, 0 for zero, and -1 for negatives. We can use that together with the remainder operator to get a different value for each of the four cases: (i % 5).sign * 2 + (i % 3).sign]. This is 0 for FizzBuzz, 1 for Buzz, 2 for Fizz and 3 for the "plain" case. We can use this as an index of a tuple, coming to this 123-bytes program: shared void z() { for(i in 1..100) { print(["FizzBuzz", "Buzz", "Fizz", i][(i%5).sign*2 + (i%3).sign]); } }  ([...] is the syntax for both Tuple creation (here a Tuple with element types String, String, String, Integer, formally Tuple<String|Integer, String, Tuple<String|Integer, String, Tuple<String|Integer, String, Tuple<Integer, Integer, Empty>>>, which can be written shorter as [String, String, String, Integer]) and lookup in a Correspondence (and this tuple type implements Correspondence<Integer, String|Integer>). Removing the whitespace again gives us this 96 byte program: shared void z(){for(i in 1..100){print(["FizzBuzz","Buzz","Fizz",i][(i%5).sign*2+(i%3).sign]);}}  2 Go, 162158145143142 139 bytes package main;import."fmt";func main(){for i,p:=1,Println;i<101;i++{s:="";if i%3<1{s+="Fizz"};if i%5<1{s+="Buzz"};if s!=""{p(s)}else{p(i)}}}  Go Playground Link 2 Python 2, 148 133 Bytes def f(n): if n%3+n%5<1:return"FizzBuzz" if n%5<1:return"Buzz" if n%3<1:return"Fizz" return n for x in map(f,range(1,101)):print x  it is possible to save some bytes by reducing the amount of indentation. (1 space is sufficient) – Mohammad – 2015-09-27T18:12:32.593 1@Mhmd it's probably actually tabs, SE converts them to 4 spaces. – undergroundmonorail – 2015-09-27T22:18:59.667 if n%3+n%5==0:return"FizzBuzz" -> if n%3+n%5==0:return f(3)+f(5) EDIT: nevermind i miscounted, it's the same – undergroundmonorail – 2015-09-27T22:19:36.657 1oh, but you can change ==0 to <1 everywhere it appears – undergroundmonorail – 2015-09-27T22:58:40.497 1This can be shortened significantly by removing the function and return logic: for i in range(100):print(i%3+i%5<1and'FizzBuzz')or(i%5<1and'Buzz')or(i%3<1and'Fizz')or i golfs it down to 89 bytes. – Skyler – 2015-10-26T13:47:07.550 2 QB64, 102 94 bytes FOR i=1TO 100 o$=MID$("Fizz",i*5MOD 15)+MID$("Buzz",i*5MOD 25)
IF""<o$THEN?o$ELSE WRITE i
NEXT


Doesn't work on actual QBasic; see below for why.

This program has one problem: QBasic/QB64 outputs to an 80x24 window, not a terminal, so the results can't be scrolled back. If you run the above code as-is, all you'll see is the lines from 78 onward. To prove that the code does 1 to 100 correctly, you can add the line SLEEP 1 right before NEXT for a 1-second delay on each iteration.

Ungolfed code and explanation

FOR i = 1 TO 100
index = 5 * (i MOD 3)
o$= MID$("Fizz", index)
index = 5 * (i MOD 5)
o$= o$ + MID$("Buzz", index) IF "" < o$ THEN
PRINT o$ELSE WRITE i END IF NEXT  On each iteration, we put the appropriate fizzes and buzzes into the string o$, check if it's empty, and output o$ or the number accordingly. The main question is how to get "Fizz" when i is divisible by 3 and "" otherwise. Here are the approaches I tried: IF i MOD 3THEN o$=""ELSE o$="Fizz" o$="":IF i MOD 3=0THEN o$="Fizz" o$=MID$("Fizz",5*(i MOD 3)) o$=MID$("Fizz",i*5MOD 15)  The approach with MID$ is much shorter. This function takes 3 arguments--string, start index, and number of characters--and returns the appropriate substring. When the third argument is omitted, it takes everything from the start index to the end of the string. Here, when i is exactly divisible, the start index is 0 and we get the whole string; otherwise, it's something larger that's past the end of the string, so MID$ gives "".1 The other tricky part is printing numbers according to the spec. QBasic's PRINT command outputs positive numbers with leading spaces, which is occasionally useful but usually just annoying. The WRITE command, however, does not add a leading space--perfect for our purposes here. 1 Strings are 1-indexed in QBasic--i.e., in the string "abcd", a is at index 1 and d is at index 4. This is why I'm multiplying the mod result by 5: MID$("Fizz",4) gives "z". In actual QBasic, 0 isn't a legal index and gives Illegal function call; but in QB64, MID$("Fizz",0) happily returns the whole string instead of complaining. 2 rs, 92 91 bytes (_)^^(100) +^(_+)(_)/\1 \1\2 \b((___)+)\b/Fi;\1 \b(_{5})+\b/Bu; ;_*/zz \b(_+)\b/(^^\1) /\n  Saved 1 byte thanks to @MartinBüttner! Live demo. (It may take a bit to run!) Do you not have \0 in rs? You can probably save some bytes either way by using the trick from my Retina answer: \b((___)+)\b/Fi;\1 ... \b(_{5})+\b/Bu; ... ;_+/zz – Martin Ender – 2015-09-28T14:38:12.380 @MartinBüttner Thanks! I updated the post. What exactly do you mean by \0? – kirbyfan64sos – 2015-10-01T19:44:23.287 Something to reference the entire match, not just a capturing group. – Martin Ender – 2015-10-01T19:59:47.247 @MartinBüttner I guess not. :( – kirbyfan64sos – 2015-10-01T20:05:45.697 @MartinBüttner I'm just using Python's built-in substitution thing. I can easily override it, though... – kirbyfan64sos – 2015-10-01T20:06:49.883 2 C# using LINQ, 168 186 using System.Linq;class A{static void Main(){foreach(var s in Enumerable.Range(1,100).Select(n=>n%3==0?n%5==0?"FizzBuzz":"Fizz":n%5==0?"Buzz":n.ToString()))System.Console.WriteLine(s);}}  2 haxe, 110 bytes class Main{ static function main() for(i in 1...101) Sys.println(i%3<1?"Fizz"+(i%5<1?"Buzz":""):i%5<1?"Buzz":i); }  (newlines and indents added for clarity) Haxe isn't much of a golfing language … I was trying to do something with enumerators: class Main{ static function main() for(i in 1...101) Sys.println( switch(i){ case _%3=>0:i%5<1?"FizzBuzz":"Fizz"; case _%5=>0:"Buzz"; case _:i; } ); }  But 140 bytes. :I 2 C#, 155 142 Bytes class a{static void Main(){for(int i=0;i++<100;){var s="";if(i%3<1)s="Fizz";if(i%5<1)s+="Buzz";if(s=="")s=i+"";System.Console.WriteLine(s);}}}  Added as an alternate approach to the example using LINQ Thanks @Riokmij! 1You can replace the ==0's with <1, change the declaration of s with var instead of string, and replace the call to .ToString() by +"". Also, initial value for i should be 0. – Najkin – 2015-09-29T15:56:52.043 2 MSX-BASIC, 106 bytes 1FORI=1TO100:IFIMOD3=0ANDIMOD5=0THEN?"FizzBuzz"ELSEIFIMOD3=0THEN?"Fizz"ELSEIFIMOD5=0THEN?"Buzz"ELSE?I 2NEXT  The one-liner version to be executed in direct mode would be 120 bytes because all of the extra NEXTs needed before the ELSEs: FORI=1TO100:IFIMOD3=0ANDIMOD5=0THEN?"FizzBuzz":NEXTELSEIFIMOD3=0THEN?"Fizz":NEXTELSEIFIMOD5=0THEN?"Buzz":NEXTELSE?I:NEXT  1IFIMOD3=0ANDIMOD5=0 -> IFIMOD15=0? I think MSX BASIC could be tokenized too, which would decrease your byte count. – lirtosiast – 2015-09-30T14:53:59.123 2 O, 53 52 bytes I'm sure that there will be a better way to do this. Thanks to kirbyfan64sos for the implicit J. "Buzz"JA.*1mrl{.3%{.5%{}{;J}?}{"Fizz"\5%{}{J+}?}?p}d  Try it here 52 bytes: "Buzz"JA.*1mrl{.3%{.5%{}{;J}?}{"Fizz"\5%{}{J+}?}?p}d. O has the implicit J variable like Pyth. – kirbyfan64sos – 2015-10-01T23:13:10.380 omg someone other than my mom used O <3 – phase – 2015-11-08T04:09:09.467 2 Minkolang, 50 bytes "d"[i1+d5%6&"Buzz"0c3%6&"Fizz"I1-3&N6@0gx(O)25*O].  Try it here. Explanation "d"[...]. For loop that loops from 0 to 99, then stops i1+ Loop counter + 1 (so it's 1 to 100) d5%6&"Buzz" Divisibility test by 5, skips "Buzz" if not divisible 0c3%6&"Fizz" Divisibility test by 3, skips "Fizz" if not divisible I1- Length of stack minus 1 (0 if there's no Fizz or Buzz) 3&N6@ Output as integer if ^ is 0, skip character output otherwise 0gx(O) Dump the loop counter and output "Fizz"/"Buzz"/"FizzBuzz" 25*O Print newline  2 Swift, 75 bytes for n in 1...100{print(n%3*n%5>0 ?n:(n%3>0 ?"":"Fizz")+(n%5>0 ?"":"Buzz"))}  2 , 32 chars / 47 bytes ⩥ṤⓜᵖFizzBuzzė⧺_%3⅋4,_%5?4:8)⋎_  Try it here (Firefox only). 2 F#, 129116113 111 Seq.iter(fun x->printfn"%s"(["Fizz";"";""].[x%3]+(if x%5=0 then"Buzz"elif x%3>0 then string x else""))){1..100}  2 scg, 51 bytes 1á01°r{d[[d"Buzz"]["Fizz"d"Buzz"+]]\3%!@\5%!@" "}m  So, does this mean that scg is a real language now? Explanation: 1 .- adds 1 to the stack á01 .- adds 101 to the stack °r .- range, adds array with 1-100 on the stack { .- start function for use in map d .- duplicates number [ .- array [ d .- duplicate number again, ends up in array "Buzz" .- wonder what this does ] .- end array [ "Fizz" d .- duplicate fizz "Buzz"+ .- ends up with "FizzBuzz" ] ] .- end array. Ends up with a 2D array \ .- gets number to calculate to the top 3% .- mod 3 ! .- not, so any above 0 int turns to 0 and 0 turns to1 @ .- get array value. Now you have two choices for output \5%!@ .- same as above but for 5. .- now we have the correct fizzbuzz value "\n" .- pushes newline. I do not have variables yet so no shortcuts }m .- end function, map. output is implicit  2 C#, 174 bytes void A(){for(int x=1;x<101;x++){if(x%15<1)Console.Write("FizzBuzz\n");else if(x%3<1)Console.Write("Fizz\n");else if(x%5<1)Console.Write("Buzz\n");else Console.WriteLine(x);}}  Ungolfed: void A(){ for (int x = 1; x < 101; x++) { if (x % 15 < 1) Console.Write("FizzBuzz\n"); else if (x % 3 < 1) Console.Write("Fizz\n"); else if (x % 5 < 1) Console.Write("Buzz\n"); else Console.WriteLine(x); } }  2 Javascript, 191 bytes for(var i=1; i<=100; i++){ var r = ""; if( i%15 == 0 ? r = "FizzBuzz" : (i%5 == 0 ? r = "Buzz" : (i%3 == 0 ? r = "Fizz" : r = i)) ){ console.log(r); } }  1Welcome to Programming Puzzles & Code Golf. Nice first answer! But please wrap your code into a code-block (indent with 4 spaces or use the button in the editor). Also you should format the header correctly, the common template for this here is ##<language>, <byte count> bytes. Also you have some unnecessary whitespaces in your code which you should remove. – Denker – 2016-03-10T09:59:42.500 1Nice answer, but the goal of this challenge is to make your answer as short as possible. You can save a ton of bytes by removing all whitespace, and renaming result to r. – ETHproductions – 2016-03-11T20:32:11.757 2 XQuery 3, 172 bytes declare option output:method "text";string-join(for$x in 1 to 100 return if($x mod 15=0)then"FizzBuzz"else if($x mod 3=0)then"Fizz"else if($x mod 5=0)then"Buzz"else$x,"
")


There were only 7 XQuery answers on the whole site, I thought it could at least have its FizzBuzz ! Granted it's not very golfy, in particular when you need to add a 36 bytes preface so that it does not output an XML header.

I tested it with Saxon-HE's command-line XQuery tool (java net.sf.saxon.Query fizzbuzz.xq), with which I had to replace the w3-defined option declaration with declare option saxon:output "method=text";.

2

Tcl, 136 bytes

set f {Fizz 3 Buzz 5}
while {[incr n]<=100} {set s ""
foreach {m d} $f {if {$n%$d==0} {append s$m}}
if {$s eq ""} {puts$n} {puts $s}}  This solution, incidentally, is easily extensible to any combination of multiples. See The Smart Person's Mirage golf, where gnibbler posted the same idea (but in Python). set iterations 100 set fizzies { Fizz 3 Jazz 4 Buzz 5 } while {[incr n] <=$iterations} {
set s ""
foreach {name divisor} $fizzies { if {$n % $divisor == 0} {append s$name}
}
if {$s eq ""} {puts$n} {puts $s} }  2 Oration, 98 bytes literally, for i in range(1,100):x=""if i%3 else'Fizz';x+=""if i%5 else "Buzz";print x if x else i  2 ROOP, 187 bytes 1 V! !< (102) 1| e#r3##r5# a| #H # # Y-< N N ! "Fizz""Buzz" mX mX ### V--> ! A V----> # ' C V'e "\n" |# M # <V# #v C A C #X ## w O#  I will try to explain each section of code: V! !< Add 1 to each number that goes to the left of the a 1| and sends it to the bottom of the V a| -<  (102) The 102 falls to the left of the e and each number e that passes over is compared to 102. #H If a number is equal then the H runs and ends the program   #r3# With each number that goes above the r # the remainder of dividing by 3 is obtained. N The N returns 1 if the number is 0, and 0 otherwise. "Fizz" The string "Fizz" falls and moves to the left of the m. The number is multiplied by the string mX ("" or "Fizz" if it is 0 or 1 respectively) ### The X removes the number when it moves to the right The same is done with 5 and "Buzz"   mX mX V--> Both strings are concatenated with the A A getting "", "Fizz", "Buzz" or "FizzBuzz" #   ' C The C changes the direction of advance of string, to the left. 'e At the same time the "e" compares the string with the empty string. # The single quotes are a vertical literal string.   V The V and pipes redirects the string to the right of the C | that changes the direction again in order that comes to the left of the A <V C A   Y The original number is converted to a string with Y. ! ! Pipes and teleporters (!) Redirects the string to below the V V---->   M The string falls to the right of the M and multiplies # # with the number previously obtained by the e A The result is above the A   "\n" The string "\n" falls on the v which makes a copy M # whenever there is a space below. v The C changes the direction of the string so it goes to the left. A C It waits to the right of the A   A The A concatenate all 3 strings, the result is on the w that sends it #X ## to the O representing the output. At the same time the X deletes the string. w O#  I hope it is comprehensible, English is not my main language. 1 Mathematica, 61 Bytes Heavily inspired by this post on the mathematica stack exchange fizzbuzz[#,,fizz,,buzz][[#~GCD~15~Mod~15]]&~Array~100//Colum‌​n  This doesn't work properly for me on 10.2, but I assume that's a version variation as {#,,"fizz","fizzbuzz","buzz"}[[#~GCD~15~Mod~11]]&~Array~100//Column does – Mark S. – 2017-08-04T00:42:15.947 1 tcl, 72 time {puts [expr [incr i]%3?$i%5?$i:"":"Fizz"][expr$i%5?"":"Buzz"]} 100


I think it is more golfable, to avoid the repetition of i%5

demo

1

Plain Javascript (no console.log() & no alert()), 64 bytes

for(f=b='';f++<100;b+=(f%5?z||f:z+'Buzz')+'\n')z=f%3?'':'Fizz';b


Just copy/paste into any javascript console and hit enter.

1

REXX, 94 bytes

f.=
b.=
f.0='Fizz'
b.0='Buzz'
do i=1 to 100
f=i//3
b=i//5
r=f.f||b.b
if r<i then r=i
say r
end


Alternative 94 byte solution:

f='FizzBuzz'
do i=1 to 100
r=left(f,(i//3=0)*4)right(f,(i//5=0)*4)
if r='' then r=i
say r
end


Managed to get it down to 81. https://codegolf.stackexchange.com/questions/58615/1-2-fizz-4-buzz/120791#120791

– theblitz – 2017-05-16T09:55:16.343

1

Lua, 126 bytes

for i=1,100 do if i%15==0 then print"FizzBuzz"elseif i%3==0 then print"Fizz"elseif i%5==0 then print"Buzz"else print(i)end;end


I don't know Lua too well, but can you remove a few spaces (100do and 0then twice) – Zacharý – 2017-08-03T20:36:40.930

1

K, 52 Bytes

-1@{,/$$[#i:&~.q.mod[x;3 5];FizzBuzz i;x]}'1+!100;  Thanks 1 Turtlèd, 221 bytes 99;,:[*,l]u[*d{*u,dr}ul' l[ l]ru]u3;[ [ r]l[ ' l]ll"Fizz";]<97:>5[ (*[ r]l[ ' l]ll)(zr)"Buzz";]<104:>[ lll'0rrr[ r]l{*' l{*l}{ l}(9'0l( r"1!")(9"10!"))(8'9)(7'8)(6'7)(5'6)(4'5)(3'4)(2'3)(1'2)(0'1)(!'0):{ l}}[ l]drrrr{zd}]  due to a bug (having two close curly brackets next to each other causes the second one to match to the first ones open bracket), the Try it online version is different for now (I put a space between the two close curly brackets) 99;,:[*,l]u[*d{*u,dr}ul' l[ l]ru]u3;[ [ r]l[ ' l]ll"Fizz";]<97:>5[ (*[ r]l[ ' l]ll)(zr)"Buzz";]<104:>[ lll'0rrr[ r]l{*' l{*l}{ l}(9'0l( r"1!")(9"10!"))(8'9)(7'8)(6'7)(5'6)(4'5)(3'4)(2'3)(1'2)(0'1)(!'0):{ l} }[ l]drrrr{zd}]  Try it online! I might write an explanation if I get time motivated 1 Ruby, 68 65 bytes q='Buzz';(1..100).map &->e{p e%3<1?'Fizz'+(e%5<1?q:''):e%5<1?q:e}  If you've made your program one byte shorter, you'll want to change the header to 64 bytes :) – numbermaniac – 2017-05-16T21:05:55.210 1Why map &->e{ and not map{|e| ? – daniero – 2017-06-05T21:19:51.273 1 braingasm, 40 bytes The language is coming along nicely. A few recent features allows for a quite decent FizzBuzz, if I may say so myself: 100[>#3p["Fizz".+]#5p["Buzz".+]z[#:]10.]  Here's how it works: 100[ One hundred times: > Go to the next cell. #3p[ If current cell number is divisble by 3: "Fizz". Print "Fizz". + Increment current cell ] #5p["Buzz".+] Same thing for 5 and "Buzz". z[ If the current cell is 0 (hasn't been incremented): #: Print current cell number ] 10. Print a newline ]  Hmm nice language... Is there an online interpreter or is it all offline? – Beta Decay – 2017-05-27T16:29:50.273 @BetaDecay Thanks :) No, nothing online yet. I'm focusing mostly on implementing all my ideas, and to document things once they're a little bit more stable. – daniero – 2017-05-27T16:41:54.540 1 Python 2.7, 59 Bytes for i in range(100):print i%3//2*'Fizz'+i%5//4*'Buzz'or i+1  Explanation: for i in range(100)  This will generate a list of numbers from 1 to 100 and assign it to the i variable. print i%3//2*'Fizz'+i%5//4*'Buzz'or i+1  Note that this loop will repeat 100 times, and in each time, the loop will do what this line is commanding. 2"This will generate a list of numbers from 1 to 100" I think you meant 0 to 99, otherwise you wouldn't need to use i+1 :) – Aaron – 2017-08-25T15:46:30.850 You don't need //; with integer arguments, / performs integer division in Python 2. -~i saves an additional byte. https://tio.run/##K6gsycjPM/r/Py2/SCFTITNPoSgxLz1Vw9DAQNOqoCgzr0QhU9VY30hL3S2zqkpdO1PVVN9ES92pFMjJL9Kty/z/HwA – Dennis – 2017-08-25T15:49:31.137 1 Recursiva, 46 bytes EmB100"%a15:%a5:%a3:a!'Fizz'!'Buzz'!'FizzBuzz'  Try it online! Explanation: EmB100"%a15:%a5:%a3:a!'Fizz'!'Buzz'!'FizzBuzz' E - Stringify and join with new-lines m - map with B100 - Range [1,2..100] " - mapping function start %a15:%a5:%a3:a!'Fizz'!'Buzz'!'FizzBuzz' - string as per divisibility %a15:%a5:%a3:a!'Fizz'!'Buzz'!'FizzBuzz' roughly translates to this if-else block: if(a%15): elif(a%5): elif(a%3): return a else: return 'Fizz' else: return 'Buzz' else: return 'FizzBuzz'  1 AsciiDots, 152 bytes  # /"" \~\ @\-\ [=]@*-\ /@----*-~& |0/---*[>] |@\<>_"Buzz"@1) |*-~/ /-/ ||[%]-\>#100) v\-*#5*/ |.// | \<>_"Fizz"@1) |/-~/ @|[%]-\ 0\-*#3/ *-[+] \#1/  Try it online! 1 Python 2, 57 bytes for i in range(100):print i%3/2*"Fizz"+i%5/4*"Buzz"or i+1  Not the most beautiful code but it works at least with python -c  1 Extremely late answer and for a language that has already a bit too many answers, however, i've not seen a single function answer that actually RETURNS the expected string, instead of printing it to console, so here it is: Javascript 73 bytes (i=0,r="")=>i>99?r:f(++i,r+=(i%5?i%3?i:'Fizz':i%3?'Buzz':'FizzBuzz')+' ')  1 Funky, 59 bytes for(i=1i<100i++)print((("Fizz"*1&!i%3)+("Buzz"*1&!i%5))ori)  Try it online! 1 nodejs repl, 60 bytes for(i=0;++i<101;util.puts(i%5?s||i:s+'Buzz'))s=i%3?'':'Fizz'  With latest node, this prints a deprecation warning to the console. This presumably violates the rule about printing to STDERR, but using an older version of node will fix this. Answers are not required to be in the latest version of their language, so this is still valid. – pppery – 2020-04-09T02:22:42.980 1 APL Nars 93 chars h;i;j i←0 L:j←0⋄i+←1⋄→A×⍳0≠3∣i⋄⍞←'Fiz'⋄j←1 A:→B×⍳0≠5∣i⋄⍞←'Buz'⋄j←1 B:→C×⍳j=0⋄→D C:⍞←i D:⎕←''⋄→L×⍳i≤99  Indented:  ∇ h;i;j i←0 L:j←0⋄i+←1⋄→A×⍳0≠3∣i⋄⍞←'Fiz'⋄j←1 A: →B×⍳0≠5∣i⋄⍞←'Buz'⋄j←1 B: →C×⍳j=0⋄→D C: ⍞←i D: ⎕←''⋄→L×⍳i≤99 ∇  1 APL(NARS), 44, 43, 39 chars 78 bytes ⊃{⍱/z←0=3 5∣⍵:⍕⍵⋄∊z/'fizz' 'buzz'}¨⍳100  In practice I follow Adam suggest. I had seen other APL solutions, so I copied the way. In the follow APL code, ←A here suppress the output of A. ←{⎕←∊{∨/j←0=3 5∣⍵:j/'fizz' 'buzz'⋄⍵}⍵}¨⍳100 {⎕←∊{∨/j←0=3 5∣⍵:j/'fizz' 'buzz'⋄⍵}⍵⋄⍬}¨⍳100 This above should return at end 100 void list, but it seems they are not showed at last here. {⎕←{×+/j←0=3 5∣⍵:⊃,/j/'fiz' 'buz'⋄⍵}⍵⋄⍬}¨⍳100 This just above has one error because fiz and buz should be fizz and buzz {⎕←{0<+/j←0=(3 5)∣⍵:⊃,/j/('fiz' 'buz')⋄⍵}⍵⋄⍬}¨⍳100 :for i:in⍳100⋄{0<+/j←0=(3 5)∣⍵:⊃,/j/('fiz' 'buz')⋄⍵}i⋄:endfor Ever so slightly golfed (and adding the missing "z"s): ⊃{∨/j←0=3 5∣⍵:∊j/'fizz' 'buzz'⋄⍕⍵}¨⍳100 – Adám – 2017-12-07T23:45:54.843 1 C, 152 bytes #include<stdio.h> #define p printf int i,f;main(){while(i++<100){if(i%3==0&&(f=1))p("Fizz");if(i%5==0&&(f=1))p("Buzz");if(f==0||(f=0))p("%d",i);p("\n");}}  Ungolfed one: #include<stdio.h> #define p printf int i,f; main() { while(i++<100) { if(i%3==0&&(f=1))p("Fizz"); if(i%5==0&&(f=1))p("Buzz"); if(f==0||(f=0))p("%d",i); p("\n"); } }  This is not ok: main(){while(i++<100){(i%3<1&&p("fizz"))+(i%5<1&&p("buzz"))<1&&p("%d",i);p("\n");} ? – None – 2017-12-07T19:01:58.850 1 C (gcc), 101 bytes #define P printf main(i){for(i=0;i++<100;P("\n"))(i%3<1&&P("fizz"))+(i%5<1&&P("Buzz"))<1&&P("%u",i);}  It could have one indefinite behavior in the use + operation, the order of evaluation could be swapped. Try it online! You can change #define P printf to #define P printf( to cut off three bytes. – Steadybox – 2017-12-08T07:25:50.853 94 bytes – Steadybox – 2017-12-08T07:32:41.877 1 Kotlin, 115 bytes fun main(a:Array<String>){(1..100).map{println(when(it%15){0->"FizzBuzz";3,6,9,12->"Fizz";5,10->"Buzz";else->it})}}  Try it online! 1 face, 152 bytes (FizzBuzz%d@ )\F*,c'Fo>m+*1+m=*m?*m1+m3+m4+m5+11334455BF"B4%B"%4N%"N3:~0?%=+3?=31?w=F4>:3%=+5?=51?w=B4>:5??+p="%c+w="=>:+w=N1>+++1*=55*==4+==1-=+=?=~  Annotated: (FizzBuzz%d@ ) \F*,c'Fo> ( obtain data pointer, a number, and stdout ) m+*1+ ( counter variable, goes from 1 to 100 ) m=*m?* ( result and temp variables ) m1+m3+m4+m5+11334455 ( relevant constants ) BF"B4%B"%4N%"N3 ( get pointers to Fizz, Buzz, %d, and \n ) :~ 0? ( has either Fizz or Buzz been printed? ) %=+3?=3 ( skip to label 3 if not divisible by 3 ) 1?w=F4>:3 ( otherwise, print "Fizz" ) %=+5?=51?w=B4>:5 ( same for "Buzz" ) ??+p="%c+w="=>:+ ( if we didn't print anything, print the number ) w=N1> ( print a newline ) +++1 ( increment the counter ) *=55*==4+==1-=+= ( set the result variable to 100-n ) ?=~  Try it online! (The trailing newline is required on TIO due to a bug that's been fixed in a newer version of face.) 1 J, 73 Bytes }.":('Fizz'"_)('Buzz'"_)('FizzBuzz'"_)@.((0:=3&|)++:@(0:=5&|))"0 i.101  Definitely not the greatest, looking for ways to improve this. Explanation:  "0 i.101 | To each number from 0 to 100 ((0:=3&|)++:@(0:=5&|)) | 1 if divisble by three, 2 if by 5, 3 if by both @. | Using the result of the previous verb, select a verb from the following gerund ":('Fizz'"_)('Buzz'"_)('FizzBuzz'"_) | Apply the appropriate Fizz-Buzz string }. | Remove the first entry (since we counted 0)  1 17, 229 bytes 17 was made after the challenge was made, but not designed to be any good at it. This code could probably be golfed a bit smaller, but it is a reasonably hard language to do anything with. Golfed version(removed unneeded space and duplicated numbers where useful): 0{2 # 1 + : 2 @ 5g == 1 + 0 @}1{2 # 3 % ! 3 * 2 # 5 % ! 5 * + 10 + 0 @}13{42  63  73 :   a  0 0 @}15{3f  6f  73 :   a  0 0 @}18{42  63  73 : : :   3f  6f    a  0 0 @}10{2 #$$ a $0 0 @}}777{0 2 @ 0 1 @ 0 0 @}  Ungolfed version: 0 { 2 # 1 + : 2 @ 5g == 1 + 0 @ } 1 { 2 # 3 % ! 3 * 2 # 5 % ! 5 * + 10 + 0 @ } 13 { 42$ 63 $73$ 73 $a$
0 0 @
}

15 {
3f $6f$ 73 $73$ a $0 0 @ } 18 { 42$ 63 $73$ 73 $3f$ 6f $73$ 73 $a$
0 0 @
}

10 {
2 # a  0 0 @ } 777 { 0 2 @ 0 1 @ 0 0 @ }  Explanation: Block 0: Load value at 2, add 1, duplicate, store at 2, if value == 100 push 1, else 0, add 1, store at 0. Block 1: Will only be ran after block zero if value != 100. Load from 2, mod 3, not, times 3. If value at 2 is a multiple of 3 it will be 3, else 0. Same again for 5, add them and 17(looks like 10, but remember it uses base 17) and stores value at 0. Block 13(or 20): Will only be run after 1 if value is a multiple of 3, not 5. Push and print ascii values for Fizz\n Block 15(or 22): Will only be run after 1 if value is a multiple of 5, not 3. Push and print ascii values for Buzz\n Block 18(or 25): Will only be run after 1 if value is a multiple of 3 and 5. Push and print ascii values for FizzBuzz\n Block 10(or 17): Will only run after 1 if value is not multiple of 3 or 5. Prints numeric form of value. Block 777(or 2149): Like main for C++, first block to be run 1 kavod, 688 bytes 535 9}122 2}122 2}105 2}70 2}4 2}122 3}122 3}117 3}66 3}4 3}1 0><-+0>~0~><3 66 9}165.86?<1+>><-+2 0 86 9}478.><-+><5 100 9}165.120?<1+>><-+3 0 120 9}478.><-+<140?><-+><139 9}392.0><-+1+><10#100 158 9}258.162?47.9{.171 9}178.><-+9{.0 8}0 8}8}9}8{9{1+8{>8}9}8{9{>214 9}276.218?241.><-+<7}><<+8{1+8}8}7{196.><-+<1-+<-8{1-9{.-265 9}318.1 273 9}296.9{.-283 9}318.0 1-293 9}296.9{.-303 9}318.307?313.><-9{.1+9{.323?9{.><1+331?359.8}9}8{9{1-345?355.8}9}8{9{325.1+363.1-363.8}9}8{9{><-+9{.0 8}9}8{9{-9{.396?451.><0 406 9}276.457?><-+418 9}421.9{.425?445.10 433 9}178.439 9}421.48+#9{.~0~9{.48+#9{.><-+45#469 9}378.475 9}421.9{.8}~><8}489?499.1-8}>#8{485.><-+8{><8}513?526.1-<8}9}8{9{509.8{+8{~9{.  Try it online! Formatted better: 535 9}122 2}122 2}105 2}70 2}4 2}122 3}122 3}117 3}66 3}4 3}1 0><-+0>~0~><3 66 9}165.86?<1+>> <-+2 0 86 9}478.><-+><5 100 9}165.120?<1+>><-+3 0 120 9}478.><-+<140?><-+><139 9}392.0><-+1+> <10#100 158 9}258.162?47.9{.171 9}178.><-+9{.0 8}0 8}8}9}8{9{1+8{>8}9}8{9{>214 9}276.218?241. ><-+<7}><<+8{1+8}8}7{196.><-+<1-+<-8{1-9{.-265 9}318.1 273 9}296.9{.-283 9}318.0 1-293 9}296. 9{.-303 9}318.307?313.><-9{.1+9{.323?9{.><1+331?359.8}9}8{9{1-345?355.8}9}8{9{325.1+363.1-363 .8}9}8{9{><-+9{.0 8}9}8{9{-9{.396?451.><0 406 9}276.457?><-+418 9}421.9{.425?445.10 433 9}178 .439 9}421.48+#9{.~0~9{.48+#9{.><-+45#469 9}378.475 9}421.9{.8}~><8}489?499.1-8}>#8{485.><-+8 {><8}513?526.1-<8}9}8{9{509.8{+8{~9{.  Ok so I can only really explain this vaguely, but stacks 2 and 3 hold the strings Fizz and Buzz. The program loops is roughly equivalent to the following code: push 0 ;dummy :fb drop copy 0 dup call divides 3 jif not3 load add 1 copy drop call puts 2 0 :not3 drop dup call divides 5 jif not5 load add 1 copy drop call puts 3 0 :not5 drop load jif cont drop dup call putn push 0 :cont drop add 1 dup putc 10 call gt 100 jnt fb ret  ...just translated into pseudo-ops codes. Yeah. Then the rest of the program is defining sanity functions. Guide to reading J 9}N. usually means "call function at N, and return to J afterwards"; 9{. signifies this return. 1 Wumpus, 49 bytes "zzuB"L)=S5%4*&;"zziF"L3%!!4*&;l=]&oL~!?ONL"d"-:.  Try it online! Explanation I haven't yet found a good way to write compact programs with branching control flow, so I decided to avoid branches altogether for this one (handling conditionals via skipping individual instructions). The program is a single line which is a run in a loop (because the . at the end skips back to the first character). We'll be using the stack depth to determine whether Fizz and/or Buzz needs to be printed, so we can't keep the loop counter on the stack. Instead, we'll be using the default register for this (which is initialised to zero). "zzuB" Tentatively push the code points for "Buzz" onto the stack. L)=S Load the loop counter from the register, increment it, and store a copy back in the register. I'll call the loop counter for this iteration i. 5% Compute i % 5 to test divisibility by 5. 4* Multiply by 4. This gives 0 if 5 divides i, and some n ≥ 4 if it doesn't. &; Discard that many values from the stack. Discarding from an empty stack does nothing, so if 5 doesn't i, we get rid of "Buzz", otherwise, we do nothing. The code for "Fizz" is similar: "zziF" Push the code points for "Fizz". L3% Compute i % 3. This time, we can't just discard n ≥ 4 values, but we have to discard exactly 4 values, otherwise we might get rid of the "Buzz". !! Double logical NOT. Gives 0 for 0 and 1 for positive values. 4* Multiply by 4. Now we've got 0 if 3 divides i and 4 otherwise. &; Discard that many values to get rid of "Fizz" if 3 doesn't divide i. l Push the stack depth D. =] Make a copy for later and shift it to the bottom of the stack. &o Print D characters from the top of the stack. If any of "Fizz" or "Buzz" were left on the stack, this prints them. Otherwise, D = 0 and this does nothing. L~ Load i and put it underneath D. !?O If D = 0, print i (in decimal). Otherwise, i remains on the stack. N Print a linefeed. L"d"- Compute i-100. This is zero when we want to end the program. : Compute i/(i-100). When we've reached i = 100, this terminates the program due to the attempted division by zero. Otherwise, this leaves some junk value X on the stack. . Jump to (0, X), emptying the stack. But since it's impossible to go out of bounds in Wumpus, the coordinates will automatically be taken modulo the grid dimensions. Since the grid is only one row tall, the y-coordinate becomes X%1 = 0, so regardless of X, this always jumps back to the beginning of the program.  1 Visual Basic .NET (Mono), 151 bytes Module M Sub Main Dim i,s For i=1To 100 s="" s=IIf(i Mod 3,s,"Fizz") s=IIf(i Mod 5,s,s+"Buzz") Console.WriteLine(IIf(s="",i,s)) Next End Sub End Module  Try it online! 1 Yabasic, 108 bytes Yet Another answer. For i=1To 100 S="" If!Mod(i,3)Then S="Fizz"Fi If!Mod(i,5)Then S=S+"Buzz"Fi If S=""Then?i Else?SFi Next  Try it online! 1 TIS, 573 + 48 = 621 bytes Code (573 bytes): @0 MOV ANY DOWN MOV ANY RIGHT @1 MOV ANY DOWN ADD DOWN MOV ANY DOWN ADD DOWN MOV ANY LEFT MOV LEFT DOWN ADD DOWN @2 SUB 101 JLZ C HCF C:ADD 102 MOV ACC LEFT @3 MOV ANY DOWN MOV ANY UP @4 MOV UP DOWN MOV ANY UP MOV UP DOWN MOV ANY UP MOV UP DOWN MOV ANY UP MOV UP DOWN MOV ANY UP MOV UP RIGHT MOV ANY DOWN MOV ANY UP @5 MOV ANY DOWN MOV ANY LEFT @6 ADD UP MOV 70 DOWN MOV 105 DOWN MOV 122 DOWN MOV 122 DOWN MOV 0 UP @7 MOV UP ACC JEZ N MOV ACC DOWN N:MOV -1 RIGHT MOV 0 UP @8 MOV ANY ACC JLZ N MOV 66 DOWN MOV 117 DOWN MOV 122 DOWN MOV 122 DOWN MOV 0 UP JRO -7 N:MOV 10 DOWN  Layout (48 bytes): 3 3 CCCCCCCCC O0 ASCII - O1 NUMERIC - O2 ASCII -  Try it online! Explanation I think my TIS emulator is ready for its debut! This is an emulator inspired by (and based on) the wonderful game TIS-100. However, where the game only emulates the 100 model of the TIS series, I have designed this emulator to reflect the full range of possibilities. The code is in the format standardized by the game; we'll get to that in a bit. But first, the layout description just below that. Layout This is a specification for which model and configuration within the TIS range we desire. Whereas the model in the game (also called TIS-100) is only found in a 3 rows by 4 columns layout, for this solution I require something different. I desire a 3 by 3 square instead. Since there are multiple types of nodes that can fall in each slot, I specify that all nine are Compute nodes (other types include e.g. stack memory). In a TIS, the top row of nodes may read in input from above themselves (if so configured) and the bottom row may write below themselves to perform output (again, if so configured). For this challenge, no Inputs are needed, but I desire three different Outputs, corresponding to the three columns in this layout. The first and third column outputs (O0 and O2) are each in ASCII mode; this means that they will translate the internal numeric type to an ASCII character when performing output. The center column (O1) is a NUMERIC output, meaning that the values sent to this output will instead be written out as a number. In all cases, we want the data to go to stdout (-). Putting all this together gives the layout file seen above. Code TIS assembly code is stored in a flat file, as seen above. The code under the heading @0 will go in the first compute node, @1 in the second compute node, and so on. The layout in this solution looks like this: 0 1 2 3 4 5 6 7 8  Since each compute node only has capacity for 15 lines of code, my solution distributes the primary logic across 6 different nodes (the other three just bus data back and forth). Those 6 nodes are as follows: Node @2, the top right, is the counter, counting 1 through 100, and terminating execution (HCF) upon reaching 101. Node @1, the top center, sends every third number left (for Fizz), and all numbers down. Node @6, the bottom left, produces "Fuzz" when given any number. Node @4, the true center, sends every fifth number right (for Buzz), and all numbers down. Node @8, the bottom right, produces "Buzz" when given a non-negative number and "\n" otherwise. Node @7, the bottom center, produces a number if that number hasn't already been Fizzed or Buzzed (or both), and then requests a newline to be printed. It is quite possible that this is not yet a fully optimal golf, but this is also the first golf I've done for TIS. Hmm, I'm thinking that due to the decisions here, especially point 2, I could argue for not including the layout in the byte count. It is a 'different implementation', essentially. Opinions appreciated. – Phlarx – 2018-03-29T21:31:41.687 1 Jstx, 36 bytes ₧&0←+☺:@♥>ø↕₧K2→+◙♣>ø↕₧O2→+◙%↓2◙∟416  Explanation ₧& # Push literal 100 0 # Enter an iteration block over the first stack value and push the iteration element register at the beginning of each loop. ← # Push literal false + # Store the first stack value in the a register. ☺ # Push literal 1 : # Push the sum of the second and first stack values. @ # Push three copies of the first stack value. ♥ # Push literal 3 > # Push the modulus of the second and first stack values. ø # Push literal 0 ↕ # Enter a conditional block if the top two stack values are equal. ₧K # Push literal Fizz 2 # Print the first stack value. → # Push literal true + # Store the first stack value in the a register. ◙ # End a conditional block. ♣ # Push literal 5 > # Push the modulus of the second and first stack values. ø # Push literal 0 ↕ # Enter a conditional block if the top two stack values are equal. ₧O # Push literal Buzz 2 # Print the first stack value. → # Push literal true + # Store the first stack value in the a register. ◙ # End a conditional block. % # Push the value contained in the a register. ↓ # Enter a conditional block if first stack value exactly equals false. 2 # Print the first stack value. ◙ # End a conditional block. ∟ # Push literal null 4 # Print the first stack value, then a newline. 1 # End an iteration block. 6 # Ends program execution.  Try it online! 1 Phooey, 57 bytes &1[101>&0<@@%3{"Fizz">&1<}&%5{"Buzz">&1<}&>{<i>}c10<+1]  Try it online! Explanation &1 set current cell to 1 [101 until that cell is 101: >&0< zero the cell to the right @@ push two copies of the current cell to the stack %3{"Fizz">&1<} if it's divisible by 3, print "Fizz" &%5{"Buzz">&1<} if it's divisible by 5, print "Buzz" & restore cell >{<i>} if it's not, print the restored cell c10 print a newline <+1 increment the current cell ]  This actually doesn't look like such a bad language – ASCII-only – 2018-04-20T13:02:42.060 @ASCII-only Thank you! – Conor O'Brien – 2018-04-20T13:05:25.590 There's only one problem: this is nothing like Foo :P – ASCII-only – 2018-04-20T13:16:46.563 @ASCII-only This is strikingly like foo, actually. The only thing in this answer unlike foo are the new while loops [...] – Conor O'Brien – 2018-04-20T13:18:13.423 ockquote> _> actually... have I spent my entire life thinking the meme language Foo/how it's represented in the meme post was actually all Foo did – ASCII-only – 2018-04-20T13:33:55.833 @ASCII-only So did I, which is one reason I made this language: to emphasize just how cool Foo was. – Conor O'Brien – 2018-04-20T13:38:35.820 1 ORACLE SQL (107 bytes) select nvl(decode(mod(rownum,3),0,'Fizz')||decode(mod(rownum,5),0,'Buzz'),rownum)from xmltable('1 to 100')  DEMO 1 Pyret, 150 bytes d={(a,b):if num-modulo(a,b) == 0:if b == 3:"Fizz"else:"Buzz" end else:""end} each({(y):q=d(y,3) + d(y,5) print(if q == "":y else:q end)},range(1,101))  You can try this online by copying it into the online Pyret editor! Pyret is a language designed with education in mind, so there's a couple things it enforces to keep things readable in normal programs. This explains why some of the operators are surrounded by spaces and the presence of newlines in the program. The {(...): ...} syntax is shorthand for lambda expressions, which gives us the following ungolfed version: d = lam(a,b): if num-modulo(a,b) == 0: if b == 3: "Fizz" else: "Buzz" end else: "" end end each( lam(y): q = d(y,3) + d(y,5) print( if q == "": y else: q end) end, range(1,101))  1 Python 2.7, 105 bytes for i in range(1,101): w='' if i%3==0:w+='Fizz' if i%5==0:w+='Buzz' if w!='':print w else:print i  I know this can be golfed a lot. But I don't know how though. 1General golf tip that is surprisingly pythonic: w!='' can be w. – Jonathan Frech – 2018-07-18T11:07:32.957 Though for a more golfed version of the straight-forward approach, see this answer. – Jonathan Frech – 2018-07-18T11:12:30.410 1 Lua, 80 bytes Can probably be improved: s=("").sub for i=1,100 do r=s("Fizz",i%3*5)..s("Buzz",i%5*5)print(r..s(i,#r))end  Readable version: s=("").sub for i=1,100 do r=s("Fizz",i%3*5)..s("Buzz",i%5*5) print(r..s(i,#r)) end  1 Python 3, 62 bytes for _ in range(1,101):print("Fizz"*(_%3<1)+"Buzz"*(_%5<1)or _) Try it online! 1 K (oK), 4946 43 bytes Solution: 0:{[a:,/&FizzBuzz!~5 3!'x;a;x]}'1+!100  Try it online! Explanation: 0:{[a:,/&FizzBuzz!~5 3!'x;a;x]}'1+!100 / the solution !100 / range 0..99 1+ / add 1 { }' / apply lambda {} to each number [ ; ; ] / conditional, [if;then;else] 5 3!'x / apply modulo (!) of each 5 and 3 to the input x ~ / not (0->1, anything else->0) FizzBuzz! / turn results into a dictionary & / keys where true  / convert to strings ,/ / flatten a: / save as a a / result if a is not empty - so Fizz / Buzz x / result if a is empty - so 1, 2, 4 0: / print to stdout  Notes: • -6 bytes thanks to @ngn with a new approach 12 2/ -> 2/­­­­, @' -> ' – ngn – 2018-10-01T03:48:41.220 it produces the same output without the  – ngn – 2018-10-02T13:13:30.527 \FizzBuzzFizzBuzz->a,,,/a:FizzBuzz – ngn – 2018-10-02T13:18:52.330 1and here's a slightly shorter one abusing "where" on dicts: \0:{[a:,/&FizzBuzz!~5 3!'x;a;x]}'1+!100 – ngn – 2018-10-02T13:37:46.887 1 C#, 119 bytes class q{static void Main(){for(var i=0;i++<100;)System.Console.WriteLine(i%3*i%5>0?i+"":"{i%3:;;Fizz}{i%5:;;Buzz}");}}  Try it online! I was wondering how close I could get to the long standing 124 byte C# answer by Pierre-Luc, so I challenged myself to try. After unexpectedly beating it by just one byte (123 bytes, Try it online!), I took the advice from @LiamK's three year old comment and used string interpolation to shave off another 4 bytes. I'm genuinely surprised by how well this worked out! 1 Pyth, 39 bytes VS100J+?q0%N3"Fizz"k?q0%N5"Buzz"k?qJkNJ  Try it online! There's probably an easier and shorter way. Also is(polishNotation, annoying). This is roughly equivalent to: for x in range(1,100): a = "" + "Fizz" if x%3==0 else "" + "Buzz" if x%5==0 else "" print(a if a!="" else x)  1 Dart, 80 bytes f({i=0}){for(;i++<100;)print((i%3>0?'':'Fizz')+(i%5>0?(i%3>0?'i':''):'Buzz'));} f({i=0}){for(;i++<100;)print("{i%3>0?'':'Fizz'}{i%5>0?(i%3>0?i:''):'Buzz'}");} f({i=0}){for(;i++<100;)print(i%15<1?'FizzBuzz':i%5<1?'Buzz':i%3<1?'Fizz':'i');}  Try it online! 1 Alchemist, 101 bytes 0x+f+b->Out__+x+b 0x+0f->Out_"Fizz"+2f+x 0x+0b+f->Out_"Buzz"+5b+x x+0b->f x+b+a->_+Out_"\n"!99a+2f+4b  Try it online! Takes a few confusing shortcuts in order to reuse the Buzz for FizzBuzzs. Explanation: !99a+2f+4b # Initialise the program with # 99a (overall counter) # 2f (Fizz counter) # 4b (Buzz counter) # 1_ (num counter) 0x+f+b->Out__+x+b # If there's a Fizz and Buzz counter, print the current number # Also decrement the Fizz counter 0x+0f->Out_"Fizz"+2f+x # If there's no Fizz counter, print Fizz # And reset the Fizz counter 0x+0b+f->Out_"Buzz"+5b+x # If there's no Buzz counter and there is a Fizz counter, print Buzz # Reset the Buzz counter # And decrement the Fizz counter # After we've printed any of these, set the x flag x+0b->f # If there is also no Buzz counter, go back to the Buzz printer # This is to ensure the Buzz check comes after the Fizz check x+b+a->_+Out_"\n" # Otherwise, decrement the total counter # Decrement the Buzz counter # Increment the num counter # And print a newline  1 JavaScript (Node.js), 71 bytes for(i=0;++i<101;)console.log((l=i%3<1?"Fizz":'')+(i%5<1?"Buzz":l?"":i))  Try it online! 1 JavaScript, 12712281 79 bytes for(e=0;++e<101;)console.log(e%3||e%5?e%3==0?"Fizz":e%5==0?"Buzz":e:"FizzBuzz")  Another way, based on Taylor Scott's solution, is only 78 72 bytes for(e=0;++e<101;)s=e%3?"":"Fizz",s+=e%5?"":"Buzz",console.log(""==s?e:s)  Try it online! - First Solution Try it online! - Second Solution Thanks @JoKing I'm still getting back into OOP from procedural (college class) – Ryan Knutson – 2019-03-08T01:11:52.230 Thanks @taylor-scott – Ryan Knutson – 2019-03-08T01:58:21.437 2Stuff in the format a==0?b:c can be a?c:b – Jo King – 2019-03-08T02:30:33.030 1 C++ 123 122 bytes -1 thanks to JonathanFrech #import<iostream> #define s std::cout<< main(){for(int i;100-i++;s(i%3?"":"Fizz")<<(i%5?"":"Buzz")<<'\n')i%3*i%5?s i:s"";}  You can move the declaration of i inside the loop. Furthermore, is this variables initial value guaranteed to be zero? – Jonathan Frech – 2019-03-22T14:36:03.780 @JonathanFrech I read somewhere that global ints are automatically initialized to 0 – Yoris – 2019-03-22T20:53:09.197 1 Racket, 107 Bytes (for{[x 100]}(define(f a b n)(if(=(modulo(+ 1 x)n)0)a b))(printf"~a~a\n"(f'Fizz""3)(f'Buzz(f""(+ 1 x)3)5)))  Try it online! The inspiration for my answer comes from Luca H's post. All I did afterwards was factor out the repetitive calls to (if (modulo ...) ...). Sadly, there are two copies of (+ 1 x) left that I couldn't factor out using less characters, so they remain. Ungolfed (including removing f): (for {[x 100]} (printf "~a~a\n" (if (= (modulo (+ x 1) 3) 0) 'Fizz "") (if (= (modulo (+ x 1) 5) 0) 'Buzz (if (= (modulo (+ x 1) 3) 0) "" (+ x 1)))))  1 33, 60 bytes 1asz'Fizz'{tlot}t[3rznpn1cztsl5rz"Buzz"npn1tlaz''nqtl1aztsi]  Explanation: 1asz (Initialise the counter with 1) 'Fizz'{tlot}t (Create function 'Fizz' to print current number) [ (Start of loop) 3rz (Check if divisible by 3) np (If so, print 'Fizz') n1czts (Store result for later) l (Load the counter back) 5rz (Check if divisible by 5) "Buzz"np (If so, print 'Buzz') n1tlaz (Check if divisible by neither by retrieving the value from earlier) ''nqt (If neither 'Fizz' nor 'Buzz' was printed, print the number) l1azts (Restore our counter and increment it) i] (Print a newline and repeat from the start of the loop)  1 Julia, 87 Bytes for i in 1:100;println(i%3<1 ? "Fizz"*(i%5<1 ? "Buzz" : "") : (i%5<1 ? "Buzz" : i));end  More readable: for i in 1:100 if i%3 < 1 print("Fizz") if i%5 < 1 println("Buzz") else println() end elseif i%5 < 1 println("Buzz") else println(i) end end  Not sure if there's already a Julia submission here. Also my first time golfing c: Indirect thanks to @Najkin because I saw their reply to a C# submission saying that you can use <1 instead of ==0 and that helped me save 3 bytes over my previous 90-byte solution! BTW if you see any "unnecessary" spaces, they're actually necessary as Julia would throw a syntax error without them. (Why?!) oh I just realized there's a 72-byte Julia submission lol – Sagittarius – 2019-08-28T14:02:11.023 1 Visual Basic Script, 123 bytes For i=1To 100 S="" If i Mod 3=0Then S="Fizz" End If If i Mod 5=0Then S=S+"Buzz" End If If S=""Then S=i End If MsgBox S Next  Sorry @Taylor Scott but I basically copied your MY-BASIC solution 1 Hoon, 115 bytes This is a Hoon say generator which can be used to write the output to a file from the dojo. turn is Hoon's map, it takes a list from 1..100 generated via (gulf 1 100) and uses string interpolation and the 'null check' conditional rune ?~ to generate either "Fizz", "Buzz" or "FizzBuzz" according to the value of x. This is paired with the value of x as a string <x> and then - and + are used to select the fizzbuzz string if not empty, otherwise the number string from the pair. :- %say |= * :- %txt %+ turn (gulf 1 100) |= x=@ => "{?~((mod x 3) "Fizz" ~)}{?~((mod x 5) "Buzz" ~)}"^<x> ?~ - + -  1 Wren, 78 bytes It turns out that this is pretty hard to golf. for(i in 1..100)System.print(i%15==0?"FizzBuzz":i%5==0?"Buzz":i%3==0?"Fizz":i)  Try it online! 1 Scala, 65 64 Bytes 1.to(100).map(n=>{print(s"\nn"+(if(n%3==0)"fizz")+(if(n%5==0)"buzz"))})  I've just started golfing so any tips are appreciated (yes I have read this) Not exactly. You have to output n only for those which are neither “fizz” or “buzz”. – manatwork – 2019-12-11T18:36:00.443 @manatwork Okay good to know will fix – gregam3 – 2019-12-11T18:54:33.107 1 Symja, 140134 128 bytes For(i=1,i<101,i++,If(Mod(i,5)==0,s=s<>"Fizz");If(Mod(i,3)==0,s=s<>"Buzz");If(Mod(i,5)*Mod(i,3)!=0,s=s<>ToString(i));s=s<>"\n");s  Y'all can try it online here Just a standard fizzbuzz approach. This is tweetable BTW, so there's that too. 123 bytes (not sure how to save a link in that Symja compiler). What is golfed: both ==0 are <1; the !=0 is >0 and the For(i=1,i<101,i++, is For(i=0,++i<101,. PS: You may want to add a s=""; in your linked version, since I received an error because s was overflowing at first. – Kevin Cruijssen – 2020-03-24T16:34:00.150 1 Erlang (escript), 166 bytes i(A,B,C,D)->if A==B->C;1<2->D end. f(X)->i(X rem 3,0,"Fizz","")++i(X rem 5,0,"Buzz",""). z(0)->"";z(X)->z(X-1)++"~n"++i(f(X),"",integer_to_list(X),f(X)). z()->z(100).  Try it online! 1 Japt-R, 27 bytes Finally came up with a shorter way! Lõ@"FiBu"ò úz4 ËpXv°EÑÄÃ¬ªX  Test it Lõ@"FiBu"ò úz4 ËpXv°EÑÄÃ¬ªX L :100 õ :Range [1,L] @ :Map each X "FiBu" : Literal string ò : Partitions of length 2 úz4 : Right pad each with "z" to length 4 Ë : Map each element at 0-based index E p : Repeat Xv : Test X for divisibility by (result will be 1 or 0) °E : Prefix increment E Ñ : Multiply by 2 Ä : Add 1 Ã : End map ¬ : Join ªX : Logical OR with X :Implicit output, joined with newlines  1 05AB1E, 37 bytes т>GN3ÖUi"Fizz"?}N5ÖVi”ÒÖ”?}XY~_iN?}¶?  Try it online! т>GN3ÖUi"Fizz"?}N5ÖVi”ÒÖ”?}XY~_iN?}¶? # full program G # for N in [1, 2, ..., т # ..., 99... > # plus 1]... i # if... N # variable... Ö # is divisible by... 3 # literal... ? # then output without trailing newline... "Fizz" # literal } # end if i # if... N # variable... Ö # is divisible by... 5 # literal... ? # then output without trailing newline... ”ÒÖ” # "Buzz" } # end if i # if... U V XY # N is... _ # not... U V XY # divisible by... ~ # either... U X # 3... ~ # or... V Y # 5... ? # then output without trailing newline... N # variable } # end if ? # output without trailing newline... ¶ # newline # implicit end loop  Alternatively, you can replace ¶? with õ,: Try it online!  , # output with trailing newline... õ # empty string  1 FALSE, 86 bytes [\100*\/100@\/*-0=]m:1[100>~][0\3m;![\%1\"Fizz"]?5m;![\%1\"Buzz"]?\0=[.]?10,1+]#  Try it online! Explanation [\100*\/100@\/*-0=]m: Define Modulo Function [\100*\/ Divide number * 100 by the divisor to get decimals 100@/* Get truncated result -0= Subtract to get decimal, if equal to 0, then the modulo is zero and return true. If not, return false as we don't care about the result 1 Put counter on stack [100>~] Check if number is greater than 100 [0\3m;![\%1\"Fizz"]?5m;![\%1\"Buzz"]?\0=[.]?10,1+]# Do FizzBuzz if not [0\ Number to see if both % 3 and % 5 failed 3m;! Number % 3 [\%1\"Fizz"]? If yes, do what is in brackets [\%1\ Set number to 1 "Fizz"]? Print Fizz 5m;! Number % 5 [\%1\"Buzz"]? If yes, do what is in brackets [\%1\ Set number to 1 "Buzz"]? Print Buzz \0= Check if both modulo functions failed [.]? If yes, do what is in brackets [ Duplicate our counter so it doesn't get destroyed .]? Print the counter 10, Print ASCII character 10 (line break) 1+]# Increment counter  Could most likely be way better. 1 Canvas, 31 bytes Ａ２＾｛ｗ３％０≡Fizz×ｙ５％０≡Buzz×＋：？Ｏ］ｙＯ  Try it here! Okay seriously guys why is it that both ascii-art focused languages didn't already have a FizzBuzz? This uses my favourite FizzBuzz approach found in the Vyxal answer. 1 BRASCA, 81 bytes 1b1[x0aB:b3%0=[xzziFoooo1a0]xB:b5%0=[xzzuBoooo0A1+a]xA0=[xB:bn0]xB1+:bH1+<lo]  Try it online! There'll be an explanation coming soon. The tio link is the interpreter split over the header and footer in such a way that the program can be entered into the code box. 1 Javascript, 99 bytes This isn't a good, or small solution, but it works: for(let i=1;i<101;i++){console.log((i%3==0&&i%5==0)?"FizzBuzz":(i%3==0)?"Fizz":(i%5==0)?"Buzz":i);}  Explanation: for (let i=1;i<101;i++) // Loop through, until reaching 100 { console.log( (i%3==0 // If I is a multiple of 3 && // And i%5==0 // If I is a multiple of 5 )?"FizzBuzz": // Print "FizzBuzzz" (i%3==0)?"Fizz": // If I isn't either of those, check whether I is a multiple of 3, if so, print "Fizz" (i%5==0)?"Buzz" // If I isn't a multiple of 3, check whether I is a multiple of 5, if so, print "Buzz" :i // Else, just print i ); }  1 Mouse-83/Mouse-2002, 73 bytes 1F:(F.Z4*1+<^0A:F.3\0=["Fizz"1A:]F.5\0=["Buzz"A.1+A:]A.0=[F.!]"!"F.1+F:)  Try it online! Yet another fizzbuzz. Polyglots both versions listed and beats the current answer. The funny thing is that I came up with this independently of the other answer and managed to use the same approach. 1 Phooey, 53 bytes [100+1>&<@@%3{"Fizz">&1<}&%5{"Buzz">&1<}&>{<i>}" "<]  Try it online! Outgolfed the creator at his own language.  [100 while cell is not 100 +1 increment cell >&< set fizzed flag - empty stack is zero @@ push two copies to the stack %3 set cell to cell mod 3 { if cell is not zero "Fizz" print fizz >&1&lt set fizzed flag } endif & pop original value from stack %5{"Buzz">&1<} repeat for buzz & pop again >{ if fizzed flag is zero <i> print number } endif "\n" print newline < return to number cell ] end  I may make fun of the interpreter, but it is a pretty nice language. 1 Myddin, 157 bytes use std var p=std.put const main={ for var i=1;i<101;i++ match(i%3,i%5) |(0,0):p("FizzBuzz\n") |(0,_):p("Fizz\n") |(_,0):p("Buzz\n") |(_,_):p("{}\n",i) ;;;;}  1 ThumbGolf, 49 bytes Machine code (little endian pairs): 2100 3101 0008 dec0 d003 b908 a303 de03 004a de6a b922 a305 de03 e003 6946 7a7a b100 de21 de3a 2964 d1eb 4770 7542 7a7a 00  Commented assembly:  // Include the ThumbGolf wrapper macros .include "thumbgolf.inc" .globl main .thumb_func main: // Start the counter with zero and increment first. // It aligns better than incrementing at the bottom. movs r1, #0 .Lloop: adds r1, #1 .Lthree: // r0 = r1 % 3 movs r0, r1 umodi r0, 3 // udf #0300; .short 0xd003 // if r0 == 0 cbnz r0, .Lten // if so print "Fizz" adr r3, .Lfizz puts r3 // udf #0003 .Lten: // do the same for Buzz // r2 = (r1 * 2) % 10, a.k.a. r1 % 5 // we do this because umod.10 is a special narrow instruction :) lsls r2, r1, #1 umod.10 r2 // udf #0152 cbnz r2, .Lnum adr r3, .Lbuzz puts r3 // udf #0003 // jump to the newline b .Lnoprint // Normally, "Fizz" and "Buzz" are 5 byte strings due to the null // terminator, which SUCKS. This is because Thumb instructions MUST // be 2 byte aligned, and pool loads that are not 4 byte aligned are // annoying wide instructions. // // However, I have a trick up my sleeve. // // CBZ is encoded as so: // |15 14 13 12|11|10| 9| 8| 7 6 5 4 3 |2 1 0| // | 1 0 1 1| 0| 0| i| 1| imm5 | Rn | // Let's focus on bits 0-7, which, since ARM is little endian, appear // first. // // imm5 is the offset in opcodes relative to 4 bytes after the current // instruction (a.k.a. where the PC is for dumb reasons). Technically, // there is a 6th bit in bit 9, but that is only for larger offsets. // // .Lnoprint is exactly 4 bytes after the instruction, so the offset // is zero: // 0 0 0 0 0 r r r // Now, for the register argument, if we set it to r0... // 0 0 0 0 0 0 0 0 // Behold. A free null terminator. // // This is great, as it not only lets us cheat a byte in Fizz, but also, // it makes everything align perfectly so we don't need any wide adr // instructions. We can just put Buzz at the bottom of the file and it // will be 4 byte aligned as well. .Lfizz: .ascii "Fizz" // null terminated by cbz encoding .Lnum: // was r1 % 3 not zero (meaning did we not print Fizz?) cbz r0, .Lnoprint // if so, print r1 as an integer puti r1 // udf #0041 .Lnoprint: // putspc is a narrow instruction that prints one of 8 special characters, // one of which includes \n. putspc '\n' // udf #0072 // loop while r1 != 100 // replace with a register for variable length cmp r1, #100 bne .Lloop // return bx lr .Lbuzz: .asciz "Buzz"  My second submission in my brand new WIP ThumbGolf language, an ISA extension to Thumb-2. It shows off both the new I/O instructions and the modulo instructions (with the special narrow encoding for 10). That little hack by null terminating with cbz saves a lot, and it was really fun to figure out. As mentioned in my cat program, this can be run on ARM Linux or QEMU by linking the ThumbGolf runtime. I don't have an online interpreter yet (and I doubt I could afford hosting one lul) Actually, you should have based it on x86 machine code... So is ThumbGolf a RISC or a CISC? – None – 2021-02-05T08:05:54.590 ThumbGolf is what I envision to be a "RISC golfing language". I am sticking to this limitation, even if it isn't gonna win any contests. – EasyasPi – 2021-02-05T11:19:01.707 As I personally find golfing languages that let you answer a complex challenge in one byte ruin the whole point of golfing. ‍♂️ – EasyasPi – 2021-02-05T11:26:32.247 1 JavaScript: 76 bytes for(i=1;i<101;i++)console.log(i%3<1?'fizz'+(i%5<1?'buzz':''):i%5<1?'buzz':i)  Not the best solution we have, but not the worst either... The "nested" ternary operator adds either buzz or nothing to the fizz part depending on the results of the divisibility test. 1 ///, 235 bytes /(/\/\///%/111()/\\\\(p/1\/(x/%%%1(t/xxxxxxxxxx(>p^=)=^!)=)vvt&@ ^^!)=^=)=^^v)v^|^^v)v1^v)av^^v)av^v)v^>(^/\(/>(>t/%&/&%(1&/1(%11@/@%11(1@/1(&p&(@p@(&/Fizz(@/Buzz(|p001(|(/0x/1\0(0p_1(0_/_(1p2(22/4(42/6(44/8(2p3(4p5(6p7(8p9(_(/=\=(==  Try it online! There is already a /// answer, but it is pretty boring. I thought I would try to make a more algorithmic one, even though it is a little longer ;) Ungolfed: Try it online! 1 Frink, 131 bytes This is still to be golfed, but because the docs are bare bones, it will be golfed through experimentation for x=1 to 100 { if x%15==0 { println["FizzBuzz"] } else { if x%3==0 { println["Fizz"] } else { if x%5==0 { println["Buzz"] } else { println[x] } } } }  By my reading of the linked page only the for loop's braces are necessary. – Neil – 2015-09-29T14:56:49.843 @Neil Then you'd need then which would increase the byte count – Beta Decay – 2015-09-29T16:01:46.453 No, that's only if you want the controlled statement on the same line. – Neil – 2015-09-29T16:13:30.333 I might have misread so you might still need the braces on the outer else clauses too. – Neil – 2015-09-29T16:36:06.743 1 MATLAB, 172 bytes s=char(arrayfun(@(n){num2str(n)},[1:100 1e7])');s(3:3:end,1:4)=repmat('Fizz',33,1);s(5:5:100,1:4)=repmat('Buzz',20,1);s(15:15:100,:)=repmat('FizzBuzz',6,1);disp(s(1:100,:))  1@TaylorScott Thanks for the edit – Luis Mendo – 2017-08-20T18:31:49.923 1 Hassium, 160 Bytes Here's it in Hassium. Surprised there's never been a FizzBuzz challenge before. There's also some lengthier (but more interesting) FizzBuzz examples here func main(){foreach(x in range(1,100)){if(x%15==0){println("fizzbuzz");}else if(x%3==0){println("fizz");}else if(x%5==0){println("buzz");}else println(x);}}  Run online and see expanded version here @FryAmTheEggman Duly noted and added. Thanks. – Jacob Misirian – 2015-09-25T02:19:27.390 3> • The capitalization of Fizz and Buzz is wrong. 2. <1 is shorter than ==0. 3. All curly braces ({}) can be eliminated. • < – Dennis – 2015-09-25T05:29:26.817 1 JavaScript, 7371 65 bytes for(i=1;i<101;i++)console.log((i%3?"":"Fizz")+(i%5?"":"Buzz")||i)  This was my first answer, what was the problem with the format? – Diego Torres – 2015-09-25T13:57:41.603 Generally, language and size headers should be a header. Also, your current code doesn't seem to work, but you can fix it by replacing console.info with writeln (I tested it here and it worked.) – ASCIIThenANSI – 2015-09-25T13:59:13.563 Do I need to specify the size or only the language? writeln is not valid in JavaScript, console.info is like console.log; both are valid. – Diego Torres – 2015-09-25T14:08:16.147 Ah, OK, didn't realize that about writeln. You have to specify both the language and the size, on the same line. Also, I would reccommend using console.log if possible, that'll save you an extra byte. – ASCIIThenANSI – 2015-09-25T14:13:20.060 Also, welcome to PPCG! – AdmBorkBork – 2015-09-25T14:13:56.660 Thanks, Do you have a tool for calculating the size? – Diego Torres – 2015-09-25T14:17:15.083 We usually use this. – LegionMammal978 – 2015-09-25T14:36:46.383 1 Groovy, 71 bytes (1..100).each{i->println i%15<1?'FizzBuzz':i%5<1?'Buzz':i%3<1?'Fizz':i}  1 Swift, 77 bytes for i in 1...100{print(i%15<1 ?"FizzBuzz":i%3<1 ?"Fizz":i%5<1 ?"Buzz":"\(i)")}  @RichardG.Nielsen It's considered poor etiquette to edit some else's golfed code. Suggesting it in a comment is fine, or you could post your own answer since you came up with it independently. – feersum – 2015-10-27T11:43:05.923 1 zsh, 65 63 bytes repeat 100 x=|let ++i%3||x=Fizz&&let i%5||x+=Buzz&&<<<{x:-i}  Changed echo to <<<. It's now 2 bytes shorter, because <<< doesn't need a space. repeat 100 x=|let ++i%3||x=Fizz&&let i%5||x+=Buzz&&echo {x:-i}  1 STATA, 115 bytes qui{ set ob 100 g a="Fizz" if!mod(_n,3) g b="Buzz" if!mod(_n,5) g c=a+b replace c=string(_n) if c=="" } l c,noo noh  qui{} suppresses output for everything in that block. First set the number of observations to be 100. Then generate variable a to be "Fizz" for every observation where its index number is divisible by 3. Then generate variable b to be "Buzz" for every observation where its index number is divisible by 5. Generate variable c to be the concatenation of these two. Then, replace c with the index number (STATA uses 1 indexing) if it is still an empty string. Then list the results of c in a table without observation numbers or headers. Only works in the "real" STATA interpreter. I need to add functions and conditions to the online interpreter for it to work there. A different solution in 116 bytes: forv x=1/100{ if!mod(x',3){ di"Fizz"_c if!mod(x',5) di"Buzz"_c } else if!mod(x',5) di"Buzz"_c else di x' _c di }  This solution goes through a for loop and checks whether the loop variable is divisible by 3 or not. If it is, it prints "Fizz". Then it checks if it is divisible by 5 and prints "Buzz". Otherwise, it checks if it is divisible by 5 and prints "Buzz". If not, it prints the loop variable. 1 UniBasic, 106 bytes FOR I=1 TO 100;D='';IF MOD(I,3)=0 THEN D='Fizz' IF MOD(I,5)=0 THEN D:='Buzz' IF D='' THEN D=I CRT D;NEXT I  1 Windows Batch, 172 @setlocal enableDelayedExpansion&for /l %%N in (1 1 100) do @(set v=&set/a1/(%%N%%3^)||set v=Fizz&set/a1/(%%N%%5^)||set v=!v!Buzz&if defined v (echo !v!)else echo %%N)2>nul  1 OCaml, 106 for i=1to 100do let(!)n=i mod n<1and p=Printf.printf in!3&p"Fizz"=();!5&p"Buzz"=()or!3||p"%d"i=();p" "done  Apparently this isn't a very good attempt as the shortest one on anarchy golf is only 97. 1 Scala, 90 bytes for(i<-1 to 100)println{var s="";if(i%3==0)s="Fizz";if(i%5==0)s+="Buzz";if(s=="")i else s}  1 Dart, 88 main({i:0}){while(i<100)print(["FizzBuzz","Fizz","Buzz",++i][(i%3).sign*2+(i%5).sign]);}  Dart is somewhat hampered in the golfing by not having conversion between bool and int, but the sign getter on integers helps a little. 1 Groovy, 83 80 bytes (1..100).each{def f=it%3,b=it%5;println!f&&!b?'FizzBuzz':!f?'Fizz':!b?'Buzz':it}  1 Rust, 145137 131 bytes Golfed fn main(){for i in 1..101{let s=i.to_string();println!("{}",match i%15{0=>"FizzBuzz",3|6|9|12=>"Fizz",5|10=>"Buzz",_=>&(s)[..]});}}  Ungolfed fn main() { for i in 1..101 { let s = i.to_string(); println!("{}", match i % 15 { 0 => "FizzBuzz", 3|6|9|12 => "Fizz", 5|10 => "Buzz", _ => &(s)[..] }); } }  Uses the current stable version of Rust (1.5.0). You can remove a semicolon after println! call, as println! returns (). Also, it's possible to replace &(s)[..] with &s. – Konrad Borowski – 2018-07-06T07:53:21.490 1 Racket, 125 122 bytes (for([x(range 1 101)])(define(m n)(=(modulo x n)0))(displayln(cond[(and(m 3)(m 5))'FizzBuzz][(m 3)'Fizz][(m 5)'Buzz][x])))  Simplest approach, took some work to get it lower than 130 bytes. Inspired by the Java example. Pretty-printed code (for ([x (range 1 101)]) (define (m n) (= (modulo x n) 0)) (displayln (cond [(and (m 3) (m 5)) 'FizzBuzz] [(m 3) 'Fizz] [(m 5) 'Buzz] [x])))  1 TCL, 208 bytes Golfed: set i 1;while {i<101} {set p "";if {[expr i % 3]==0} {set p [concat p {fizz}]};if {[expr i % 5]==0} {set p [concat p {buzz}]};if {[expr i % 3]>0&&[expr i % 5]>0} {set p [concat p i]};puts p;incr i;}  Ungolfed: set i 1 while {i<101} { set p "" if {[expr i % 3]==0} {set p [concat p {fizz}]} if {[expr i % 5]==0} {set p [concat p {buzz}]} if {[expr i % 3]>0 && [expr i % 5]>0} {set p [concat p i]} puts p incr i }  1 Python 2, 91 1;exec"print'FizzBuzz'if _%3==_%5==0else'Fizz'if _%3==0else'Buzz'if _%5==0else _;_+=1;"*100  1 Kotlin, 145 bytes fun main(a:Array<String>){IntRange(1,100).forEach{val f=it%3==0;val b=it%5==0;var x="";if(f)x+="Fizz";if(b)x+="Buzz";if(!f&&!b)x+=it;println(x)}}  Try it online! 1 Kotlin, 119 115 bytes fun main(a:Array<String>){for(i in 1..100)println(if(i%3<1)"Fizz" else ""+if(i%5<1)"Buzz" else if(i%3<1)"" else i)}  Try it Online! Could you trim any more of the whitespace (e.g. in if(i % 5 < 1))? – ETHproductions – 2016-03-10T19:43:55.563 :O I completely missed that there – The_Lone_Devil – 2016-03-10T19:46:09.750 You need whitespace between a keyword and a literal, so I think that is all the whitespace that can be trimmed now – The_Lone_Devil – 2016-03-10T19:50:02.347 Actually,it doesn't work for 15 and multiples: it only prints Fizz – Damiano – 2017-12-20T18:13:48.953 Parenthesis around the first if/else can fix this in 117 bytes: fun main(a:Array<String>){for(i in 1..100)println((if(i%3<1)"Fizz" else "")+if(i%5<1)"Buzz" else if(i%3<1)"" else i)} – Damiano – 2017-12-20T18:28:12.193 1 Python 91 Bytes for n in range(100): c="" if n%3==0:c+="fizz" if n%5==0:c+="buzz" if c=="":c=n print c  1 Ruby, 72 bytes (1..100).each{|n|puts "#{n%3==0?'Fizz':''}#{n%5==0?'Buzz':n%3!=0?n:''}"}  Explanation For each number from 1 to 100, print 'Fizz' if the number mod 3 is 0, then if the number mod 5 is 0, print 'Buzz' else if the number mod 3 is 0, print the number. Hello, and welcome to PPCG! Great first post! – NoOneIsHere – 2016-06-03T14:58:35.770 1 Groovy, 61 bytes 100.times{a=++it%3?"":"fizz" a+=it%5?"":"buzz" println a?:it}  0 DUP, 76 bytes [3/%$[]['F,'i,'z,'z,]?\5/%$[]['B,'u,'z,'z,]?*[$.][]?10,]c:0[$100<][1+c;!]#

Explanation of program flow, code blocks:

DUP has two default truth values: -1 (true, all bits set) and 0 (false, no bits set). For conditional evaluations every nonzero value is accepted as true, comparisons themselves lead to either -1 or 0.

DUP has two conditional expressions, if-then-else and a while loop:

[execute if not false][execute if false]?. E.g. 1['t,]['f,]? prints t to STDOUT, because 1 is not false.

[condition][execute while not false]#. E.g. 5[$0>][$.1-]# prints the numbers 5,4,3,2,1 to STDOUT. The condition block tests the top stack value if it’s greater than 0, the execute block prints the number and decrements it.

The condition that’s checked is always the topmost stack element, which gets popped off the stack during the check.

[
$$3/% {dup,dup,push 3, moddiv, pop, dup} [] {if condition true do nothing} ['F,'i,'z,'z,]? {if condition false print Fizz} \5/% {swap, push 5, moddiv, pop, dup} [] {if condition true do nothing} ['B,'u,'z,'z,]? {if condition false print Buzz} * {mul} [.] {if condition true dup, print to STDOUT} []? {if condition false do nothing} 10, {push 10, print char to STDOUT (newline)} ]c: {define function c} 0 {push 0} [100<] {while dup < push 100 true} [1+c;!]# {do push 1, add, execute function c}  Step by step: instruction stack 0 0 [  0,0 100 0,0,100 < 0,-1 ] 0 [ 1 0,1 + 1 increment counter c; 1,0 0=start address of function c ! execute c [$$3                     1,1,1,3
/                       1,1,1,0         mod,div operator (n mod 3, n div 3)
%                       1,1,1           /% → mod
$1,1,1,1 result of n%3 used as flag for later check [] 1,1,1 condition true→do nothing ['F,'i,'z,'z,]? skipped \ 1,1,1 swap top and 2nd stack elements 5 1,1,1,5 / 1,1,1,0 mod,div operator % 1,1,1 /% → mod$                       1,1,1,1         n%5 flag
[]                      1,1,1           condition true → do nothing
['B,'u,'z,'z,]?                         skipped
*                       1,1             multiply %3 and %5 flags, result is only >0
if neither %3 nor %5 are 0.
[                       1               if condition (flag)>0
$1,1 dup .] 1 print number to STDOUT: '1' []? skipped back to while loop [$                       1,1
100                     1,1,100
<                       1,-1
]                       1
[
1                       1,1
+                       2               increment counter
c;                      2,0             0=start address of function c
!                       execute c

...


A full description of all operators and program flow can be found at my GitHub repository, together wtih my Julia interpreter of DUP.

An online Javascript implementation showing useful debug information can be found here.

A rather terse introduction can be found on the esolangs.org DUP page.

0

S.I.L.O.S, 141 bytes

lbla
a+1
c=1-(a%3)*(a%5)
if c b
printIntNoLine a
lblb
c=(a%3)
if c d
print Fizz
lbld
c=(a%5)
if c c
print Buzz
lblc
printLine
b=100-a
if b a


Try it online!

Unfortunately SILOS is incredibly verbose, and an interpreter bug cost me a few extra bytes, but I think SILOS is "superior" only to scratch in this challenge.

0

///, 209 208 bytes

/I/
EFizz
//H/FizzE//G/
Fizz
//E/Buzz
/1
2G4I7
8GE11G13
14
H16
17G19I22
23GE26G28
29
H31
32G34I37
38GE41G43
44
H46
47G49I52
53GE56G58
59
H61
62G64I67
68GE71G73
74
H76
77G79I82
83GE86G88
89
H91
92G94I97
98GBuA


is it just me or is some of this redundant? there isn't much point in shortening Buzz to BuC if the bytes saved by that in general are less than the bytes added – Destructible Lemon – 2017-05-15T04:34:35.063

0

Fourier, 81 bytes

|Fizz|F|Buzz|B1~i100(i~X%15{0}{1~XFB}X%5{0}{1~XB}X%3{0}{1~XF}X{i}{Xo}10ai^~i)


Try it on FourIDE

Who knew such a simple task would yield such a mammoth of a program!

Pseudocode of the program:

Function F {
Print "Fizz"
}

Function B {
Print "Buzz"
}

i = 1
While i != 100
X = i
If X % 15 == 0
X = 1
Function F
Function B
End if
If X % 5 == 0
X = 1
Function B
End If
If X % 3 == 0
X = 1
Function F
End If
If X == i
Print X
End if
Print "\n"
i += 1
End while


you say function a in the ungolfed, do you mean function F? – Destructible Lemon – 2017-05-15T23:39:43.520

also I don't think you get to call it mammoth if it fits on screen in one line, and the challenge actually isn't that simple – Destructible Lemon – 2017-05-15T23:40:45.767

0

Micro, 72 bytes

:i{i1+:i"":d
i3/i3%=if("Fizz":d,)
i5/i5%=if(d"Buzz"+:d,)
d:\i100=if(,a)}


0

Python 2, 106 bytes

for n in range(1,101):
a="Fizz"*int(n%3==0)+"Buzz"*int(n%5==0)
if a=="": print n
else: print a


Try it online!

0

Jq 1.5, 90 bytes

def f:if.%15<1then"FizzBuzz"elif.%5<1then"Buzz"elif.%3<1then"Fizz"else. end;range(100)+1|f


Try it online!

0

Modula-2, 222 bytes

MODULE F;IMPORT InOut;VAR i:INTEGER;BEGIN
FOR i:=1 TO 100 DO
CASE i*i*i*i MOD 15 OF
0:InOut.WriteString("FizzBuzz")|1:InOut.WriteInt(i,0)|6:InOut.WriteString("Fizz")|10:InOut.WriteString("Buzz")END;InOut.WriteLn
END END F.


Tested with Amsterdam Compiler Kit. The program needs 4-byte INTEGER. If using 2-byte INTEGER, i*i*i*i overflows and the program fails with a case error.

With indentation:

MODULE F;
IMPORT InOut;
VAR i: INTEGER;
BEGIN
FOR i := 1 TO 100 DO
CASE i * i * i * i MOD 15 OF
0: InOut.WriteString("FizzBuzz")
| 1: InOut.WriteInt(i, 0)
| 6: InOut.WriteString("Fizz")
| 10: InOut.WriteString("Buzz")
END;
InOut.WriteLn
END
END F.


ACK compiles the PIM3 dialect of Modula-2 and comes with an InOut module. Other compilers for Modula-2 or Oberon might have shorter syntax or come with shorter modules.

• I don't like having 3 calls to InOut.WriteString, but adding a PROCEDURE p(s:ARRAY OF CHAR);BEGIN InOut.WriteString(s)END p; would cost 61 bytes and save only 48 bytes in the calls.

• I would write FOR i:=1TO 100DO but ACK rejects it as a syntax error.

• I had used i*i*i*i MOD 15 in my AppleScript answer.

0

Clean, 148 + 2 = 150 bytes

+2 for the -b compiler flag

module m
import StdEnv
f[0,0,_]="FizzBuzz"
f[a,b,n]|a==0="Fizz"|b==0="Buzz"=fromInt n
Start=flatlines[fromString(f[n rem 3,n rem 5,n])\\n<-[1..100]]


Try it online!

0

MY-BASIC, 116 bytes

A response.

For i=1 To 100
S=""
If i Mod 3=0 Then S="Fizz"
If i Mod 5=0 Then S=S+"Buzz"
If S="" Then Print i; Else Print S;
Next


Try it online!

0

procedure GNAT.IO.F is begin for I in Integer range 1..100 loop Put((if I mod 3=0 then"Fizz"else"")&(if I mod 5=0 then"Buzz"else""));if I mod 3*I mod 5/=0 then Put(I);end if;New_Line;end loop;end;


Try it online!

189 bytes if extraneous whitespace is allowed:

procedure GNAT.IO.F is begin for I in Integer range 1..100 loop Put(if I mod 3=0 then(if I mod 5=0 then"FizzBuzz"else"Fizz")else(if I mod 5=0 then"Buzz"else I'Image));New_Line;end loop;end;


Try it online!

0

Scala, 103 94 bytes

for{i<-1 to 100;s=(if(i%3==0)"Fizz"else"")+(if(i%5==0)"Buzz"else"")}println(if(s=="")i else s)


thx @Ben (shortened by 9 bytes)

You can save 9 bytes by using a for comprehension: for{i<-1 to 100;s=(if(i%3==0)"Fizz"else"")+(if(i%5==0)"Buzz"else"")}println(if(s=="")i else s) – Ben – 2015-10-02T20:57:26.963

0

Python 2, 72 bytes

for x in range(100):print('Fizz'*(x%3>1)+'Buzz'*(x%5>3)or str(x+1))+'\n'


Not as clever as feersum's solution, but it avoids casting exec magic.

EDIT: with just two more parentheses, it works in Python 3 AND Python 2:

for x in range(100):print(('Fizz'*(x%3>1)+'Buzz'*(x%5>3)or str(x+1))+'\n')


0

APL, 56 50 bytes

⊣{1+⍵⊣⎕←∊2↑((0=3 5|⍵)/'Fizz' 'Buzz'),''(⍕⍵)}⍣100⊢1


Note: The very first ⊣ should suppress output in GNU APL. Replace it with → to get correct results in Dyalog, etc, or with portable assignment to some variable X← adding one byte.

A+, 51 bytes

(x←100)do↓⊃2↑((0=3 5|1+x)/4⊂'FizzBuzz'),⌽2↑<1↓⍕1+x;


These seem quite different, so why not put them in different answers? – Martin Ender – 2015-11-09T07:47:41.107

While I wouldn't call A+ a “trivial variant,” it's a direct derivative of APL and I think any solution in one would translate to similar byte count in another. Also, I just updated it making the answers work exactly the same way. – user46915 – 2015-11-09T09:22:57.543

0

ShapeScript, 57 bytes

0'1+0?3%1<"Fizz"*1?5%1<"Buzz"*+"#0?"1?_1<*!@"
"@'554***!#


Try it online!

How it works

0          Push 0 (accumulator).
'          Push a string that, when evaluated, does the following:
1+         Increment the accumulator.
0?         Push a copy.
3%1<       Check if the remainder of its division by 3 is zero.
"Fizz"*    Push "Fizz" for True, "" for False.
1?         Push another copy of the accumulator.
5%1<       Check if the remainder of its division by 5 is zero.
"Buzz"*    Push "Buzz" for True, "" for False.
+          Concatenate the potential fizzes and buzzes.
"          Push a string that, when evaluated, does the following:
#          Discard the topmost stack item.
0?         Push a copy of the item below it (accumulator).
"
1?         Push a copy of the concatenation.
_1<        Check if its length is zero.
*!         Execute "#0?" once for True, zero times for False.
@          Swap the generated output with the accumulator.
"          Push "\n".
"
@          Swap it with the accumulator.
'
554**      Push 5 * 5 * 4 = 100.
*!         Execute the '...' string 100 times.


0

Javascript ES6, 77 chars

"\n".repeat(100).replace(/(?=\n)/g,(m,i)=>(++i%3?m:"Fizz")+(i%5?m:"Buzz")||i)


Test:

"\n".repeat(100).replace(/(?=\n)/g,(m,i)=>(++i%3?m:"Fizz")+(i%5?m:"Buzz")||i) == document.querySelector("pre").textContent


Here's my ES6 attempt, with parts stolen from yours (89 chars): "0".repeat(99).split(0).map((m,i)=>{return(++i%3?m:"Fizz")+(i%5?m:"Buzz")||i}).join("\n") – starbeamrainbowlabs – 2016-01-07T06:48:12.667

@starbeamrainbowlabs, why do you use {return ...} instead of expression? – Qwertiy – 2016-01-07T10:21:27.753

Because I couldn't get the expression to work :( – starbeamrainbowlabs – 2016-01-07T16:20:27.957

Save a byte by using template strings + literal newline at front. – Mama Fun Roll – 2016-01-29T00:34:46.103

0

Elixir, 182 bytes

import Stream
f=fn(n)->(zip(cycle(["","","fizz"]),cycle(["","","","","buzz"]))|>zip(iterate(1,&(&1 + 1)))|>map(fn{{"",""},n}->n
{{p,o},_}->p<>o end))|>take(n)|>Enum.each(&IO.puts/1)end


LiveDemo

Calling: f.(100)

0

///, 229 bytes

/x/Buzz//b/
x//f/
Fizz/1
2f
4bf
7
8fb
11f
13
14fx
16
17f
19bf
22
23fb
26f
28
29fx
31
32f
34bf
37
38fb
41f
43
44fx
46
47f
49bf
52
53fb
56f
58
59fi
61
62f
64bf
67
68fb
71f
73
74fx
76
77f
79bf
82
83fb
86f
88
89fx
91
92f
94bf
97
98fb


Out-golfed – Esolanging Fruit – 2017-05-15T02:58:06.367

@Challenger5 Well done. – Leaky Nun – 2017-05-15T02:59:22.870

@LeakyNum I have A CJam script that finds common substrings in the input. It's useful for /// golfing.

– Esolanging Fruit – 2017-05-15T05:55:32.637

0

JavaScript (using external library) (90 bytes)

x=>_.Range(1,100).Select(x=>x%3==0?(x%5==0?"FizzBuzz":"Fizz"):x%5==0?"Buzz":x).WriteLine()
`