Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics

Dashboard
Notifications
Mark all as read
Challenges

1, 2, Fizz, 4, Buzz!

+6
−0

The task

Output the first 100 elements of the infamous FizzBuzz sequence.

How?

The FizzBuzz sequence is the sequence of decimal integers from 1 to 100 inclusive, but:

  • If the integer is divisible both by 3 and 5, output the string FizzBuzz
  • Else, if the integer is divisible by 3, output the string Fizz instead
  • Else, if the integer is divisible by 5, output the string Buzz instead
  • Else, output the integer itself

Output

The output will be a list of these elements separated by either a space (U+0020) or a newline (U+000A).

Here is a sample output with newline separation:

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

Rules

  • Your code may not print anything to STDERR. Warnings are fine.
  • This is code-golf, so lowest byte-count in each language is the winner.
Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

7 comments

I'm pretty sure U+0020 is the space, and U+000A is the newline. BTW, what exactly does "must not produce an error from start to finish" mean? In particular, do compiler warnings count as errors in this context? celtschk‭ about 2 months ago

@celtschk fixed, thanks Dion‭ about 2 months ago

Now I'm sad. SPL relies on STDERR to be golfed effectively, heh.Time to double the length of my program... Corsaka‭ about 2 months ago

@corsaka if you think it is acceptable to change the rules at this point, then I can edit the post so that programs may not HALT on errors Dion‭ about 2 months ago

Wait, are warnings considered STDERR? If not, that solves the issue. If yes, then the top answer is also incorrect. Corsaka‭ about 2 months ago

Show 2 more comments

9 answers

+4
−0

C (gcc), 113 Bytes

i;main(){while(i++<100){char*h[]={"%d "," "},**p=h;i%3||(*p++="Fizz%2$s");i%5||(*p="Buzz ");printf(*h,i,h[1]);}}

This compiles with several warnings, but no errors.

Here's an ungolfed version with explanations:

/* the following include is omitted; while using printf
   without including it is not conforming to the current
   C standard, with gcc it only generates a warning
   and works flawlessly. Note that omission was valid K&R C */
#include <stdio.h>

/* Declare a global int variable. The golfed code omits the
   type because of the old implicit-int rule, which only
   generates a warning also in modern gcc. Also note that
   global variables without initializer are zero-initialized;
   this is still defined behaviour today. In this ungolfed
   code I've added the implied initializer for clarity. */
int i=0;

/* The main function. Again, the golfed code makes use of the
   old implicit int rule. */
int main()
{
  /* loop up to 100; since we increment before entering the
     loop body, the first number in the loop is 1. */
  while(i++<100)
  {
    /* In this array of two strings, the first will be used as
       format string to a printf later, while the second will
       be the third argument for the same printf. As is, the
       format string will tell printf to format the second
       argument (which will be i) as number, followed by a space.
       The third argument, a single-space string, is ignored
       in that case. */
    char *h[] = { "%d ", " " };

    /* This second variable (which in the golfed version is
       declared in the same declaration as h) points to the first
       entry of h. It is used to change the entries of h, and
       it is separate because pointer arithmetic is used to
       modify different strings depending on the condition. */
    char **p = h;

    /* This is basically an if-not statement. If i%3 is not
       nonzero (that is, if i is divisible by 3), this statement
       replaces the format string with one that prints "Fizz"
       followed by the content of the third argument of printf
       as string, which is the second string in h. At this
       point it contains just a space. Also, when replacing the 
       format string, the pointer p is incremented, so it then
       points to the second element of h. */
    i%3 || (*p++ = "Fizz%2$s");

    /* This if-in-disguise handles divisibility by 5. It stores
       a pointer to "Buzz " into whatever p points to. If i
       is not divisible by 3, this still is the format string,
       so if instructs the following printf to just print "Buzz "
       and ignore any further arguments. Otherwise, p points
       to the final string argument, so that after the "Fizz"
       it prints "Buzz " instead of just a space. */
    i%5 || (*p = "Buzz ");

    /* This finally is the printf statement talked about
       in the previous comments. Note that *h is equivalent
       to h[0] */
    printf(*h,i,h[1]);
  }
}
Why does this post require moderator attention?
You might want to add some details to your flag.

1 comment

Nice solution since it's quite straight-forward, +1. I managed 108 bytes with same compiler settings (default gcc) but a much more obscure solution here. Lundin‭ about 2 months ago

+3
−0

goruby, 1 byte

f

Okay, so that's a bit unfair. 😂 The definition of f from golf_prelude.rb (which is what goruby embeds) is quite golfy in itself:

