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
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Comments on 1, 2, Fizz, 4, Buzz!

Parent

1, 2, Fizz, 4, Buzz!

+9
−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.
History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

General comments (7 comments)
Post
+3
−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!

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

1 comment thread

Another way might be to keep two counters, and output Fizz/Buzz when they reach 3/5 (and then reset t... (1 comment)
Another way might be to keep two counters, and output Fizz/Buzz when they reach 3/5 (and then reset t...
Jo King‭ wrote almost 3 years ago

Another way might be to keep two counters, and output Fizz/Buzz when they reach 3/5 (and then reset them)