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

Return to Answer

Commonmark migration
Source Link

##Seriously , 36 bytes

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.

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

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.

deleted 27 characters in body
Source Link
user45941
user45941

##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 Try it online.

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

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

deleted 8 characters in body
Source Link
user45941
user45941

##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 Try it online.

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

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

updated with 10**a function, fixed explanation
Source Link
user45941
user45941
Loading
added 5 characters in body
Source Link
user45941
user45941
Loading
online interpreter permalink
Source Link
user45941
user45941
Loading
added 101 characters in body
Source Link
user45941
user45941
Loading
Source Link
user45941
user45941
Loading

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