def f(m = 100)
  1.upto(m){|n|puts'FizzBuzz
'[i=n**4%-15,i+13]||n}
end

Substituting m with 100 directly gives us the Ruby version, which weighs in at 51 bytes:

1.upto(100){|n|puts'FizzBuzz
'[i=n**4%-15,i+13]||n}
Why does this post require moderator attention?
You might want to add some details to your flag.

0 comments

+2
−0

Shakespeare Programming Language, 11232 bytes

My last attempt was nearing the 20000 byte zone, because it didn't use the stack at all.

a.Ajax,.Puck,.Ford,.Act I:.Scene I:.[Enter Ajax and Puck]Ajax:You is twice the sum ofa cat a big big cat.Puck:You is the sum oftwice the sum ofthe cube ofa big big cat a big pig a big pig.Scene V:.[Exeunt][Enter Ajax and Puck]Puck:Remember you!Remember you!Remember the sum ofthe sum ofyou a big big pig a pig!Remember the sum ofthe cube ofa big big cat a big cat!Remember me!Remember you!Remember you!Remember the sum ofthe sum ofyou a big big big big pig a pig!Remember the sum oftwice the sum ofa big cat a cat the cube ofa big big cat!Remember me!Remember me!Remember me!Remember you!Remember you!Remember the sum ofthe sum ofyou a big big big big pig a pig!Remember the sum oftwice the sum ofa big cat a cat the cube ofa big big cat!Remember me!Remember you!Remember you!Remember the sum ofthe sum ofyou a big big pig a pig!Remember the sum ofthe cube ofa big big cat a big cat!Remember me!Remember me!Remember you!Remember you!Remember the sum ofthe sum ofyou a big big big big pig a pig!Remember the sum oftwice the sum ofa big cat a cat the cube ofa big big cat!Remember me!Remember me!Remember me!Remember you!Remember you!Remember the sum ofthe sum ofyou a big big pig a pig!Remember the sum ofthe cube ofa big big cat a big cat!Remember you!Remember you!Remember the sum ofthe sum ofyou a big big big big pig a pig!Remember the sum oftwice the sum ofa big cat a cat the cube ofa big big cat!Remember me!Remember me!Remember me!Remember you!Remember you!Remember the sum ofthe sum ofyou a big big big big pig a pig!Remember the sum oftwice the sum ofa big cat a cat the cube ofa big big cat!Remember me!Remember me![Exit Ajax][Enter Ford]Puck:You is the sum ofyou a cat!Be you worse twice the sum ofa big cat a cat?If soLet usScene V![Exit Ford][Enter Ajax]Puck:Remember you!Remember you!Remember the sum ofthe sum ofyou a big big pig a pig!Remember the sum ofthe cube ofa big big cat a big cat!Remember me!Remember you!Remember you!Remember the sum ofthe sum ofyou a big big big big pig a pig!Remember the sum oftwice the sum ofa big cat a cat the cube ofa big big cat!Remember me!Remember me!Remember me!Remember you!Remember you!Remember the sum ofthe sum ofyou a big big big big pig a pig!Remember the sum oftwice the sum ofa big cat a cat the cube ofa big big cat!Remember me!Remember you!Remember you!Remember the sum ofthe sum ofyou a big big pig a pig!Remember the sum ofthe cube ofa big big cat a big cat!Remember me!Remember me!Remember you!Remember you!Remember the sum ofthe sum ofyou a big big big big pig a pig!Remember the sum oftwice the sum ofa big cat a cat the cube ofa big big cat!Remember me!Remember me!Puck:You cat!Open heart!Recall!Speak thy!You big cat!Open heart!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!You big big cat!Open heart!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!You is the sum ofa big big big cat a pig!Open heart!Recall!Speak thy!You big big big cat!Open heart!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!You cat!Open heart!Open heart!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!You is the sum ofthe sum ofa big cat a cat you!Open heart!Recall!Speak thy!You is the sum ofyou a big big cat!Open heart!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!You big big big big cat!Open heart!Recall!Speak thy!You is the sum ofa big big big big cat a cat!Open heart!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!You cat!Open heart!You is the sum ofa big big big cat a cat!Open heart!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!You big cat!Open heart!Open heart!Recall!Speak thy!You big cat!Open heart!You is the sum ofyou a cat!Open heart!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!You big cat!Open heart!You is twice the sum ofyou a cat!Open heart!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!You is twice the sum ofyou a big big cat!Open heart!Recall!Speak thy!You big cat!Open heart!You is the sum ofa big big big cat a cat!Open heart!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!You is the sum ofa big cat a cat!Open heart!You cat!Open heart!Recall!Speak thy!You big big big big big cat!Open heart!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!You is twice the sum ofa big big big big cat a cat!Open heart!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!You is the sum oftwice twice the sum ofa big big big cat a cat a cat!Open heart!Recall!Speak thy!You is twice the sum oftwice the sum ofa big big big cat a cat a cat!Open heart!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!You big big cat!Open heart!You cat!Open heart!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!You big big cat!Open heart!You is the sum ofyou a pig!Open heart!Recall!Speak thy!You big big cat!Open heart!Open heart!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!You big big cat!Open heart!You is the sum ofyou a big cat!Open heart!Recall!Speak thy!You big big cat!Open heart!You is the sum oftwice you a pig!Open heart!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!You is the square ofthe sum ofa big big big cat a pig!Open heart!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!You is the sum ofa big big cat a cat!Open heart!You big cat!Open heart!Recall!Speak thy!You is the sum oftwice the sum ofthe factorial ofa big big cat a big cat a cat!Open heart!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!You is twice twice the sum ofyou a big big cat!Open heart!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!You is the sum ofa big big cat a cat!Open heart!You big big big cat!Open heart!Recall!Speak thy!You is the sum ofa big big cat a cat!Open heart!You is the sum ofyou a big big cat!Open heart!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!You is twice the sum ofa big cat a cat!Open heart!You cat!Open heart!Recall!Speak thy!You is the sum ofthe cube ofa big big cat a big pig!Open heart!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!You is the cube ofa big big cat!Open heart!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!You is the sum ofthe sum ofthe cube ofa big big cat a big cat a cat!Open heart!Recall!Speak thy!You is the sum ofthe cube ofa big big cat a big big cat!Open heart!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!You is the sum ofa big big big cat a pig!Open heart!You cat!Open heart!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!You is the sum oftwice the square oftwice the sum ofa big cat a cat a cat!Open heart!Recall!Speak thy!You is the sum oftwice the square oftwice the sum ofa big cat a cat a big cat!Open heart!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!You is the sum oftwice the square oftwice the sum ofa big cat a cat a big big cat!Open heart!Recall!Speak thy!You is the sum ofa big big big cat a pig!Open heart!Open heart!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!You is the sum ofa big big big cat a pig!Open heart!You is the sum ofyou a big cat!Open heart!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!You big big big cat!Open heart!You big cat!Open heart!Recall!Speak thy!You big big big cat!Open heart!You is the sum ofa big cat a cat!Open heart!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!You big big big cat!Open heart!You is the sum ofyou a big pig!Open heart!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!You big big big cat!Open heart!Open heart!Recall!Speak thy!You big big big cat!Open heart!You is the sum ofyou a cat!Open heart!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!You is the sum ofa big big big cat a cat!Open heart!You cat!Open heart!Recall!Speak thy!You is the sum ofa big big big cat a cat!Open heart!You big cat!Open heart!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!You is the sum ofa big big big cat a cat!Open heart!You big big cat!Open heart!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!Recall!Speak thy!You is the sum ofa big big big cat a cat!Open heart!You is the sum ofyou a big pig!Open heart!Recall!Speak thy!You is the sum ofthe square ofyou a big pig!Open heart!Ajax:You is the sum oftwice the sum ofa big big cat a cat a cat!Scene L:.Puck:Recall!Speak thy!Ajax:You is the sum ofyou a pig!Be you nicer a cat?If soLet usScene L!

Works by adding the FizzBuzz line breaks and words to the stack (in reverse) for the first 90, adds the last 10 lines, then goes through and prints all the numbers and words by recalling the stack at specific times. SPL doesn't support division so this is the shortest method I could think of, short of subtracting numbers and checking if they... equal... zero...

Oh god, I've gotta go golf more. I'm leaving this here as a mark that I've done something, though.

Try it online!

Why does this post require moderator attention?
You might want to add some details to your flag.

0 comments

+2
−0

JavaScript (Node.js), 64 bytes

for(n=0;101>++n;)console.log([['Fizz'][n%3]]+[['Buzz'][n%5]]||n)

Try it online!

Why does this post require moderator attention?
You might want to add some details to your flag.

0 comments

+2
−0

Japt -R, 28 bytes

Lõ@"Fizz"pXv3)+"Buzz"pXv5)ªX

I spent a long time playing with wizardry string/array slicing. It did not work out. This solution just repeats "Fizz" and "Buzz" if divisible.

Test it

Why does this post require moderator attention?
You might want to add some details to your flag.

2 comments

@Shaggy is a genius, that is so far from my answer I'll let him post it Quintec‭ about 2 months ago

+2
−0

RoadLang, 340 bytes

wagwan my slime
x is 0
rip dat bong till x bigger den 99 n dat
x is x n 1
ayy bossman (x leftova 15) be 0 init bruv
man say"FizzBuzz"
yeah init bruv
ayy bossman (x leftova 5) be 0 init bruv
man say"Buzz"
yeah init bruv 
ayy bossman (x leftova 3) be 0 init bruv
man say"Fizz"
yeah init bruv 
man say x
yeah
yeah
yeah
mmm
chat wit u later fam

Make sure you rip dat bong dis christmas eve!

Here's a more slimy answer:

wagwan my slime
I is nuttin
rip dat bong till I bigger den 99 n dat
	I is I n bar
	ayy bossman (I leftova (beehive x bender ova bice) ) be 0 init bruv
		man say "FizzBuzz"
	yeah init bruv
		ayy bossman (I leftova beehive) be nuttin init bruv
			man say "Buzz"
		yeah init bruv 
			ayy bossman (I leftova bender ova bice) be 0 init bruv
				man say "Fizz"
			yeah init bruv 
				man say I
			yeah
		yeah
	yeah
mmm
chat wit u later fam
Why does this post require moderator attention?
You might want to add some details to your flag.

1 comment

this language is fantastic Corsaka‭ about 1 month ago

+2
−0

C (gcc), 108 bytes

*h,i;main(){for(;i++<100;){char s[]="%dFizzBuzz ",b=i%5;h=s+2;printf(s+(i%3?b?*h=32,0:6:b?h[1]=32,2:2),i);}}

Godbolt. Works on clang too. Contains some serious abuse of all that is holy: gcc extensions, misaligned writes, endianess, poorly-defined behavior...

Newline instead of space, 109 bytes:

*h,i;main(){for(;i++<100;){char s[]="%dFizzBuzz\n",b=i%5;h=s+2;printf(s+(i%3?b?*h=10,0:6:b?h[1]=10,2:2),i);}}

I'm a rookie at code golf so this could probably be improved a lot.


Explanation:

The whole code is based on a local string s which is refreshed at each lap of the loop.

Basically the whole expression is a big if-else written with ?:, designed to return a pointer offset to the string as result.

  • In case a normal number should be printed, a space and null terminator is inserted after %d.
  • In case FizzBuzz should be printed, the array offset is increased with pointer arithmetic to start from Fizz.
  • In case only 'Fizz' should be printed, a space + null terminator is inserted after Fizz.
  • In case only 'Buzz' should be printed, the array offset is increased with pointer arithmetic.

Space + null terminator is written by a lvalue access of int through h to the string, which is both a strict aliasing violation, a misaligned access and endianess reliance all at once. The raw data of 0x00000020 is written into the string, little endian meaning that 0x20 ends up in ls byte and then a 0x00 byte after that, forming a null terminator.

printf is abused by getting passed an additional parameter i whether or not the format string contains any conversion specifier.

gcc extensions abused:

  • implicit int
  • main() form and no return 0 in case of C90.
  • no #include
  • incompatible pointer conversion from char* to int*.
  • Dodging strict pointer aliasing
Why does this post require moderator attention?
You might want to add some details to your flag.

0 comments

+1
−0

Canvas, 24 bytes

zz+¹┘%!*
‾U{ŗ3Fi⁸5Bu⁸+nO

Try it here!

Explanation (ASCII-fied for better monospacing):

zz+¹┘%!*  Helper function ⁸; Expects stack to be [modulo, string]
zz+       append "zz" to the string
   ¹      push the current loop index
    ┘     retrieve the modulo
     %    calculate the modulo
      !   negate (i.e. is-divisible)
       *  repeat the string vertically that many times

‾U{ŗ3Fi⁸5Bu⁸+nO  Main program
‾U{              Repeat 100 times, pushing index & writing it to ¹
   ŗ             stringify the pushed index
    3Fi⁸         invoke ⁸ on [3; "Fi"]
        5Bu⁸     invoke ⁸ on [5; "Bu"]
            +    join the two results
             n   overlap that over the index; this works as the maximum index, 100, is less than 4 characters
              O  output that
Why does this post require moderator attention?
You might want to add some details to your flag.

0 comments

+1
−0

Vyxal, jM, 18 bytes

Ĥƛ3œıƆĿ*n5œıŧĤ*+n⟇

Explained

Ĥƛ3œıƆĿ*n5œıŧĤ*+n⟇

Ĥ                      # Push the number 100
 ƛ                     # Start a lambda map doing the following over the range [1, 100]: (it would usually map over [0,99] but the M flag makes the lambda increase the start and end of that range)
  3œ                   #   Find the divisibility of the argument by 3 AND
    ıƆĿ                #   Push the compressed string "Fizz" AND
       *               #    Multiply the two together THEN
        n5œ            #   Find the divisibility of the argument by 5 AND
           ıŧĤ         #   Push the compressed string "Buzz" AND
              *        #   Multiply the two together THEN
               +       #   Add the two multiplied strings together THEN
                n⟇     #   Short-circuit OR the string and the argument.
                       # The `j` flag automatically joins with newlines
Why does this post require moderator attention?
You might want to add some details to your flag.

0 comments

Sign up to answer this question »

This community is part of the Codidact network. We have other communities too — take a look!

You can also join us in chat!

Want to advertise this community? Use our templates!