TransWikia.com

1, 2, Fizz, 4, Buzz

Code Golf Asked on December 10, 2021

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 rn). 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=/<hd>s*([^n,<]*(?:<(?:[^n>]*>[^n<]*</[^n>]*>)[^n,<]*)*),.*?(d+)(?=[^nd<>]*(?:<(?:s>[^n<>]*</s>|[^n<>]+>)[^nd<>]*)*</hd>)/;var OVERRIDE_REG=/^Overrides*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>

358 Answers

jq, 78 bytes

range(1;101)|. as $n|[(select(.%3==0)|"Fizz"),(select(.%5==0)|"Buzz")]|add//$n

Answered by customcommander on December 10, 2021

HTML & CSS, 502 bytes

body{counter-reset:n}
p::after{counter-increment:n;content:counter(n)}
p:nth-child(3n)::after{content:"Fizz"}
p:nth-child(5n)::after{content:"Buzz"}
p:nth-child(15n)::after{content:"FizzBuzz"}
<p><p><p><p><p><p><p><p><p><p>
<p><p><p><p><p><p><p><p><p><p>
<p><p><p><p><p><p><p><p><p><p>
<p><p><p><p><p><p><p><p><p><p>
<p><p><p><p><p><p><p><p><p><p>
<p><p><p><p><p><p><p><p><p><p>
<p><p><p><p><p><p><p><p><p><p>
<p><p><p><p><p><p><p><p><p><p>
<p><p><p><p><p><p><p><p><p><p>
<p><p><p><p><p><p><p><p><p><p>

Answered by customcommander on December 10, 2021

RickRoll-Lang, 185 bytes

takemetourheart
give a up [*range(1,101)[::-1]]
togetherforeverandnevertopart
give i up a.pop()
give s up "Fizz"*(i%3<1)+"Buzz"*(i%5<1)
ijustwannatelluhowimfeeling [str(i),s][s>""]+"n"

Explanation:

RickRoll-Lang keywords do not need spaces between them

takemetourheart                                   -- main() function declaration
give a up [*range(1,101)[::-1]]                   -- set a to reverse of int range [1, 101)
togetherforeverandnevertopart                     -- infinite loop
give i up a.pop()                                 -- pop last element of a and store in i
give s up "Fizz"*(i%3<1)+"Buzz"*(i%5<1)           -- string multiplcation to form fizzbuzz depending on modulus remainders
ijustwannatelluhowimfeeling [str(i),s][s>""]+"n" -- print i if s is empty else s and a newline
                                                  -- implicit "say goodbye" (end block) at the end
                                                  -- another say goodbye

Try it online!

Answered by Hydrazer on December 10, 2021

Pure Bash, 70 bytes 69 bytes 68 bytes 63 + 1 = 64 bytes

The following program must be saved as x, which is for 1 byte of penalty.

''
((++x%3))||Fizz
((x%5))||$_Buzz
echo ${_:-$x}
((x>99))||. x

Try it online!

Answered by nrgmsbki4spot1 on December 10, 2021

aussie++, 223 190 187 bytes

G'DAY MATE!
I RECKON x IS A WALKABOUT FROM[1TO 100]<YA RECKON x %15<1?<GIMME "FizzBuzz";>WHATABOUT x %5<1?<GIMME "Buzz";>WHATABOUT x %3<1?<GIMME "Fizz";>WHATABOUT ?<GIMME x;>>CHEERS C***!

Fair dinkum, this was hard yakka cause there's no way to golf the whitespace because the parser seems to be strict. I coulda sworn it never worked when I tried to remove whitespace.

-33 thanks to @Bubbler

-3 thanks to @JoKing

Wanna hear what it actually sounds like? Wonder no more: https://youtu.be/ewu1CmjZcmQ

Answered by lyxal on December 10, 2021

XML + XSLT, 1282 635 bytes

output.xml

<?xml-stylesheet type="text/xsl" href="s.xsl"?><n></n>

s.xsl

<x:stylesheet version="1.0" xmlns:x="http://www.w3.org/1999/XSL/Transform"><x:output method="text" /><x:template match="n"><x:text>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
</x:text></x:template></x:stylesheet>

Hardcoding it is shorter than doing it the fun way :(

So here's the old way for posterity

1282 bytes

output.xml

<?xml-stylesheet type="text/xsl" href="s.xsl"?><n><N>1</N><N>2</N><N>3</N><N>4</N><N>5</N><N>6</N><N>7</N><N>8</N><N>9</N><N>10</N><N>11</N><N>12</N><N>13</N><N>14</N><N>15</N><N>16</N><N>17</N><N>18</N><N>19</N><N>20</N><N>21</N><N>22</N><N>23</N><N>24</N><N>25</N><N>26</N><N>27</N><N>28</N><N>29</N><N>30</N><N>31</N><N>32</N><N>33</N><N>34</N><N>35</N><N>36</N><N>37</N><N>38</N><N>39</N><N>40</N><N>41</N><N>42</N><N>43</N><N>44</N><N>45</N><N>46</N><N>47</N><N>48</N><N>49</N><N>50</N><N>51</N><N>52</N><N>53</N><N>54</N><N>55</N><N>56</N><N>57</N><N>58</N><N>59</N><N>60</N><N>61</N><N>62</N><N>63</N><N>64</N><N>65</N><N>66</N><N>67</N><N>68</N><N>69</N><N>70</N><N>71</N><N>72</N><N>73</N><N>74</N><N>75</N><N>76</N><N>77</N><N>78</N><N>79</N><N>80</N><N>81</N><N>82</N><N>83</N><N>84</N><N>85</N><N>86</N><N>87</N><N>88</N><N>89</N><N>90</N><N>91</N><N>92</N><N>93</N><N>94</N><N>95</N><N>96</N><N>97</N><N>98</N><N>99</N><N>100</N></n>

s.xsl

<x:stylesheet version="1.0" xmlns:x="http://www.w3.org/1999/XSL/Transform"><x:output method="text" /><x:template match="n"><x:for-each select="N"><x:if test=".mod 3=0">Fizz</x:if><x:if test=".mod 5=0">Buzz</x:if><x:if test=".mod 3*.mod 5!=0"><x:value-of select="."/></x:if><x:text>&#10;</x:text></x:for-each></x:template></x:stylesheet>

W...why did I do this to myself?

Example output (using Firefox + privacy.file_unique_origin = false):

enter image description here

Explaination

The XML

XSLT/XML doesn't (afaik) have a nice easy way of generating ranges...so I have to manually place all the numbers in tags so I can use for-each later on.

The XSLT

<x:stylesheet version="1.0"
    xmlns:x="http://www.w3.org/1999/XSL/Transform"> <!-- Define the XSL namespace to be "X" for brevity -->
    <x:output method="text" /> <!-- Textual output -->
    <x:template match="n"> <!-- Match the root tag n -->
        <x:for-each select="N"> <!-- For each N, which is a number in the range 1...100 -->
            <x:if test=".mod 3=0">Fizz</x:if> <!-- If N % 3 == 0, write "Fizz" -->
            <x:if test=".mod 5=0">Buzz</x:if> <!-- If N % 5 == 0, write "Buzz" -->
            <x:if test=".mod 3*.mod 5!=0"> <!-- If N isn't divisible by either 3 or 5, write the number -->
                <x:value-of select="."/>
            </x:if>
            <x:text>&#10;</x:text> <!-- Add a newline -->
        </x:for-each>
    </x:template>
</x:stylesheet>

Answered by lyxal on December 10, 2021

Dash and utils, 89 bytes

f(){ [ $((i%$1)) = 0 ]&&j=$2zz$j;};for i in `seq 100`;do(f 5 Bu;f 3 Fi;echo ${j-$i});done

Try it online!

As a bonus this is partially obfuscated, containing neither Fizz nor Buzz (even saved 2 bytes in doing so).

88 bytes (with caveats)

f(){(: $((0/(i%$1))))||j=$2zz$j;};for i in `seq 100`;do(f 5 Bu;f 3 Fi;echo ${j-$i});done

Try it online!

This solution was an attempt to reduce the bytes used by the conditional. In the end it saved only 1 byte, but it spams STDERR, which actually looks OK on TIO because it separates the streams. Even so I’m not sure it’s a proper solution due to the spam, but honestly I’m quite proud of the trickery involved. We could suppress the errors with a redirect but that eats up precious bytes :)

EDIT: the trickery probably bears an explanation as the mechanism may not be immediately obvious.

Most of this explanation applies to the 89 byte, the only change is the conditional.

f(){

Define function f, easy enough.

(: $((0/(i%$1))))

This is the (most) sneaky bit

( begin a subshell, use : 'true' to perform some maths $(( in which we take 0 and divide / by the result of (i%$1), end the maths )) and end the subshell ).

This whole construct returns exit code 0 when the result of i % $1 is non-zero, otherwise it returns 1.

This works because when the i % $1 operation results in a zero we get a "division by zero" error terminating the subshell and causing it to return exit code 1.

This trumps the : "true" that the maths is running behind.

In all other instances we are taking zero and dividing it by a non-zero i % $1 result, which is obviously always zero by definition but the key thing is that it doesn't error the shell (thus the : stands) and from this we can catch the "division by zero" without the whole script bombing out.

||j=$2zz$j;};

Catch the error from the subshell via || and set j= to the value of $2 appending zz (to complete our Fizzes and Buzzes) and prepending the whole thing to $j (the prepend action stems from an earlier iteration and only remains so because there's no advantage in making it an append. Even more so now I've done this explanation), then just finish up the function ;};.

NB j lives and dies inside another subshell which calls this function, and is assumed to always start empty (but we'll get to that later).

for i in `seq 100`;do

As it appears, for loop through 1-100.

(f 5 Bu;f 3 Fi;echo ${j-$i})

The second (very mildly) sneaky part -- we start a subshell ( and for every number in the sequence, we call f twice. Once each for the FizzBuzz numbers 5, 3 (to be used in the i % $1 statement) and the corresponding two prefix letters which get used in making j. We then print the value of j or, if it's empty, insert the current $i value.

When we close the subshell, j gets reset to its starting value (empty, assuming we started in a clean room).

;done

Yes, I do believe we are.

Answered by bxm on December 10, 2021

Rockstar, 138 135 133 bytes

F takes I&S
let M be N/I
turn up M
if N-I*M
S's""

return S

N's0
while N-100
let N be+1
say F taking 3,"Fizz"+F taking 5,"Buzz" or N

Try it here (Code will need to be pasted in)

Answered by Shaggy on December 10, 2021

Quipu, 101 bytes

1&0&'F0&'B1&n
++[]'i[]'u[]/
1%3&'z5&'z6&0&
1&%%'z%%'z==??
%%3&/5&/&
1&>>  >>6&[]
>>      ??/
::

Try it online!

Ungolfed:

" 0  1  2  3  4  5  6
---------------------"
 1& 0& 'F 0& 'B 1& n
 ++ [] 'i [] 'u [] /
 1% 3& 'z 5& 'z 6& 0&
 1& %% 'z %% 'z == ??
 %% 3& / 5& / 0&
 1& >>    >> 6& []
 >>          ?? /
 ::

Thread 0 increments the accumulator (acc) every iteration, stopping execution if acc == 101, then jumps to thread 1.

Thread 1 checks if (acc % 3) > 0. If so, it jumps to thread 3, otherwise it jumps to thread 2.

Thread 2 prints Fizz, then jumps to thread 3.

Thread 3 checks if (acc % 5) > 0. If so, it jumps to thread 5, otherwise it jumps to thread 4.

Thread 4 prints Buzz, then jumps to thread 6.

Thread 5 looks back to thread 1 to see if (acc % 3) == 0. If so, it jumps to thread 6, otherwise it prints acc, then jumps to thread 6.

Thread 6 prints a newline, then jumps back to thread 0.

I think this could probably be refactored to golf away some of the whitespace, but I'm not doing that since if I do, I'll likely get sucked in and do nothing else for ~8 hours or so. :/

Answered by Aaroneous Miller on December 10, 2021

jq, 98 82 bytes

range(1;101)|if.%15<1then"FizzBuzz"elif.%3<1then"Fizz"elif.%5<1then"Buzz"else. end

Try it online!

Yet to golf it!

Removed superfluous spaces thanks to @DLosc.

Answered by AviFS on December 10, 2021

Fact, 11 bytes (SBCS)

ef̀|3 5^ŹFh̃õ

Explanation

e            1e2 (i.e. 100)
 f̀           for i in 1:100
  |3 5           Divisibility by [3, 5] (vectorizes)
      ^          String repeat by (vectorizes):
       ŹF            "FizzBuzz"
         h̃           Halved (i.e. ["Fizz", "Buzz"])
          õ      Logical OR with i
                 (in Fact, lists are false when all items are "" or 0
                  or when the list is empty)
Implicit grid (smash inner lists and join outer list by newline)

Fork and test

Fact, 15 bytes

ef̀|3 5^'b̀M̀b̀Ò'h̃õ

No "FizzBuzz" builtin, simply uses string compression

Answered by 2x-1 on December 10, 2021

05AB1E, 25 bytes

тLv”FizzÒÖ”#y3 5‚ÖÏJy‚éθ,

Try it online!

I figured I'd add a fourth 05AB1E answer to this challenge. This uses my favourite "vectorise is-divisible and then repeat the fizbuzz list accordingly" approach.

Explained

тLv”FizzÒÖ”#y3 5‚ÖÏJy‚éθ,
тL                        # The range 1 .. 100
  v                       # For each N in that range:
   ”FizzÒÖ”#              #     Push the list ["Fizz", "Buzz"]
            y3 5‚Ö        #     Push N % [3, 5] == 0 (vectorised)
                  Ï       #     "Multiply" the two lists as you would in Vyxal
                   J      #     And concatenate that into a single string
                    y‚    #     And pair that with N
                      é   #     Sorting that by length, so that the value we want is always last
                       θ, #     And print it with a newline

Answered by lyxal on December 10, 2021

Javastack, 123 bytes

100 times context 1 add "Buzz"context 1 add 5 mod 0 equal repeat "Fizz"context 1 add 3 mod 0 equal repeat add logicor print

Try it online!

Context is everything. This is different to Wasif's Javastack answer because it uses a loop instead of a map, as well as extensive use of the context variable (totally not inspired by a certain golfing language made by a certain cg user with Flowey as his pfp).

Roughly equivalent to:

100ʁ ( n 1+ `Fizz` n 1+ 3 ḋt ¬ẋ `Buzz` n 1+ 5 ḋt ¬ẋ + ⟇, ) 

in vyxal.

You don't know how nice it was to write a Javastack answer without restrictions after 13 rounds of C&R.

Answered by lyxal on December 10, 2021

Javastack, 145 bytes

100 range map 1 add duplicate 3 mod 0 equal "Fizz"swap repeat swap 5 mod 0 equal "Buzz"swap repeat swap add swap 1 add swap logicor end "\n"join

Try it online!

-17 thanks to exedraj -22 thanks to new mod builtin

Answered by wasif on December 10, 2021

Python 3, 59 bytes

for i in range(100):print(i%3//2*'Fizz'+i%5//4*'Buzz'or-~i)

Answered by ryno on December 10, 2021

Perl 5 (ppencode-compatible), 1232 690 bytes

Today I learned that and has higher precidence than or or xor; I suffered from making a proper control flow

eval q y eval q x ord or return cos while chop and chop and chop x and print chr ord uc qw q for q and print chr ord q tie gt and print chr length q else x oct oct ord q eq le and print chr length q else x oct oct ord q eq le and return cos for uc y xor eval q y print uc chr ord q dbmopen and and print chr ord q dump and and print chr length q else x oct oct ord q eq le and print chr length q else x oct oct ord q eq le and return cos if length q q s s q eq chr ord reverse length or not chr ord reverse length y or eval q x print length unless length q q s s q eq chr ord reverse length or not chr ord reverse length x xor print chr hex qw q and q while s qq q and length ne ord qw q eq

Try it online!

How it works

# fizz part
eval q y
   # if(length%3==0)
   eval q x
      # instead of length or return 1
      ord or return cos
   while
      # instead of s/...//
      chop and chop and chop
   x and
 
   # print 'Fizz'
   print chr ord uc qw q for q and
   print chr ord q tie gt and
   print chr length q else x oct oct ord q eq le and
   print chr length q else x oct oct ord q eq le and

   # for truthy
   return cos
for
   # instead of $_
   uc
y

xor

# buzz part
eval q y
   # print 'Buzz'
   print uc chr ord q dbmopen and and
   print chr ord q dump and and
   print chr length q else x oct oct ord q eq le and
   print chr length q else x oct oct ord q eq le and

   # for truthy
   return cos
if
   # instead of length%5, /[05]$/
   length q q s s q eq chr ord reverse length or
   not chr ord reverse length
y

or

# this block is done when length%15==0 or length%3&&length%5
eval q x
   print length
unless
   # instead of length%5
   length q q s s q eq chr ord reverse length or
   not chr ord reverse length
x

xor

# newline
print chr hex qw q and q


while
   s qq q and

   # ord qw q eq == 101
   length ne ord qw q eq

Previous

eval q y eval q kill and length or return cos while s q qq and s q qq and s q qq and s q qq and s q qq and s q qq and s q qq and s q qq and s q qq and s q qq and s q qq and s q qq and s q qq and s q qq and s q qq and ok and print chr ord uc qw q for q and print chr ord q tie gt and print chr length q else x oct oct ord q eq le and print chr length q else x oct oct ord q eq le and print uc chr ord q dbmopen and and print chr ord q dump and and print chr length q else x oct oct ord q eq le and print chr length q else x oct oct ord q eq le and return cos for uc y or eval q y eval q kill and length or return cos while s q qq and s q qq and s q qq and s q qq and s q qq and ok and print uc chr ord q dbmopen and and print chr ord q dump and and print chr length q else x oct oct ord q eq le and print chr length q else x oct oct ord q eq le and return cos for uc y or eval q y eval q kill and length or return cos while s q qq and s q qq and s q qq and ok and print chr ord uc qw q for q and print chr ord q tie gt and print chr length q else x oct oct ord q eq le and print chr length q else x oct oct ord q eq le and return cos for uc y or print length xor print chr length q q x x x x eq while s qq q and length ne ord qw q eq

Try it online!

Explained

# fizzbuzz part
eval q y
   # length%15==0?
   eval q k
         ill and length or return cos
      while
s q qq and s q qq and s q qq and
s q qq and s q qq and s q qq and
s q qq and s q qq and s q qq and
s q qq and s q qq and s q qq and
s q qq and s q qq and s q qq and o
   k and
   # then print FizzBuzz, as in first ppencode
   print chr ord uc qw q for q and
   print chr ord q tie gt and
   print chr length q else x oct oct ord q eq le and
   print chr length q else x oct oct ord q eq le and
   print uc chr ord q dbmopen and and
   print chr ord q dump and and
   print chr length q else x oct oct ord q eq le and
   print chr length q else x oct oct ord q eq le and
   # cos is for TRUTHY
   return cos
 # don't change $_ outside 
 for uc
# buzz part, like above
y or eval q y
   eval q kill and length or return cos while s q qq and s q qq and s q qq and s q qq and s q qq and ok and print uc chr ord q dbmopen and and print chr ord q dump and and print chr length q else x oct oct ord q eq le and print chr length q else x oct oct ord q eq le and return cos for uc
# fizz part, like above
y or eval q y
   eval q kill and length or return cos while s q qq and s q qq and s q qq and ok and print chr ord uc qw q for q and print chr ord q tie gt and print chr length q else x oct oct ord q eq le and print chr length q else x oct oct ord q eq le and return cos for uc
# no special strings
y or print length
# print LF
xor print chr length q q x x x x eq
# pretty familiar, isn't it?
while s qq q and length ne ord qw q eq

Answered by nrgmsbki4spot1 on December 10, 2021

PostScript, 73 bytes

Using binary encoding:

000000 31 88 01 88 64 7b 2f 69 92 3e 92 33 28 46 69 7a
000010 7a 42 75 7a 7a 29 69 88 0f 28 42 75 7a 7a 29 69
000020 20 35 28 46 69 7a 7a 29 69 88 03 33 7b 92 6a 30
000030 92 3d 7b 2f 69 92 3e 92 33 7d 7b 92 75 7d 92 55
000040 7d 92 83 69 20 3d 7d 92 48

Try it online! (thanks to tail spark rabbit ear, ignore TIO's character count).

This is a straight-forward encoding of the following 101 byte program (in binary encoding, 136 n is a signed 8-bit integer and 146 n is command n from the system name encoding list in appendix F of the PostScript language reference).

1 1 100{/i exch def(FizzBuzz)i 15(Buzz)i 5(Fizz)i 3 3{mod 0 eq{/i exch def}{pop}ifelse}repeat i =}for

Try it online!

The non-binary encoded version can be reduced to 98 bytes if we don't mind leaving /i on the stack.

/i 1 1 100{def(FizzBuzz)i 15(Buzz)i 5(Fizz)i 3 3{mod 0 eq{/i exch def}{pop}ifelse}repeat i =/i}for

Try it online!

Answered by PertinentDetail on December 10, 2021

C++20, 202 bytes

this is uncompetitive, but this was so fun I couldn't help but post it here.

#include <bits/stdc++.h>
using namespace std;auto f=[](int i){return i%15?(i%5?(i%3?to_string(i):"Fizz"):"Buzz"):"FizzBuzz";};int main(){for(auto i:views::iota(1,100)|views::transform(f))cout<<i<<endl;}

Answered by Matthew Roh on December 10, 2021

Vyxal Hj, 25 19 12 bytes

-6 bytes thanks to Aaron
-7 bytes thanks to the legend himself (lyxal)

Nothing against Lyxal's answer but uses a different technique

ƛ₃kf*n₅kb*+∴               stack is preset to a 100 because of the `H` flag

ƛ                          lambda map with variable n
 ₃                         push 1 if n%3 == 0 (we'll call the return a)
  kf                       push constant Fizz to the stack
    *                      push a*kF
     n                     push n
      ₅                    push 1 if n%5 == 0 (we'll call it b)
       kb                  push Buzz to the stack
         *                 push b*kB
          +                add last two elements of the stack ""/Fizz/Buzz
           ∴               push the maximum of n and ""/Fizz/Buzz/FizzBuzz

Vyxal prints out the last element of the stack by default (the `j` flag joins the list with newlines)

Try it Online!

Answered by math on December 10, 2021

Squire, 92 bytes

n=N whilst C>n{t=""n=n+I if!(n%3){t="Fizz"}if!(n%V){t=t+"Buzz"}proclaim((t||arabic(n))+"
")}

Hear ye, hear ye! Unbeknownst to some, Sampersand hath also created Squire, a companion language to ye lowly language Knight. Squire hath many possessions, but alas, it doth not golfeth as well as its brethren. Thou shalt check it out as well, though.

I cannot provideth thee with a demo link yet as the interpreter is a very lengthy incantation.

Ungolfeth:

# Createth a variable known by most as "n",
# He shalt begin his journey as a mere
# peasant with naught but the value zero.
# (Behold! Squire permits thee to write numbers
# in Roman numerals)
n = N
# Loop thine program unto n approacheth 100
whilst C > n {
    # Lo! I spotteth another variable,
    # who goes by the name of "t".
    # It shall start off as a lonely empty string.
    t = ""
    # Increase n's wealth by bestowing upon it the number one
    n = n + I
    # If n divideth evenly into 3...
    if !(n % 3) {
        # Replaceth t with the string "Fizz"
        t = "Fizz"
    }
    # If n also divideth evenly into 5...
    if !(n % V) {
        # Accompany t with the string "Buzz"
        t = t + "Buzz"
    }
    # Proclaim to ye standard output...
    proclaim(
        # Either...
        (
           #  t if it is not a lonely empty string...
           t
           # or n, converteth to ye foreign Arabic
           # number system, used in lands afar.
           || arabic(n)
        )
        # Appendeth upon it a newline to start
        # another journey.
        + "n"
    )
}

A more favorable program is as follows:

n=N whilst C>n{t=""n=n+I if!(n%III){t="Fizz"}if!(n%V){t=t="Buzz"}proclaim((t||string(n))+"
")}

This program useth Roman numerals, but nay, thine great quest beseecheth that one must outputeth thy program using this unusual number system.

Answered by EasyasPi on December 10, 2021

Knight, 50 48 43 bytes

;=n 0W>101=n+1nO|+*"Fizz"!%n 3*"Buzz"!%n 5n

Try it online!

-2 bytes: use string multiplication instead of IF

-5 bytes: I completely overlooked |, I assumed it had C semantics.

Ungolfed:

# start with n at 0
; = n 0
# increment n and loop while less than 101
: WHILE > 101 (= n + 1 n)
    # outlined from the output for clarity
    # concatenate:
    ; = fizzbuzz +
        # Fizz if n % 3 == 0
        : * "Fizz" ! (% n 3)
        # Buzz if n % 5 == 0
        : * "Buzz" ! (% n 5)
    # If fizzbuzz is not empty, output it, otherwise output n
    : OUTPUT | fizzbuzz n

Answered by EasyasPi on December 10, 2021

BRASCA, 58 bytes

1Hr,[0a:3%0=[a0`zziF`[o]]x:5%0=[a0`zzuB`[o]]A$=[x:n0]xxlo]

Try it online!

Answered by RezNesX on December 10, 2021

Pinecone, 90 bytes

i:1|i<101|i:i+1@(i%3+i%5=0?print:"FizzBuzz"|i%3=0?print:"Fizz"|i%5=0?print:"Buzz"|print:i)

Answered by wasif on December 10, 2021

PPL, 164 bytes

declarex=0
loop100{
x=x+1
ifx%15<1{
printLine("FizzBuzz")
}
ifx%3<1&&x%5>0{
printLine("Fizz")
}
ifx%5<1&&x%3>0{
printLine("Buzz")
}
ifx%3>0&&x%5>0{
printLine(x)
}
}

Yes... 164 bytes.

The problem with my language is that it's almost impossible to golf, because:

  • the newline is the only separator
  • all variables must be declared with the declare keyword
  • no shorthands like += or %=
  • no ternary operators
  • false is the only falsey value
  • long function name: printLine
  • no bitwise and

The good thing is that because of my sloppy lexer, we can mash together expressions. You would never see ifx%15<1 or loop100 in Python, for example. [it's not a bug, it's a feature ...?]There also happens to be no documentation for PPL at the moment.

Answered by user100690 on December 10, 2021

Branch, 98 bytes

^//C//70/105/122Z/zc/66/117/z/za1O[/ob3^%Vc/v?[./]b5^%Wcw?[./]a/vbw^*/0bo^?[#0]a10.o}O/;b101^-]

Try it on the online Branch interpreter!

Explanation

The first part basically loads "Fizz" and "Buzz" along the left branches of two trees, so it looks like:

          0
         / 
        0   0
       /|  / 
      F 0 B   0
     /   /
    i   u
   /   /
  z   z
 /   /
z   z

Then, start the value at 1. Each time, load the value to the left child and 3 to the right child, modulo, move that to the left fork, and branch on condition. If it's 0, it goes to the left branch with "Fizz" and otherwise to the right branch with just 0. [./] keeps printing as a character and moving to the left child so long as the value is not 0, so this prints "Fizz" if it's a multiple of three, and nothing happens otherwise.

Then, do the same thing but with 5 and move to the "Buzz" branch. Finally, load the results of both modulos (using registers to save and move these values) and multiply them. Loading 0 to the left child and the current value into the right branch, using ? on the product will go to the 0 if either modulo was 0, and to the value otherwise. Then, [#0] keeps outputting the value and zeroing it if it is not zero; in other words, if the modulo product was 0, it skips this, and otherwise, it outputs the current value as a number once.

Finally, output a newline, increment the current value, and check if it's high enough to end the program, and if so, exit the main loop.

Answered by hyper-neutrino on December 10, 2021

Stax, 21 bytes

åS╬╕▌≡º$)ö;▀├Xè¶XΔ£≈♀

Run and debug it

Not sure why recursive's solution from the tutorial hasn't been posted here yet. Probably the most minimal fizzbuzz possible in stax.

Answered by Razetime on December 10, 2021

Deadfish~, 3299 bytes

{iiiii}dc{dddd}ic{iiii}c{dddd}c{iiiiii}c{iii}iiiiic{ii}dddcc{{d}}{d}ddc{iiii}iic{dddd}ddc{iiiii}iiiiiic{iiiii}iciiiiicc{{d}}{d}ddc{iiiiii}c{iii}iiiiic{ii}dddcc{{d}}{d}ddc{iiii}iiiiic{dddd}dddddc{iiii}iiiiiic{dddd}ddddddc{iiiiii}c{iii}iiiiic{ii}dddcc{{d}}{d}ddc{iiiii}iiiiiic{iiiii}iciiiiicc{{d}}{d}ddc{iiii}dcc{dddd}ic{iiiiii}c{iii}iiiiic{ii}dddcc{{d}}{d}ddc{iiii}dciic{dddd}dc{iiii}dciiic{dddd}ddc{iiiiii}c{iii}iiiiic{ii}dddcc{ddddd}ddddddc{iiiii}iciiiiicc{{d}}{d}ddc{iiii}dciiiiic{dddd}ddddc{iiii}dciiiiiic{dddd}dddddc{iiiiii}c{iii}iiiiic{ii}dddcc{{d}}{d}ddc{iiii}dc{i}ddc{ddddd}iiic{iiiii}iiiiiic{iiiii}iciiiiicc{{d}}{d}ddc{iiiiii}c{iii}iiiiic{ii}dddcc{{d}}{d}ddc{iiii}cc{dddd}c{iiii}cic{dddd}dc{iiiiii}c{iii}iiiiic{ii}dddcc{{d}}{d}ddc{iiiii}iiiiiic{iiiii}iciiiiicc{{d}}{d}ddc{iiii}ciiiic{dddd}ddddc{iiiiii}c{iii}iiiiic{ii}dddcc{{d}}{d}ddc{iiii}ciiiiiic{dddd}ddddddc{iiii}c{i}dddc{ddddd}iiic{iiiiii}c{iii}iiiiic{ii}dddcc{ddddd}ddddddc{iiiii}iciiiiicc{{d}}{d}ddc{iiii}icddc{dddd}ic{iiii}icdc{dddd}c{iiiiii}c{iii}iiiiic{ii}dddcc{{d}}{d}ddc{iiii}icic{dddd}ddc{iiiii}iiiiiic{iiiii}iciiiiicc{{d}}{d}ddc{iiiiii}c{iii}iiiiic{ii}dddcc{{d}}{d}ddc{iiii}iciiiic{dddd}dddddc{iiii}iciiiiic{dddd}ddddddc{iiiiii}c{iii}iiiiic{ii}dddcc{{d}}{d}ddc{iiiii}iiiiiic{iiiii}iciiiiicc{{d}}{d}ddc{iiii}iicdddc{dddd}ic{iiiiii}c{iii}iiiiic{ii}dddcc{{d}}{d}ddc{iiii}iicdc{dddd}dc{iiii}iicc{dddd}ddc{iiiiii}c{iii}iiiiic{ii}dddcc{ddddd}ddddddc{iiiii}iciiiiicc{{d}}{d}ddc{iiii}iiciic{dddd}ddddc{iiii}iiciiic{dddd}dddddc{iiiiii}c{iii}iiiiic{ii}dddcc{{d}}{d}ddc{iiii}iiciiiiic{ddddd}iiic{iiiii}iiiiiic{iiiii}iciiiiicc{{d}}{d}ddc{iiiiii}c{iii}iiiiic{ii}dddcc{{d}}{d}ddc{iiii}iiicdddc{dddd}c{iiii}iiicddc{dddd}dc{iiiiii}c{iii}iiiiic{ii}dddcc{{d}}{d}ddc{iiiii}iiiiiic{iiiii}iciiiiicc{{d}}{d}ddc{iiii}iiicic{dddd}ddddc{iiiiii}c{iii}iiiiic{ii}dddcc{{d}}{d}ddc{iiii}iiiciiic{dddd}ddddddc{iiii}iiiciiiic{ddddd}iiic{iiiiii}c{iii}iiiiic{ii}dddcc{ddddd}ddddddc{iiiii}iciiiiicc{{d}}{d}ddc{iiii}iiiicdddddc{dddd}ic{iiii}iiiicddddc{dddd}c{iiiiii}c{iii}iiiiic{ii}dddcc{{d}}{d}ddc{iiii}iiiicddc{dddd}ddc{iiiii}iiiiiic{iiiii}iciiiiicc{{d}}{d}ddc{iiiiii}c{iii}iiiiic{ii}dddcc{{d}}{d}ddc{iiii}iiiicic{dddd}dddddc{iiii}iiiiciic{dddd}ddddddc{iiiiii}c{iii}iiiiic{ii}dddcc{{d}}{d}ddc{iiiii}iiiiiic{iiiii}iciiiiicc{{d}}{d}ddc{iiii}iiiiicddddddc{dddd}ic{iiiiii}c{iii}iiiiic{ii}dddcc{{d}}{d}ddc{iiii}iiiiicddddc{dddd}dc{iiii}iiiiicdddc{dddd}ddc{iiiiii}c{iii}iiiiic{ii}dddcc{ddddd}ddddddc{iiiii}iciiiiicc{{d}}{d}ddc{iiii}iiiiicdc{dddd}ddddc{iiii}iiiiicc{dddd}dddddc{iiiiii}c{iii}iiiiic{ii}dddcc{{d}}{d}ddc{iiii}iiiiiciic{ddddd}iiic{iiiii}iiiiiic{iiiii}iciiiiicc{{d}}{d}ddc{iiiiii}c{iii}iiiiic{ii}dddcc{{d}}{d}ddc{iiii}iiiiiicddddddc{dddd}c{iiii}iiiiiicdddddc{dddd}dc{iiiiii}c{iii}iiiiic{ii}dddcc{{d}}{d}ddc{iiiii}iiiiiic{iiiii}iciiiiicc{{d}}{d}ddc{iiii}iiiiiicddc{dddd}ddddc{iiiiii}c{iii}iiiiic{ii}dddcc{{d}}{d}ddc{iiii}iiiiiicc{dddd}ddddddc{iiii}iiiiiicic{ddddd}iiic{iiiiii}c{iii}iiiiic{ii}dddcc{ddddd}ddddddc{iiiii}iciiiiicc{{d}}{d}ddc{iiiii}dddc{d}iic{dddd}ic{iiiii}dddc{d}iiic{dddd}c{iiiiii}c{iii}iiiiic{ii}dddcc{{d}}{d}ddc{iiiii}dddcdddddc{dddd}ddc{iiiii}iiiiiic{iiiii}iciiiiicc{{d}}{d}ddc{iiiiii}c{iii}iiiiic{ii}dddcc{{d}}{d}ddc{iiiii}dddcddc{dddd}dddddc{iiiii}dddcdc{dddd}ddddddc{iiiiii}c{iii}iiiiic{ii}dddcc{{d}}{d}ddc{iiiii}iiiiiic{iiiii}iciiiiicc

Oof.

Answered by emanresu A on December 10, 2021

C#, 95 91 bytes

for(int x=0;x++<100;)System.Console.WriteLine((x%3<1?"Fizz":"")+(x%5<1?"Buzz":x%3<1?"":x));

I do not take credit for this solution. I merged two solutions together:

This solution requires C# 9, but does not use Linq.

Answered by speyck on December 10, 2021

Kotlin, 95 bytes

fun main(){(1..100).map{i->println(when(0){i%15->"FizzBuzz";i%3->"Fizz";i%5->"Buzz";else->i})}}

Try it Online!

Answered by Roan Cooney on December 10, 2021

Factor, 145 142 122 bytes

As usual, @Bubbler nailed it. Go upvote one of his answers!

100 [1,b] [ dup [ 3 mod 0 = dup [ "Fizz"write ] when ] [ 5 mod 0 = dup [ "Buzz"write ] when ] bi or [ nl ] [ . ] if ] each

Try it online!

Old version:

1 [ dup 100 > ] [ dup [ 3 mod 0 = dup [ "Fizz"write ] when ] [ 5 mod 0 = dup [ "Buzz"write ] when ] bi or [ ""print ] [ dup . ] if 1 + ] until

Try it online!

Amazingly, until now no one posted a Factor answer. It is not really golfed much, probably can be improved.

Answered by hdrz on December 10, 2021

CSASM v2.1.2.1, 325 bytes

func main:
push 1
pop $a
.lbl a
clf.o
push $a
push 15
rem
push 0
comp
push $f.o
brtrue e
push $a
push 3
rem
push 0
comp
push $f.o
brtrue b
push $a
push 5
rem
push 0
comp
push $f.o
brtrue d
push $a
print.n
br c
.lbl b
push "Fizz"
print.n
br c
.lbl d
push "Buzz"
print.n
br c
.lbl e
push "FizzBuzz"
print.n
.lbl c
clf.o
inc $a
push $a
push 101
comp
push $f.o
brfalse a
ret
end

Commented and Ungolfed:

func main:
    ; Initilize the counter in the accumulator
    push 1
    pop $a

    .lbl loop
        ; Reset the Comparison flag
        clf.o

        ; $a % 15 == 0
        push $a
        push 15
        rem
        push 0
        comp

        ; Jump to label "printFizzBuzz" if the Comparison flag is true
        push $f.o
        brtrue printFizzBuzz

        ; $a % 3 == 0
        push $a
        push 3
        rem
        push 0
        comp

        ; Jump to label "printFizz" if the Comparison flag is true
        push $f.o
        brtrue printFizz

        ; $a % 5 == 0
        push $a
        push 5
        rem
        push 0
        comp

        ; Jump to label "printBuzz" if the Comparison flag is true
        push $f.o
        brtrue printBuzz

        ; None of the above were true.  Just print the number itself
        push $a
        print.n
        br checkCounter

    .lbl printFizz
        ; Print "Fizz"
        push "Fizz"
        print.n
        br checkCounter

    .lbl printBuzz
        ; Print "Buzz"
        push "Buzz"
        print.n
        br checkCounter

    .lbl printFizzBuzz
        ; Print "FizzBuzz"
        push "FizzBuzz"
        print.n

    .lbl checkCounter
        ; Clear the Comparison flag
        clf.o

        inc $a

        ; $a == 101
        push $a
        push 101
        comp
        push $f.o

        ; Keep looping until the above is false
        brfalse loop
    ret
end
```

Answered by absoluteAquarian on December 10, 2021

Pxem, Filename: 96 81 bytes + Content: 0 bytes = 96 81 bytes.

Thanks, Neil, for providing a workaround for -15 bytes!

  • Filename (some are escaped): 20.z.t.m05.%01.yXXbuzz.a.m03.%01.yXXfizz.a.c.c.z.m[email protected]@.z.pXX.a.sn.o.m01.+.ct.a
  • Content: empty.

Try it online! (with pxem.posixism)

With comments

XX.z
.a20.zXX.z # push 16; while :; do
  .a.tXX.z # heap = pop!
  .a.m05.%01.yXXbuzz.aXX.z # while 1>heap%5; do push "buzz"; break; done
  .a.m03.%01.yXXfizz.aXX.z # while 1>heap%3; do push "fizz"; break; done
  .a.c.c.z.m[email protected] # if empty?; then print(heap-15); push "@"; fi
    # this is how while empty?; do something; done works:
    # ".c.c.z bla bla bla .a"
    # NOTE: Fail on pxemi dot 7z and RPxem
    # They need some patches before installing
    # Implementation needs to be document-compliant
    # PS. RPxem v0.0.7 fixed dotC 
  [email protected] # if top!="@"; then print pop all!; fi
  .a.sXX.z # pop!
  .an.oXX.z # print "n"
  .a.m01.+XX.z # push heap; add one to it
.a.ct.aXX.z # break if equal to 116
.a

Note

  • In Pxem, unlike other stack-based languages, subtraction and division does NOT rely on positions of two items; .- does push(abs(pop-pop)), .$ and .% stand for x=pop; y=pop; push(int(x>y?x/y:y/x)) and x=pop; y=pop; push(int(x>y?x%y:y%x)) respectively. Thus, when you try to do something like 13/17 or 13%17, you need to check which are greater first.
  • To avoid the specification, the program loops from 16 to 115.

Old version

1

Answered by nrgmsbki4spot1 on December 10, 2021

Dash, with these restrictions

  • with SUSv2-compatible utilities
  • no built-in loops, no built-in branches, no variables
  • 1 pipeline
  • no awk
  • no LF in pattern space in sed
  • no hold space in sed

Dash, 103 bytes, 5 utilities.

echo ,,fizz,,buzz,fizz,,,fizz,buzz,,fizz,,,fizzbuzz|sed -n ':x
p
bx'|tr , \n|sed '/./b
=
d'|head -n100

Try it online!

Dash, 124 121 bytes, 9 utilities.

echo xx|sed -n ':x
p
bx'|sed s/$/fizz/|tr x \n|paste - - - - -|sed s/$/buzz/|tr \t \n|sed -n '/./p
/^$/='|head -n100

Try it online!

Dash, 133 132 bytes, 10 utilities.

echo|sed -n ':x
p
bx'|paste - - -|sed s/$/fizz/|tr \t \n|paste - - - - -|sed s/$/buzz/|tr \t \n|sed -n '/./p
/^$/='|head -n100

Try it online!

Originally, on GitHub Gist

With comments

echo | sed -n '
    :x
    p
    bx
' | # yes ''
paste - - - | sed s/$/fizz/ | tr \t \n | # if NR%3==0; then $0="fizz";
paste - - - - - | sed s/$/buzz/ | tr \t \n | # if NR%5==0; then $0=$0 "buzz";
sed -n '
    /./p
    /^$/=' | # = is to output line number
head -n 100

Answered by nrgmsbki4spot1 on December 10, 2021

M4, 115 bytes

Also TIL that ifelse can have more than four arguments.

define(f,`ifelse($1,101,,`ifelse(eval($1%15),0,fizzbuzz,eval($1%5),0,buzz,eval($1%3),0,fizz,$1)
f(incr($1))')')f(1)

Try it online!


M4, 143 bytes, SUSv2-compatible.

define(f,`ifelse(`$1',101,,`g(`$1',ifelse(eval($1%3),0,fizz)`'ifelse(eval($1%5),0,buzz))
f(incr($1))')')define(g,`ifelse(len($2),0,$1,$2)')f(1)

Try it online!

I am not familiar with M4, but I tried some bests. What quotations can be removed?

With comments

dnl def f(n): return "" if n==101 else g(n,("fizz" if n%3==0 else "")+("buzz" if n%5==0 else "")+"n"+f(n+1))
define(f,`ifelse(`$1',101,`',`g(`$1',ifelse(eval($1%3),0,fizz)`'ifelse(eval($1%5),0,buzz))
f(incr($1))')')dnl
dnl def g(n,s): return n if len(s)==0 else n
define(g,`ifelse(len($2),0,$1,$2)')dnl
f(1)

Answered by nrgmsbki4spot1 on December 10, 2021

C#, 97 bytes

for(int x=0;x++<100;)System.Console.WriteLine(x%3*x%5>0?x+"":"FizzBuzz"[x%5>0?..4:x%3>0?4..:..]);

Requires C# 9 for top level statements and range syntax.

Answered by mattnewport on December 10, 2021

Burlesque, 72 bytes

,1 100r@{JJ3.%0=="Fizz"j.*j5.%0=="Buzz"j.***Jr&0=={vv}j{jvv}jie}m[[Sush

Try it online!

Do you see that at the end? Sus?!? Does that mean this program is the impostor!!!

This is why I need to stop fizzbuzzing at 10pm at night. I'll explain this tomorrow if I remember how it works.

Answered by lyxal on December 10, 2021

Retina, 47 bytes


100*
L$`_
$.>`
4,5,m`^
Buz
2,3,m`^
Fiz
zd*
zz

Try it online! Explanation: Much simpler than @MartinEnder's approach, although I did copy his zz trick to save two bytes.


100*
L$`_
$.>`

List the numbers from 1 to 100.

4,5,m`^
Buz

Prefix Buz to every fifth number.

2,3,m`^
Fiz

Prefix Fiz to every third number.

zd*
zz

Double the zs, and also delete the number after Fizz or Buzz.

Answered by Neil on December 10, 2021

sed 4.2.2 -r, 94 bytes

G
:
s/n.?$/&0&1&2&3&4&5&6&7&8&9/m
t
s/w.{8}/&Fizz /g
G
s/ *w[05]|$/Buzz/2g
s/^0*n*| .*//mg

Try it online

This is my old solution from anarchy golf, minus 5 backslashes gained by -r.

The loop generates 00 to 99 preceded by newlines. Next, we prepend Fizz to lines 03, 06, ... taking advantage of the fact that the entry points are all separated by 9 characters. Then we handle instances of Buzz by looking for suffix of 0 or 5, plus an empty line to stand in for 100, and skipping the first match 00. The last line cleans up the garbage on the ends of Fizz-but-not-Buzz lines along with leading 0s and the first two lines.

Note: The behavior of mixing 2 and g flags in s is unspecified by POSIX but well-defined in GNU sed.

sed 4.2.2 (no -r), 98 bytes (based on a solution by tails)

s/S?/ 123456789/
s//&1 &2 &3 &4 Buzz &6 &7 &8 &9 Buzz /g
s/([1 ]S* .S* )[0-9]*/1Fizz/g
L0
d

Try it online

Using a quite different approach, this solution wins by 1 byte when -r is not used. Thanks to @tails for sharing this approach with me!

The first two lines generate 1 to 100 separated by spaces with suitable Buzz replacements, along with an extra residual space before 11. To match for Fizz replacements, special care is needed to skip Buzz in multiples of 15 without skipping Buzz in 3k + 1 spots. We can do this by starting the pattern with a space, except that this does not work for the very first match, so [1 ] is used instead. The . in line 3 compensates for the extra space before 11, which is masked in the final output by L0.

L is a GNU-specific line formatting command that was "considered a failed experiment" and removed in later versions of sed.

Answered by Mitch Schwartz on December 10, 2021

jq, 45 bytes

range(100)+1|(1-.%3)*"fizz"+(1-.%5)*"buzz"//.
# explanation
range(100)+1| # for each number in range 0-99 + 1
      . % 3 ) #   the current number modulo 3
 ( 1 -        #   the important thing is this gives 1 for 0 and an invalid
              #   number (0 or negative) for any positive number
       *"fizz"#   "fizz" repeated that many times. For a negative or 0 number
              #   this returns null
 + ..."buzz"  #   concatenated with the same thing but for buzz.
              #   null + anything is that thing, so for a number not divisible by
              #   3 or 5 this returns null
   // .       #   if the result is null, the number itself
              # implicit output

For best results run with jq -rn '...' | less.

Answered by Wezl - a cautionary tale on December 10, 2021

Excel, 82 79 Bytes

=LET(x,ROW(1:100),a,IF(MOD(x,3),"","Fizz")&IF(MOD(x,5),"","Buzz"),IF(a="",x,a))

This wasn't valid when the question was asked.

Spreadsheet

Answered by Axuary on December 10, 2021

///, 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(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!

Answered by Samuel Waller on December 10, 2021

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.

Answered by user100690 on December 10, 2021

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.

Answered by seshoumara on December 10, 2021

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)

Answered by EasyasPi on December 10, 2021

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

Answered by Leo on December 10, 2021

Turing Machine Code, 5743 bytes

Should note that Turing Machine Code doesn't process newlines/carriage returns. So everything is necessarily on one line. Thus this may not be, by strict interpretation of the rules, a competing answer due to the nature of the language.

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
p # _ r ©
© _ 5 r Ω
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 IJ
IJ _ 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!

Answered by ouflak on December 10, 2021

Java 94 92 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.

Answered by Xander Weiss-Lemieux on December 10, 2021

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.

Answered by SketchySketch on December 10, 2021

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("FizzBuzzn")
|(0,_):p("Fizzn")
|(_,0):p("Buzzn")
|(_,_):p("{}n",i)
;;;;}

Answered by binarycat on December 10, 2021

Java, 100 98 95 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);}}}

Answered by Xander Weiss-Lemieux on December 10, 2021

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<           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.

Answered by EasyasPi on December 10, 2021

Mouse-83/Mouse-2002, 73 bytes

1F:(F.Z4*1+<^0A:F.3=["Fizz"1A:]F.5=["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.

Answered by lyxal on December 10, 2021

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
    );
}

Answered by Rohan on December 10, 2021

BRASCA, 81 bytes

1b1[x0aB:b3%0=[x`zziF`oooo1a0]xB:b5%0=[x`zzuB`oooo0A1+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.

Answered by lyxal on December 10, 2021

Python 3, 88 85 77 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!

Answered by ce_phox on December 10, 2021

Canvas, 31 bytes

A2^{w3%0≡Fizz×y5%0≡Buzz×+:?O]yO

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.

Answered by lyxal on December 10, 2021

FALSE, 86 bytes

[100*/$100$@/*-0=]m:1[$100>~][0$3m;![%1"Fizz"]?$5m;![%1"Buzz"]?=[$.]?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"]?=[$.]?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
    = 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.

Answered by ReedsShorts on December 10, 2021

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")}

Answered by Pedro Maimere on December 10, 2021

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

Answered by Makonede on December 10, 2021

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

Answered by Shaggy on December 10, 2021

Kakoune, 57 bytes

!seq 100
%s[05]$
Ab<esc>%s(w+n){3}
<a-h>sd+
cFizz<esc>%sd*b
cBuzz

asciicast

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>sd+              Select every third number (unselecting the b's)
cFizz<esc>             Replace with Fizz
          %sd*b       Select (including 0) digits followed by a b
cBuzz                  Replace with Buzz

Answered by Loovjo on December 10, 2021

!@#$%^&*()_+, 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
    $^$
)

Answered by Conor O'Brien on December 10, 2021

LolCode, 392 383 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

Answered by OCDkirby on December 10, 2021

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.

Answered by lyxal on December 10, 2021

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/

Answered by roblogic on December 10, 2021

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)

Answered by Razetime on December 10, 2021

Add++, 89 bytes

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.

Answered by lyxal on December 10, 2021

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 = ["1n2nFizzn...n98nFizznBuzz"]
			; Return the top of the stack		"1n2nFizzn...n98nFizznBuzz"

Answered by caird coinheringaahing on December 10, 2021

Charcoal, 37 29 bytes

E…¹¦¹⁰¹∨⁺×Fizz¬﹪ι³×Buzz¬﹪ι⁵Iι

Try it online!

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

Verbose

Answered by lyxal on December 10, 2021

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

Answered by Dion on December 10, 2021

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

Answered by xunxekri on December 10, 2021

Vyxal, j, 18 17 14 12 11 bytes

₁ƛ₍₃₅kF½*∑∴

Try it Online!

I refuse to be beaten by Arn and Ash. I absolutely will not be beaten by either of those languages. Vyxal forever lads.

Explained

₁ƛ₍₃₅kF½*∑∴
₁           # Push 100 to the stack
 ƛ          # Over the range [1, 100], map: (we'll call the argument n)
  ₍₃₅       #   [n % 3 == 0, n % 5 == 0] (call this X)
     kF     #   "FizzBuzz"
       ½    #   ["Fizz", "Buzz"] # halve the string - split into two equal pieces
        *∑  #   sum(X * ↑)
          ∴ #   max(↑, n)
            # The -j flag joins on newlines before outputting

If you want it flagless:

Vyxal, 12 bytes

₁ƛ₍₃₅kF½*∑∴,

Try it Online!

See how inconsequential flags are?

Vyxal, 17 bytes

₁ƛ35fḊ`₴ḟ₴ḣ`½*∑∴,

No questionable built-ins, no flags, just plain legitimate fizzbuzz.

Try it Online!

Answered by lyxal on December 10, 2021

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.

Answered by ZippyMagician on December 10, 2021

Rattle, 54 44 bytes

Fizz&Buzz|!I=[g+bs%3[0b0b^0]g%5[0b1b^0]B]100

Try it Online!

This [was] my first answer in my new programming language! (This answer has since been golfed, and works on my new online interpreter)

Eventually, this programming language might have a more concise way to solve this challenge.

^this ended up being true - after a couple updates, 10 bytes can be shaved off the original answer (without implementing trivial built-ins)

Explanation

Fizz&Buzz         a variable containing the text Fizz and Buzz
|                 signals the end of the input
!                 is a flag to disable implicit printing at EOF
I                 splits the variable into parts and stores it in consecutive memory slots
=                 sets top of stack to 0
[                 start outer loop
g+bs              gets value at slot 3 (starts at zero), increments, 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
[0b0b^0]          if the value on stack is equal to 0, concatenates value from memory slot 0 ("Fizz") 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
[0b1b^0]          if the value on stack is equal to 0, concatenates the value from memory slot 1 ("Buzz") 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

Answered by Daniel H. on December 10, 2021

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.

Answered by lyxal on December 10, 2021

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.

Answered by Thomas on December 10, 2021

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
                                               not divisible), then jump to its >
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

Answered by Dion on December 10, 2021

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.

Answered by zydras on December 10, 2021

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.

Answered by bigyihsuan on December 10, 2021

Bash, 58 bytes

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

Try it online!

Answered by Anders Kaseorg on December 10, 2021

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!

Answered by user92069 on December 10, 2021

Symja, 140 134 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.

Answered by lyxal on December 10, 2021

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

Answered by Nanajnaiojneg on December 10, 2021

W n, 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
```

Answered by user92069 on December 10, 2021

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).

Answered by Axel Montini on December 10, 2021

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

Answered by user41805 on December 10, 2021

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

Answered by Popov on December 10, 2021

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

Answered by Sebastián Mestre on December 10, 2021

DIVSPL, 22 bytes

1..100
fizz=3
buzz=5

Answered by Ethan McCue on December 10, 2021

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":

"Hardware" Configuration

Custom LCD:

enter image description here

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

Answered by nihilazo on December 10, 2021

W d, 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

Answered by user85052 on December 10, 2021

Scala, 65 64 Bytes

1.to(100).map(n=>{print(s"n$n"+(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)

Answered by gregam3 on December 10, 2021

Python 3, 80 bytes

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

Answered by PythoNista on December 10, 2021

Keg, 58 40+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

Answer History

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.

Answered by lyxal on December 10, 2021

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!

Answered by user85052 on December 10, 2021

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))

Julia isn't really made for this, but I had fun thinking about this a bit :).

Answered by caseyk on December 10, 2021

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>
?~
-
+
-

Answered by mattnewport on December 10, 2021

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:

300 px version Bigger

Answered by lyxal on December 10, 2021

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

Answered by Sagittarius on December 10, 2021

Zsh, 105 78 68 66 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`}

Answered by roblogic on December 10, 2021

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?!)

Answered by Sagittarius on December 10, 2021

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  [email protected].
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...

Answered by 640KB on December 10, 2021

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)

Answered by TheOnlyMrCat on December 10, 2021

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!

Answered by Kenzie on December 10, 2021

Seed, 6015 bytes

186 83944644497775792185807323999861330742900673481712359255839929374667216476568023851764637813248013688693896717275687232066153870107749175160194707761486575005885313952906442913325967953944535811512056079183251514390746052490451307246213606447865255212286265116943188690839445165359981774554198082946825007384980162551436390435260155582466874315352220541140434954811560506556477075852586817070090764184077321583489797358147025926992986354865415277367374043398355163643621296927936732212800075642321038031920620549375319366961667358107695950468557182519902148699776620624078332688843597417318685229781090303723160175745852091928346724348001020777912570918121340035523698691520422590527296248455779012094897281946771732844646467975422651655880202725095981882371807518829844157636552230152953535332201239998966830698645115246907049972204010095894629001206397276344975636564553238199728981112245810583644580269593382612869323054013019350314231784293448249910440692956496060253971880373279161390518237118507378691330341470412624728172421405109963475552981299919837091765136501358887135317778357279769289706821629750840213676581513947891276551415821187603189444230553630205086966993211879390093045277089486589385876312541940492767981701353769007246001400130719416118275492304807198011860072050303044225722194337717896831470037434122578382321765362062455130027125953869723625862069785410531287781468150359623495258126317807476517184801674197008747267394632928708383370640309530427431150403028006421518064783676469959724647961395869176187323826585310379142853088186864023708457159764123364029018721951815248751431170413579315400528983481702298849209797951129827235189965388114007169146563257209800975334610910397591190300324319540160364733177122449656422045835924029442449258975425381755648345550014417207471617919736685787448764321614059138375253980386335770138273578332418379763049794151811098188219754733324389355566317376598492318359989945589480418455750455469859956801589082779968271578522034926104268403877968397758570110853038536860556853388613997493905742068279137736678857073233174739380697685907170886092925173057794582407478105690770633669349947638020604803238951194381273510993928897230197983256465537488284258216944902276278712201715008765995404107536372438956009631805114079400698265046614085687812688769068889878215788959245601084883372435344000194364054441952170474833494604130017222942459218768152451353838900515646024764453476453552863938005162079649698291854043301771100462916706520075039044805956181705047266329114921035274711980897862579454154525144505597823262540025190878917613039796282312555295659294071407630514652646787462515667390800389392114746442068094785615537685660298361617697365653764669207754605147347324074541222276275532258194690926246437097055706104108319469003781845674958634242078791475826910418111428349167152839025683587469305219626924263962611094845308744968793376752461012553325189830937237777556407663277494722334379175044299145527685100424059993166500276116324651034389342857099326382267792125696063602436504279969923412378117936327869017861642388185619118723658181098871790872093500520584752433465443515989483851486224923341213990357424279098636563794743080022540640677640107176034203326304825856510242291526956869439836743210321616337131260522898066320086593786007891762080406650341513081903510025534886914361255147039463158189995500627220823997958074917925862170348467342212390436963261050291735696261617106196786273505443408966191019872244618002281427523777003325474230066462489531195157755555344637353155356279454281010364750875012491070816465270498678197434494849001514802132418781410405222031814823702582955264273367316636558580379660009282902598817700470535664545017234816209988594892835104965686956867851308392004044845547855039571721575449154495443479356960829759209226823917197487855397504141411230632224369201022681688301238065753737278463677847356448662974398206270856674118500884955014781944009536761710654880983265123955150729759406311220705702903728217724237231225228243114081826682040349685205121446193821261139703572900811243143912445467975694459999888915923116875430564637390061881889161512304819029656014338113772447267072899546161543780769850725712979853265124144813517511575434597175140160445249538753447856073028845070404104820699013418827593400549228758486817648053770622330987136941236768786640613654490823959024174575959620155957372041756651311988259843620347948677131103848960623371212015137053539005334518693964703094514744873758157905983139622925587291886231049371800498250086745691716656644176053612172113439907334397406577774498757112425437339205922869531575921611548158798375762386782843394828401126984185115349224303420458491251207091698634206841378497320259972637725826224808114267917428717816623368840721796784587349258491132128347823644310226457190477267965710821892576687103122134712656694901146343938508484308662925632874468476850854977933467327214644382364732022885458172449643330918925157997124690072012401561398600599725096512808715148150880033416494352767432615596760722206416684175988533830899565642405659319720681197534141300323187308210290375660950200938389996580887564670049743784962037885099514826194024014058093062057706139814777110125812527054724707373942053107785831307633110641398607263726549612409340127167852023607787965086360296071952107945138419803900924977980375619565210182772121849111987355981226968062629667279278470647719759267716675652568099185449478479471691254158308189631416224208590609150412906273490206303890853713104183863050119383440553687111132467944761189779633340481533657859382354192428154204487886313458547651002779223927726608436086877353829832057341247094095114657693381028772025327489391112902949559367893876211447144802835381133403893955836438518252858893637260806405255643702579004661210305919494653119109150790218729956868835489222681506976514342204634574313468575534020458319909578144280137077342941741913678288702984697189445809519253013406175446129538246339672293879388869701830984873958965248

Try it online!

Answered by Kamila Szewczyk on December 10, 2021

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  

Answered by Adám on December 10, 2021

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

Answered by Grimmy on December 10, 2021

Racket, 107 Bytes

(for{[x 100]}(define(f a b n)(if(=(modulo(+ 1 x)n)0)a b))(printf"~a~an"(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~an"
          (if (= (modulo (+ x 1) 3) 0) 'Fizz "")
          (if (= (modulo (+ x 1) 5) 0) 'Buzz
              (if (= (modulo (+ x 1) 3) 0) "" (+ x 1)))))

Answered by waf9000 on December 10, 2021

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)))

Answered by waf9000 on December 10, 2021

C, 98 94 bytes

i;main(){for(;++i<101;)i%3*i%5?printf("%dn",i):printf("%s%sn",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("%dn",i) :
            printf("%s%sn", i % 3 ? "" : "Fizz", i % 5 ? "" : "Buzz");
}

Answered by qookie on December 10, 2021

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"";}

Answered by Yoris on December 10, 2021

JavaScript, 127 122 81 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

Answered by Ryan Knutson on December 10, 2021

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

Answered by Benjamin Urquhart on December 10, 2021

Brachylog, 48 bytes

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

Try it online!

Probably not golfed too well but it works.

Answered by Unrelated String on December 10, 2021

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!

Answered by ThePlasmaRailgun on December 10, 2021

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!

Answered by Kamil Naja on December 10, 2021

Javascript, 80 bytes

for(i=1;i<101;i++){console.log(i%3==0?i%5==0?"FizzBuzz":"Fizz":i%5==0?"Buzz":i)}

Answered by Jeyanth on December 10, 2021

Ink, 77 70 57 48 bytes

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

Try it online!

Answered by Sara J on December 10, 2021

J, 45 bytes

New Version, thanks to Bolce Bussiere:

(,&((;,>)Fizz`Buzz)@":{~+.&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 ((;,>)Fizz`Buzz) 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).

Answered by Bailis Cremey on December 10, 2021

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

Answered by Jo King on December 10, 2021

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.

Answered by ais523 on December 10, 2021

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!

Answered by Elcan on December 10, 2021

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

Answered by DLosc on December 10, 2021

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)

Answered by Tryer on December 10, 2021

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!

Answered by Maz on December 10, 2021

K (oK), 49 46 43 bytes

Solution:

`0:{$[a:,/$&`Fizz`Buzz!~5 3!'x;a;x]}'1+!100

Try it online!

Explanation:

`0:{$[a:,/$&`Fizz`Buzz!~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)
            `Fizz`Buzz!                     / 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

Answered by mkst on December 10, 2021

Python 3, 62 bytes

for _ in range(1,101):print("Fizz"*(_%3<1)+"Buzz"*(_%5<1)or _)

Try it online!

Answered by Josh B. on December 10, 2021

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!

Answered by archangel.mjj on December 10, 2021

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)

Answered by maxb on December 10, 2021

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

Answered by GalladeGuy on December 10, 2021

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.

Answered by StealthyPanda on December 10, 2021

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.

Answered by Mitch Schwartz on December 10, 2021

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))

Answered by Tango on December 10, 2021

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

Answered by Kamil Mętrak on December 10, 2021

12-BASIC, 73 55 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...

Answered by 12Me21 on December 10, 2021

Ada (GNAT), 196 bytes

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!

Answered by ASCII-only on December 10, 2021

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
]

Answered by Conor O'Brien on December 10, 2021

Forth, 107 101 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!

Answered by Alex on December 10, 2021

Ada (GNAT), 298 bytes

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!

Answered by LambdaBeta on December 10, 2021

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

Answered by Jo King on December 10, 2021

///, 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!"

Try it online! Try it interactively!

Answered by Conor O'Brien on December 10, 2021

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!

Answered by Quantum64 on December 10, 2021

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.

Answered by Phlarx on December 10, 2021

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):

enter image description here

  • 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:

enter image description here

  • 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.

Answered by Jo King on December 10, 2021

sed, 275 272 270 260 254 249 245 bytes

s/.*/t0u123456789/
:1
s/(tu?(.).*)/1n2/
s/u(.)(t?)(.*)/12u31/
/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.

Answered by lucasb on December 10, 2021

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 "nnnnFiBuzz"
       C2¨¶¶¶⌈iΩZu --cut; the list ["nn", "nn", "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) ["nnFizz"] (3) ["nnnnBuzz"]
¶Σ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.

Answered by Sophia Lechner on December 10, 2021

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

Answered by Kevin Cruijssen on December 10, 2021

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?S$Fi
Next

Try it online!

Answered by Taylor Raine on December 10, 2021

uBASIC, 106 96 bytes

Improved syntax, and fixed a bug

0ForI=1To100:S$="":IfIMod3=0ThenS$="Fizz"
1IfIMod5=0ThenS$=S$+"Buzz"
2IfS$=""Then?I,
3?S$
4NextI

Try it online!

Answered by Taylor Raine on December 10, 2021

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!

Answered by Taylor Raine on December 10, 2021

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!

Answered by Taylor Raine on December 10, 2021

KoopaScript, 250 characters

def i 1 if %va is %vu set a 1;setath b %va %% 3;setath c %va %% 5;setath e %va %% 15;if %vb is 0 if %vc not 0 print Fizz;if %vb not 0 if %vc is 0 print Buzz;if %ve is 0 print FizzBuzz;if %vb not 0 if %vc not 0 print %va;setath a %va + 1

Guide to reading: Don't. Either learn KoopaScript more or less entirely by looking at the code (my documentation isn't that great) or just take my word for it that it works. By the way, KoopaScript is an interpreted language I made (not specifically for this) that runs inside ActionScript 2, and doesn't actually have else statements, or... most of the stuff that makes other examples short. All functions are one line, so this was pretty easy. Here's the GitHub repo.

Answered by Jhynjhiruu Rekrap on December 10, 2021

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.

Answered by Martin Ender on December 10, 2021

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.

Answered by Conor O'Brien on December 10, 2021

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 Fizzn

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 Buzzn

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 FizzBuzzn

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

Answered by Hugh Williams on December 10, 2021

SNOBOL4 (CSNOBOL4), 137 121 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

Answered by Giuseppe on December 10, 2021

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)

Answered by Bolce Bussiere on December 10, 2021

face, 152 bytes

(FizzBuzz%d@
)F*,c'Fo>m+*1+m=*m?*m1+m3+m4+m5+11334455$BF"B4$%B"%4$N%"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"%4$N%"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.)

Answered by Doorknob on December 10, 2021

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!

Answered by Damiano on December 10, 2021

><>, 59 bytes

0v!oo:oo"Fiz"
1<oan?*/!?%5$!?%3;?)*aa::::::+
o"Buzz"/$0oo

Try it online!

Prints a trailing newline

How it works

0v...
.<... Initialises the stack with 0
.....

.....
1<................;?)*aa::::::+ Increment the counter and duplicate it a looooot
.....                           End the program if the counter is larger than 100 (10*10)

0..oo:oo"Fiz"
.............!?%3... Check if the counter is divisible by 3 and print Fizz if so
.....                 Also push a 0 to the stack

.......o         Swap the pushed 0 if it exists (otherwise it swaps two copies of the counter)
......./!?%5$... Check if the counter is divisible by 5 and print Buzz if so
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.

Answered by Jo King on December 10, 2021

Symbolic Python, 324 bytes

I think I fried my brain making this...

_____=_;_=-~(_==_);___=_**(_*_+_);____=___+___/_+_+_
___=(('%'+`'¬'`[-_])*_)%(___+_,___*_-_*_-_)
___=`_>_`[_>_]+`__`[_*_+_]+___[~-_]*_,___[-_]+`__`[_]+___[~-_]*_
_=_>_
__('____=""'+(';_=-~_;____+=((_%-~-~(_==_)<(_==_))*___[_>_]+(_%-~-~-~-~(_==_)<(_==_))*___[_==_]'+`_____`[_==_]+`_==_`[_==_]+'`_`)+'+`"""
"""`)*____)
_=____

Try it online!

Answered by FlipTack on December 10, 2021

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!

Answered by user58988 on December 10, 2021

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");
    }
}

Answered by Kishan Kumar on December 10, 2021

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!

Answered by Οurous on December 10, 2021

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

Answered by user58988 on December 10, 2021

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 ∇

Answered by user58988 on December 10, 2021

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.

Answered by Armand on December 10, 2021

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
]

Answered by Jo King on December 10, 2021

Java (OpenJDK 8), 127 bytes

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

Try it online!

ungolfed:

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

Answered by Luca H on December 10, 2021

Befunge-93, 61 bytes

1+::::3%|>.#_:"c"`#@_55+,
,,:,,0v>"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!

Answered by Jo King on December 10, 2021

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.

Answered by kernigh on December 10, 2021

Acc!!, 260 bytes

Count i while 100-i {
i%3/2*2
Count f while _/2 {
Write 70
Write 105
Write 122
Write 122
1
}
_+i%5/4*2
Count b while _/2 {
Write 66
Write 117
Write 122
Write 122
1
}
Count d while 1-_ {
(i+1)/10
Count z while _ {
Write 48+_
0
}
Write 48+(i+1)%10
1
}
Write 10
}

Try it online!

Explanation

Once you know how Acc!! works, this is pretty straightforward. Count while loops increment their variable from 0 as long as their condition is true. Write takes an ASCII code and outputs the corresponding character. Bare expressions like i%3/2*2 are assigned to the accumulator, _. Division is integer division.

Our code iterates i from 0 through 99 (thus, the number in question on each iteration is actually i+1).

  • If i%3 is 2 (i.e. i+1 is divisible by 3), we want to print Fizz.
    • Set the accumulator to i%3/2*2, which is 0 if i%3 is less than 2, and 2 otherwise.
    • Loop with condition _/2; we enter the loop iff the accumulator was set to 2 last step.
    • Inside the loop, write Fizz.
    • Set the accumulator to 1, breaking out of the f loop while keeping a record that we Fizzed.
  • If i%5 is 4 (i.e. i+1 is divisible by 5), we want to print Buzz. Same approach as above, except we now add i%5/4*2 to the existing accumulator value to preserve a possible 1 from the Fizz step.
  • If we printed Fizz and/or Buzz, the accumulator is now 1; otherwise, it is 0. If it is 0, we need to output the number.
    • Loop with condition 1-_: we enter the loop iff the accumulator is not 1.
    • Set accumulator to (i+1)/10, the 10's digit.
    • If that result is not 0, write the 10's digit, and set accumulator to 0 to break out of the z loop.
    • Write the 1's digit, (i+1)%10.
    • Set accumulator to 1 to break out of the d loop.
  • Finally, write a newline.

Answered by DLosc on December 10, 2021

tinylisp repl, 130 bytes

(d f(q((n # %)(i(e n 100)(q Buzz)(i(disp(i #(i % n(q Buzz))(i %(q Fizz)(q FizzBuzz))))0(f(a n 1)(i #(s # 1)2)(i %(s % 1)4
(f 1 2 4

Try it online! (Note that the repl auto-completes parentheses at the ends of lines; these have been filled in on the TIO version.)

Explanation

It took me a while to realize I could do FizzBuzz in tinylisp, since the language doesn't have strings. However, it does have the Name type, which can be any run of non-whitespace, non-parenthesis characters; and it also has the disp command, which outputs a value followed by a newline. Together with some creative abuse of recursion, we can get the desired output.

We define a function f with three arguments:

  • n is the counter. We will start at 1 and recurse until 100.
  • # is the number of iterations till the next divisible-by-3 number. (Mnemonic: Shift-3)
  • % is the number of iterations till the next divisible-by-5 number. (Mnemonic: Shift-5)

The first thing f does is check whether n is 100. If so, we return Buzz. This value gets passed all the way up the call stack and printed at the end.

If not, we need to use disp to print either the number, Fizz, Buzz, or FizzBuzz, depending on the values of # and %:

  • If # and % are both nonzero (truthy), the number is not divisible by 3 or 5. Display the number, n.
  • If # is nonzero but % is zero, the number is divisible by 5 but not 3. Display Buzz.
  • If # is zero but % is nonzero, the number is divisible by 3 but not 5. Display Fizz.
  • If # and % are both zero, the number is divisible by 3 and 5. Display FizzBuzz.

Since tinylisp does not have an equivalent to Common Lisp's progn, disp'ing something and then returning a value requires a little trickery. Since disp always returns (), which is falsey, we can use the disp call as the condition of an if (i). The true branch will never be evaluated (0 is a convenient placeholder), and we can put the actual return value in the false branch.

This return value is a recursive call. We add 1 to n, and we subtract 1 from # and % unless they are zero, in which case we reset them to (3-1) or (5-1), respectively.

Ungolfed, using the standard library for long names of builtins (TIO):

(load library)

(def fizz-buzz
 (lambda (counter steps-till-fizz steps-till-buzz)
  (if (equal? counter 100)
   (q Buzz)
   (if
    (disp
     (if steps-till-fizz
      (if steps-till-buzz counter (q Buzz))
      (if steps-till-buzz (q Fizz) (q FizzBuzz))))
    (comment Return val of disp is always falsey, so the true branch is never executed)
    (fizz-buzz
     (add2 counter 1)
     (if steps-till-fizz (sub2 steps-till-fizz 1) 2)
     (if steps-till-buzz (sub2 steps-till-buzz 1) 4))))))

(fizz-buzz 1 2 4)

Answered by DLosc on December 10, 2021

Funky, 59 bytes

for(i=1i<100i++)print((("Fizz"*1&!i%3)+("Buzz"*1&!i%5))ori)

Try it online!

Answered by ATaco on December 10, 2021

AppleScript, 104 102 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.

Answered by kernigh on December 10, 2021

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')+'
')

Answered by Brian H. on December 10, 2021

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!

Answered by jq170727 on December 10, 2021

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

Answered by german_guy on December 10, 2021

AsciiDots, 152 bytes

 #
/$""
~
 @-
[=]@*-
/@----*-~&
|0/---*[>]
|@<>$_"Buzz"@1)
|*-~/ /-/
||[%]->#100)
v-*#5*/
|.//
| <>$_"Fizz"@1)
|/-~/
@|[%]-
0-*#3/
*-[+]
#1/

Try it online!

Answered by user31415 on December 10, 2021

groovy, 55 bytes

Borrows idea from answer by @feersum https://codegolf.stackexchange.com/a/58623

100.times{println'Fizz'*(it%3/2)+'Buzz'*(it%5/4)?:it+1}

Answered by kau on December 10, 2021

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.

Answered by Grzegorz Puławski on December 10, 2021

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'  

Answered by officialaimm on December 10, 2021

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.

Answered by Cóemgein on December 10, 2021

Excel VBA, 81 Bytes

Anonymous VBE immediate window function that takes no input and outputs to the VBE immediate window.

For i=1To 100:o=IIf(i Mod 3,"","Fizz")+IIf(i Mod 5,"","Buzz"):?IIf(o="",i,o):Next

Ungolfed

For i=1To 100                   ''  iterate from 1 to 100
    o=IIf(i Mod 3,"","Fizz")    ''  set the out var to `Fizz` if i Mod 3 = 0, else empty
     +IIf(i Mod 5,"","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, 95 Bytes

Anonymous VBE immediate window function that takes no input and outputs to the range [A1:A100]

 [A1]="=Let(r,Row(1:100),s,If(Mod(r,3),"""",""FIZZ"")&If(Mod(r,5),"""",""BUZZ""),If(s="""",r,s))

Answered by Taylor Raine on December 10, 2021

TeX, 304 bytes

documentclass[9pt,a4paper]{article}pagestyle{empty}begin{document}count0=0count1=0count3=3count5=5loopadvancecount1 by1count0=0
ifnumcount1=count3 Fizzadvancecount3 by3count0=1fiifnumcount1=count5 Buzzadvancecount5 by5count0=1fithecount1

ifnumcount1<100repeatend{document}

Somehow count0 is necessary but I didn't check whether it is zero. It works and I have no idea why.

Answered by Leaky Nun on December 10, 2021

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!

Answered by Husnain Raza on December 10, 2021

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

Answered by lewisfish on December 10, 2021

APL, 41 bytes

⊣{⎕←∊(z,⍱/z←0=3 5|⍵)/'Fizz' 'Buzz'⍵}¨⍳100

Tested on GNU-APL (ver 1.7/980M)

Answered by Ala'a Mohammad on December 10, 2021

Swift, 97 bytes

for i in 1...100{i%15==0 ?print("FizzBuzz"):i%3==0 ?print("Fizz"):i%5==0 ?print("Buzz"):print(i)}

Answered by SrB on December 10, 2021

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  
                   

Answered by Datboi on December 10, 2021

Micro, 72 bytes

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

Answered by raddish0 on December 10, 2021

q/kdb+, 58 56 49 bytes

Solution:

0{$[sum i:0=y mod 3 5;`Fizz`Buzz(&)i;y]}'1+(!)100

Example:

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

Explanation:

0{$[sum i:0=y mod 3 5;`Fizz`Buzz where i;y]}'1+til 100  / ungolfed
 {                                         }'           / anonymous function that takes each-left and each-right
0                                                       / this would be parameter 'x' but we dont use it
                                               til 100  / til generates a list of 0..99
                                             1+         / adds 1 to every item in the list, thus 1..100
  $[                 ;                  ; ]             / switch, $[condition;true;false]
            y mod 3 5                                   / modulo operation on input for 3 and 5, mod[1;3 5] = 1 1
          0=                                            / is 0 equal to this result (basically a 'not' operation)
        i:                                              / save in i for later
    sum                                                 / add these, will get 0, 1 or 2. 0 is interpretted as false
                                 where i                / where gives indices where i is true
                      `Fizz`Buzz                        / 2 item list which gets indexed into (and implicitly returned)
                                     y                  / return the input if the condition was false

Notes:

This ^^ is pretty much a q version of the k solution, so I've written in a different way.. unfortunately it's about 50% slower :(

0{(`Fizz;`Buzz;y)(&)(0=a),all a:mod[y;3 5]}'1+(!)100

Here we are indexing into a list of Fizz, Buzz, based on the result of the modulo operation... The k solution style is better.

Answered by mkst on December 10, 2021

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
]

Answered by daniero on December 10, 2021

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

Answered by theblitz on December 10, 2021

Ruby, 68 65 bytes

q='Buzz';(1..100).map &->e{p e%3<1?'Fizz'+(e%5<1?q:''):e%5<1?q:e}

Answered by marmeladze on December 10, 2021

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

Answered by Beta Decay on December 10, 2021

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

Answered by Destructible Lemon on December 10, 2021

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.

Answered by eaglgenes101 on December 10, 2021

///, 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

Answered by Esolanging Fruit on December 10, 2021

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.

Answered by Rohan Jhunjhunwala on December 10, 2021

K, 52 Bytes

-1@{,/$$[#i:&~.q.mod[x;3 5];`Fizz`Buzz i;x]}'1+!100;

Thanks

Answered by Chromozorz on December 10, 2021

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.

Ungolfed version(Modified to be readable) with comments:

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 &

Answered by cookie on December 10, 2021

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

Answered by Josh on December 10, 2021

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

Answered by idrougge on December 10, 2021

8086 machine code, 70 68 62 bytes

00000000  31 c0 40 50 89 c2 89 e5  68 0a 24 d4 05 75 06 68  |[email protected].$..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

Answered by user5434231 on December 10, 2021

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.

Answered by fəˈnɛtɪk on December 10, 2021

Common Lisp, 103 101 96 93 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

Answered by user65167 on December 10, 2021

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.

Answered by BTC on December 10, 2021

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.

Answered by BTC on December 10, 2021

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

Answered by 12Me21 on December 10, 2021

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.

Answered by user63571 on December 10, 2021

Befunge, 65 bytes

_1+::3%^>55+,:"c"`#@
>"zuB"vv.#,,:,,<
|!:%5 _:!"ziF"^
<,,:,,<:|*

Try it online!

Answered by James Holderness on December 10, 2021

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

Answered by sergiol on December 10, 2021

Mathematica, 61 Bytes

Heavily inspired by this post on the mathematica stack exchange

fizzbuzz[#,,fizz,,buzz][[#~GCD~15~Mod~15]]&~Array~100//Colum‌​n

Answered by A Simmons on December 10, 2021

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
>>>>>>>>>>>.>>>.<..

Answered by Forcent Vintier on December 10, 2021

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.

Answered by M L on December 10, 2021

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.

Answered by udioica on December 10, 2021

Groovy, 61 bytes

100.times{a=++it%3?"":"fizz"
a+=it%5?"":"buzz"
println a?:it}

Answered by kinbiko on December 10, 2021

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()

Link to library: https://github.com/mvegh1/Enumerable/

Code explanation: Creates a range starting at 1 and extending 100 elements. Select maps the item according to the predicate. First check if divisible by 3, if so check if divisible by 5. If so, select "FizzBuzz", else select "Fizz". Otherwise,check if divisible by 5. If so, select "Buzz", else just select the number. WriteLine is built into the library, and it writes each element on its own line

enter image description here

Answered by applejacks01 on December 10, 2021

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.

Answered by DarkPhantom on December 10, 2021

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

Answered by Żáłģó on December 10, 2021

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.

Answered by user54187 on December 10, 2021

///, 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

Answered by Leaky Nun on December 10, 2021

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)

Answered by lad2025 on December 10, 2021

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

Answered by JoshK on December 10, 2021

Transact-SQL, 163 143 124 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

Answered by Phrancis on December 10, 2021

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}
}

Answered by Dúthomhas on December 10, 2021

Javascript, 64 bytes

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

Answered by RuteNL on December 10, 2021

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.

Answered by DJMcMayhem on December 10, 2021

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.

Answered by phrebh on December 10, 2021

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";.

Answered by Aaron on December 10, 2021

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!

Answered by Justinw on December 10, 2021

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).

Answered by drolex on December 10, 2021

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!

Answered by Matt Sams on December 10, 2021

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);
  }
}

Answered by Harshal Sharma on December 10, 2021

Python 2, 91

1;exec"print'FizzBuzz'if _%3==_%5==0else'Fizz'if _%3==0else'Buzz'if _%5==0else _;_+=1;"*100

Answered by Oliver Ni on December 10, 2021

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
}

Answered by Benjamin Williams on December 10, 2021

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])))

Answered by Winny on December 10, 2021

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.

Answered by Tersosauros on December 10, 2021

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:

Colorized Hexagony FizzBuzz solution

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):

enter image description here

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!

Answered by M L on December 10, 2021

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.

Answered by RenderSettings on December 10, 2021

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);
}

Answered by cat on December 10, 2021

C#, 174 bytes

void A(){for(int x=1;x<101;x++){if(x%15<1)Console.Write("FizzBuzzn");else if(x%3<1)Console.Write("Fizzn");else if(x%5<1)Console.Write("Buzzn");else Console.WriteLine(x);}}

Ungolfed:

void A(){
    for (int x = 1; x < 101; x++) {
        if (x % 15 < 1) Console.Write("FizzBuzzn");
        else if (x % 3 < 1) Console.Write("Fizzn");
        else if (x % 5 < 1) Console.Write("Buzzn");
        else Console.WriteLine(x);
    }
}

Answered by EnragedTanker on December 10, 2021

Jolf, 42 33 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?

Answered by Conor O'Brien on December 10, 2021

Perl 6, 46 bytes

say "Fizz"x $_%%3~"Buzz"x $_%%5||$_ for 1..100

Answered by Hotkeys on December 10, 2021

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.

Answered by Dennis on December 10, 2021

beeswax, 104 89 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@`zzuB`d'%~5F@<f`z`<
 >~P"#"_"1F3~%'d`Fiz`b
 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
d`Fizz`f>

into

<f`z`<
d`Fiz`b

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?<@`zzuB`b'%~5F@<f`zziF`b'<
>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.

beeswax FizzBuzz animation


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

Program with path overlay

Answered by M L on December 10, 2021

Rust, 145 137 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).

Answered by S22h on December 10, 2021

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

Answered by Qwertiy on December 10, 2021

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

Answered by anOKsquirrel on December 10, 2021

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.

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

Answered by flawr on December 10, 2021

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.
#          Discard the accumulator.

Answered by Dennis on December 10, 2021

Seriously, 36 bytes

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

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)

Try it online.

Answered by user45941 on December 10, 2021

Hexagony, 112 bytes

d{$>){*./;.}<._.zi...><{}.;/;$@-/=.*F;>8M'<$<..'_}....>.3'%<}'>}))'%<..._>_.'<$.....};u..}....{B.;..;.!<'..>z;/

After unfolding and with colour-coded execution paths:

enter image description here
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.

Answered by Martin Ender on December 10, 2021

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;

Answered by user46915 on December 10, 2021

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.

Answered by a spaghetto on December 10, 2021

Japt, 45 44 43 39 36 35 33 32 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!

Answered by ETHproductions on December 10, 2021

F#, 129 116 113 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}

Answered by mattnewport on December 10, 2021

?????, 32 chars / 47 bytes

⩥Ṥⓜᵖ`FizzBuzz`ė⧺_%3⅋4,_%5?4:8)⋎_

Try it here (Firefox only).

Answered by Mama Fun Roll on December 10, 2021

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.

Answered by Mama Fun Roll on December 10, 2021

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')

Answered by James Murphy on December 10, 2021

Groovy, 83 80 bytes

(1..100).each{def f=it%3,b=it%5;println!f&&!b?'FizzBuzz':!f?'Fizz':!b?'Buzz':it}

Answered by K. Klassen on December 10, 2021

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.

Answered by lrn on December 10, 2021

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.

Answered by Tuesday on December 10, 2021

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.

Try it online.

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.

Answered by Sp3000 on December 10, 2021

Swift, 75 bytes

for n in 1...100{print(n%3*n%5>0 ?n:(n%3>0 ?"":"Fizz")+(n%5>0 ?"":"Buzz"))}

Answered by Richard G. Nielsen on December 10, 2021

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

Answered by El'endia Starman on December 10, 2021

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.)

Answered by Doorknob on December 10, 2021

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}

Answered by Ben on December 10, 2021

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

Answered by MickyT on December 10, 2021

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.

Answered by feersum on December 10, 2021

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

Answered by Konamiman on December 10, 2021

Go, 130 129 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!

Answered by Kristoffer Sall-Storgaard on December 10, 2021

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

Answered by MT0 on December 10, 2021

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$dn":"%sn":"Fizz%sn",i%5?"":"Buzz",i);}

Answered by Stefano Sanfilippo on December 10, 2021

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), 166 165 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.

Answered by dbenham on December 10, 2021

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

Answered by dbenham on December 10, 2021

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!

Answered by Ken Gregory on December 10, 2021

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

Answered by Aurel Bílý on December 10, 2021

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

Answered by Ken Gregory on December 10, 2021

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);}}

Answered by Bill Tür on December 10, 2021

rs, 92 91 bytes

(_)^^(100)
+^(_+)(_)/1 12
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!)

Answered by kirbyfan64sos on December 10, 2021

GolfScript, 37 bytes

100,{)..3%!'Fizz'*5%!'Buzz'*+or n}/

Answered by brendan on December 10, 2021

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...

Answered by Lynn on December 10, 2021

Ruby, 50 bytes

Requires version 1.8, which seems to be popular among golfers:

1.upto(?d){|n|puts'FizzBuzz
'[i=n**4%-15,i+13]||n}

In modern Ruby, you replace ?d with 100 for a 51-byte solution.

This seems to be the world record.

Answered by Lynn on December 10, 2021

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.)

Answered by Lynn on December 10, 2021

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.

Answered by DLosc on December 10, 2021

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.

Answered by bmarks on December 10, 2021

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

Answered by tommy_p1ckles on December 10, 2021

Groovy, 69 Bytes

(1..100).each{i->println i%15?(i%5?(i%3?i:'Fizz'):'Buzz'):'FizzBuzz'}

Answered by The Coder on December 10, 2021

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)

Answered by Jean Nassar on December 10, 2021

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"±...).)

Answered by Lynn on December 10, 2021

Haskell, 84 82 bytes

main=mapM putStrLn[show n`max`map("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.

Old 84 byte answer

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 (n`mod`3 * 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.

Answered by Lynn on December 10, 2021

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.

Answered by lirtosiast on December 10, 2021

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)

Answered by gilad hoch on December 10, 2021

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!

enter image description here

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.

Answered by Sp3000 on December 10, 2021

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;
    add al, '0'
    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.

Answered by anatolyg on December 10, 2021

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}

Answered by iokanuon on December 10, 2021

Swift, 77 bytes

for i in 1...100{print(i%15<1 ?"FizzBuzz":i%3<1 ?"Fizz":i%5<1 ?"Buzz":"(i)")}

Answered by Najkin on December 10, 2021

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.

Answered by Mark on December 10, 2021

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]

Answered by Veer Singh on December 10, 2021

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

Answered by DLosc on December 10, 2021

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.

Answered by casey on December 10, 2021

C++, 130 126 119 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";}

Live version.

Answered by mattnewport on December 10, 2021

Groovy, 71 bytes

(1..100).each{i->println i%15<1?'FizzBuzz':i%5<1?'Buzz':i%3<1?'Fizz':i}

Answered by Kleyguerth on December 10, 2021

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}

Answered by Reinstate Monica -- notmaynard on December 10, 2021

Go, 162 158 145 143 142 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

Answered by Justin Powell on December 10, 2021

Mathematica, 83 75 73 67 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.

Answered by LegionMammal978 on December 10, 2021

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 ;)

Answered by Tom Carpenter on December 10, 2021

JavaScript, 73 71 65 bytes

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

Answered by Diego Torres on December 10, 2021

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))

Answered by nanny on December 10, 2021

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.

Answered by Cabbie407 on December 10, 2021

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'''''''>`++ /+)@'''''>`+++++++)@' 
v```P'''----(+++++++++/+/P+++'L@@++(+++++`<''/
>'p-`n'''''''>`++++++++/
^    >'P'p-``n'         >'p-``n'''''''''''>`++++++)@'''''''>`++ 
^       <    >p:L''p-``       >''P``v
^      Hu```P-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'''''''>`++ /+)@'''''>`+++++++)@' 
v```P'''----(+++++++++/+/P+++'L@@++(+++++`<''/
>'p-`n'''''''>`++++++++/
^    >'P'p-``n'         >'p-``n'''''''''''>`++++++)@'''''''>`++ 
^       <    >p:L''p-``       >''P``v
^      Hu```P-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'''''''>`++ 
v```P'''----(+++++++++/

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.

                              >''P``v
       Hu```P-p'''L@++++++++++LP+p  <

Increments the counter, prints a newline, decrements the loop counter and exits if required.

Answered by MickyT on December 10, 2021

><>, 68 66 65 64 63 bytes

12+2fooo o"Buzz"<
o>:::3%:?!$5%:?!/*?n1+:aa*)?;a
o.!o"Fizz"/o

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, another thanks to randomra, and a last one thanks to Jacklyn. Thanks a lot!

Answered by Aaron on December 10, 2021

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).

Answered by coredump on December 10, 2021

Ceylon, 368 144 123 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]);}}

Answered by Paŭlo Ebermann on December 10, 2021

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

Answered by Najkin on December 10, 2021

Retina, 317 139 134 132 70 63 60 55 bytes

.100{`^
_
*(a`(___)+
Fi;$&
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.

Answered by Martin Ender on December 10, 2021

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)).

Answered by Fatalize on December 10, 2021

Haskell, 105 97 bytes

main=mapM(putStrLn.f)[1..100]
a%b=a`rem`b<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!

Answered by Avery Glitch on December 10, 2021

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.

Answered by primo on December 10, 2021

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),"
";

Answered by primo on December 10, 2021

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.

Answered by Seth Battin on December 10, 2021

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.

Answered by Forty3 on December 10, 2021

Bash, 85 81 78 74 72 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!

Answered by Dennis on December 10, 2021

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.

Answered by Mitch Schwartz on December 10, 2021

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

Answered by Jacob Misirian on December 10, 2021

Nim, 100 76 73 bytes

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...

Answered by Sp3000 on December 10, 2021

JavaScript, 73 bytes

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

Answered by Timwi on December 10, 2021

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,:))

Answered by Luis Mendo on December 10, 2021

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;}

Answered by r3mainer on December 10, 2021

Clojure, 113 106 101 100 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))))))

Answered by Sam Estep on December 10, 2021

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

Answered by MickyT on December 10, 2021

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

Answered by daniero on December 10, 2021

C#, 128 126 125 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.

Answered by Pierre-Luc Pineault on December 10, 2021

Ruby, 82 72 70 68 bytes

based on other answers:

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()}

Answered by Camden Narzt on December 10, 2021

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}

Answered by DavidC on December 10, 2021

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

Answered by Nico A on December 10, 2021

R, 88 83 77 71 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)

Answered by MickyT on December 10, 2021

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!)

Answered by ETHproductions on December 10, 2021

C, 85 bytes

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

-2 thanks to squeamish.

Answered by AShelly on December 10, 2021

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.

Answered by El'endia Starman on December 10, 2021

gs2, 1

f

A quote from Mauris, the creator of gs2:

I wanted to one-up goruby's 1-byte Hello, world!, so... This prints "1n2nFizzn4nBuzzn...". :)

Update: Added 27-byte answer that doesn't use f.

Answered by Mitch Schwartz on December 10, 2021

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));

Answered by user41805 on December 10, 2021

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]
}
}
}
}

Answered by Beta Decay on December 10, 2021

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!):

say'Fizz'x!($_%3).Buzz x!($_%5)||$_ for 1..100

Perl 5, 50 bytes

print'Fizz'x!($_%3).Buzz x!($_%5)||$_,$/for 1..100

Answered by Dom Hastings on December 10, 2021

Mouse, 75 bytes

1I:(I.101<^0J:I.3=["Fizz"J.1+J:]I.5=["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
)
$

Answered by Alex A. on December 10, 2021

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.

Answered by senshin on December 10, 2021

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)

Answered by flawr on December 10, 2021

Pyth, 30

VS100|+*!%N3"Fizz"*!%N5"Buzz"N

Try it here

Explanation:

VS100|+*!%N3"Fizz"*!%N5"Buzz"N
VS100                            : for N in range(1,101)
     |                           : logical short-circuiting or
      +*!%N3"Fizz"               : add "Fizz" * not(N % 3)
                                 : Since not gives True/False this is either "" or "Fizz"
                  *!%N5"Buzz"    : Same but with 5 and Buzz
                             N   : Otherwise N
                                 : The output of the | is implicitly printed with a newline

Answered by FryAmTheEggman on December 10, 2021

PowerShell, 78 68 61 54 Bytes

1..100|%{(($t="Fizz"*!($_%3)+"Buzz"*!($_%5)),$_)[!$t]}

Edit: Saved 10 bytes thanks to feersum

Edit2: Realized that with feersum's trick, I no longer need to formulate $t as a string-of-code-blocks

Edit3: Saved another 7 bytes thanks to Danko Durbić

Similar-ish in spirit to the stock Rosetta Code answer, but golfed down quite a bit.

Explanation

1..100|%{...} Create a collection of 1 through 100, then for-each object in that collection, do

(...,$_) create a new collection of two elements: 0) $t=... set the variable $t equal to a string; 1) $_ our-current-number of the loop

"Fizz"*!($_%3) take our-current-number, mod it by 3, then NOT the result. Multiply "Fizz" by that, and add it to the string (and similar for 5). PowerShell treats any non-zero number as $TRUE, and thus the NOT of a non-zero number is 0, meaning that only if our-current-number is a multiple of 3 will "Fizz" get added to the string.

[!$t] indexes into the collection we just created, based on the value of the string $t -- non-empty, print it, else print our-current-number


Alternatively, also 54 bytes

1..100|%{'Fizz'*!($_%3)+'Buzz'*!($_%5)-replace'^$',$_}

Thanks to TesselatingHeckler

Similar in concept, this uses the inline -replace operator and a regular expression to swap out an empty string ^$ with our-current-number. If the string is non-empty, it doesn't get swapped.


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.

Answered by AdmBorkBork on December 10, 2021

Python 2, 56 bytes

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

Try it online!

Answered by feersum on December 10, 2021

Java, 130 bytes

This is for recent Java versions (7+). In older ones you can shave some more off using the enum trick, but I don't think the logic gets any shorter than this (86 inside main).

class F{public static void main(String[]a){for(int i=0;i++<100;)System.out.println((i%3<1?"Fizz":"")+(i%5<1?"Buzz":i%3<1?"":i));}}

Answered by Geobits on December 10, 2021

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.

Answered by ASCIIThenANSI on December 10, 2021

Python 2, 61 60 bytes

for i in range(1,101):print"Fizz"*(i%3<1)+"Buzz"*(i%5<1)or i

Answered by Blue on December 10, 2021

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!

Answered by Dennis on December 10, 2021

Julia, 64 bytes

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

Answered by Alex A. on December 10, 2021

CJam, 35 bytes

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

Try it online in the CJam interpreter.

How it works

100{)_[Z5]f%:!"FizzBuzz"4/.*se|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.

Answered by Dennis on December 10, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP