# Obfuscated FizzBuzz Golf [closed]

Create the shortest possible obfuscated FizzBuzz implementation.

To be considered obfuscated, it should satisfy at least one of the following:

1. Does not contain any of the words "Fizz", "Buzz", or "FizzBuzz"
2. Does not contain the numbers 3, 5, or 15.
3. Use any of the above in a misleading way.

Remember: The goal is to be short and hard to follow.

The code sample which inspired this question follows:

public class Default
{
enum FizzBuzz
{
Buzz = 1,
Fizz,
FizzBuzz
}
public static void Main(string[] args)
{
byte[] foo =
Convert.FromBase64String("IAmGMEiCIQySYAiDJBjCIAmGMEiCIQySYA==");
MemoryStream ms = new MemoryStream(foo);
byte[] myByte = new byte[1];
do
{
FizzBuzz fb;
for (int i = 0; i < 4; i++)
{
fb = (FizzBuzz)(myByte[0] >> (2 * i)
& (int)FizzBuzz.FizzBuzz);
Console.Out.WriteLine( (((int)fb > 0) ? "" + fb : ""
+ ((ms.Position - 1) * 4 + i + 1)));
}
} while (ms.Position < ms.Length);
}
}

• How do you know the bound ? In your solution you have ms.Length but in some solutions there is no such bound...
– Labo
Nov 10, 2015 at 9:20
• I'm voting to close this question as off-topic because it does not have an objective validity criterion, making it impossible to indisputably decide whether a submission follows the rules. Sep 20, 2016 at 21:49

## Javascript 97 chars - no numbers at all

Numbers ? Who needs number when you have Javascript !

a=b=!![]+![],a--,c=b+b;while(++a)e=!(a%(c+c+b)),alert(!(a%(c+b))?e?"FizzBuzz":"Fizz":e?"Buzz":a);


Note: There is an infinite loop that will alert you the sequence.

Bonus (666 chars)

• No number
• No letter (only zfor has been use in the whole script)

.

_=$=+!![];$__=((_$={})+'')[_+$+_+$+_];__$=((![])+'')[$];_$_=((_$={})+'') [_+$+_+$+_+$];____=[][$__+((_$={})+'')[$]+(($)/(![])+'')[$]+$__+__$+_$_];$__$=(!![]+"")
[$+$+$]+([][(![]+"")[$+$+$]+(+[]+{})[$+$]+(!![]+"")[$]+(!![]+"")[+[]]]+"")[($+$)+""+ ($+$+$)]+(![]+"")[$]+(![]+"")[$+$];$_$_=____()[$-$][$__$]("\"\\"+($)+($+$+$+$+$+$+$)+ ($+$)+"\"");_$=(![]+'')[$-$]+([][[]]+[])[$+$+$+$+$]+$_$_+$_$_;$_=(_+{})[$+$+$]+(!![]+'') [_+$]+$_$_+$_$_;_--,$$=+;____()[-][__]((![]+"")[+[]]+(+[]+{})[+]+(!![]+"")[]+ "(;++_;)$$$=!(_%("+($$+$$+$)+")),____()[+[]][__$+((![])+'')["+($+$)+"]+((!![])+'')["+ ($+$+$)+"]+((!![])+'')[+!![]]+_$_](!(_%("+($$+)+"))?$$$?_$+$_:_$:$?$_:_);");  • Real programmers code just like the second one. – user11 Jan 29, 2011 at 11:57 • @M28: Yep. That's one way to build job security...'cause finding someone who can maintain this code wouldn't be the easiest thing. – Andy Feb 2, 2011 at 5:07 • You can use window["eval"]('"\\'+1+7+2+'"') for z. – Nabb Feb 3, 2011 at 2:25 • @stevether It's mostly about abusing type conversion (ex.: +!![] is the same as 1 and ({}+"")[5] is the same as c) and abusing array notation to access method (ex.: window['eval']( is the same eval( ). Aug 19, 2012 at 5:06 • Appropriate character count if I've ever seen one. Jan 3, 2013 at 20:31 ## GolfScript, 75696560 59 chars 100,{)6,{.(&},{1$1$%{;}{4*35+6875*25base{90\-}%}if}%\or}%n*  So, you'd think GolfScript by itself is already obfuscated, right? Well, just to follow the spec, I decided to have the program not contain "fizz", "buzz", nor the numbers 3, 5, nor 15. :-) Yes, there are some numbers with multiples of 5, like 25, 35, 90, 100, and 6875. Are they red herrings? You decide. ;-) • Although I've written commentary for all my other GolfScript submissions, none will be forthcoming for this one. Rationale: chat.stackexchange.com/transcript/message/436819#436819 :-D Jan 31, 2011 at 4:34 • The numbers 3 and 5 appear in your code, so it is not correct !!! – Labo Nov 10, 2015 at 19:12 • @Labo Only one of the criteria needs to be satisfied, not all three. Read the question again. :-) Nov 10, 2015 at 20:39 • Is it a JOKE ? I spend several hours on that ! Though I still managed to have a 58 chars long Python code :p codegolf.stackexchange.com/a/63543/47040 – Labo Nov 10, 2015 at 20:57 • @Labo: I can see the digits 3 and 5 but not the numbers 3 and 5. Jan 27, 2016 at 0:30 ## Python - 78 chars i=0 while 1:i+=1;print"".join("BzuzzizF"[::2*j]for j in(-1,1)if 1>i%(4+j))or i  • Took me 10 minutes to understand what you did there. Nice and twisted. Jun 8, 2011 at 15:04 # PostScript, 96 bytes So obfuscated it looks like random garbage. 1<~0o0@eOuP7\C+tf6HS7j&H?t<0f>,/0TnSG01KZ%H9ub#H@9L>I=%,:23M].P!+.F6?RU#I;*;AP#XYnP"5~>cvx exec  Usage: $ gs -q -dNODISPLAY -dNOPROMPT file.ps

• I bet that passes diehard.
– kaoD
Feb 6, 2013 at 4:27

## C++: 886 chars

I've tried to hide the 'fizz' and the 'buzz'. Can you spot them?

#include <iostream>
#define d(a,b) a b
#define _(a,b) d(#b,#a)
#define b(b) _(b,b)
#define y _(i,f)c
#define x _(u,b)c
#define c b(z)
#define i int
#define p main
#define s char
#define q 810092048
#define h for
#define m 48
#define a ++
#define e ==
#define g 58
#define n 49
#define l <<
#define oe std::cout<<
#define v '\n'

int  p   (i,  s*t     ){i   j  =   q;h   (*(
i    *     )    t     =  m  ;  2     [     t
]?   0    :    1      ??(   t  ]    ?     a
1    [   t    ]       e  g  ?  1   [     t
]    =   48,  ++0     ??(    t]e   g?0   ??(

t]=  n   ,1[  t]=
2    [     t    ]
=m   :    1    :
1    :   a    0
[    t   ??)  ==g

?0[   t  ]   =49   ,1[
t  ]  =  m     :     1
;j=   (  j    /     4
)  |  (  (   j     &
3)l    28)   )oe   (j&

3?j  &   1?j  &2?
y    x     :    y
:x   :    t    )
l    v   ;    }
i    f   =m&  ~g;

• That confuzzlesing my brane. Mar 11, 2011 at 3:17
• I think you meant membrane Dec 14, 2011 at 22:34

## DC (256 255 bytes)

Here it is, I tried (rather successfully, if I may say so myself) to hide anything except for letters, and +-[];:= (which are vital and impossible to obfuscate). It does segfault after getting to about 8482 or so on my machine, but that is to do with stack issues related to the way the recursion is implemented. The solution itself is correct. 255 bytes if you remove the whitespace (included for ease of reading) Enjoy:

Izzzdsa+dsbrsc+dsdd+sozdsezzsm+s
nloddd++splbz++ddaso+dln-dstsqlm
d+-sr[PPPP]ss[IP]su[lpdlqlrlsxlu
x]lm:f[lpdltdI+lm+rlblm+-lsxlux]
ln:f[[]sulm;fxln;f[IP]sux]la:f[;
fsk]sg[lmlgx]sh[lnlgx]si[lalgx]s
j[lc[lcp]sklerldlolclerlblolcler
lalox=hx=ix=jlkxclcz+scllx]dslx


This was a bit tricky to embed using the indentation so a gist:

# Ruby, 4312 chars

https://gist.github.com/dzucconi/1f88a6dffa2f145f370f

eval("

".split(/\n/).map(&:size).pack("C*"))

• How does this even work? Jun 22, 2016 at 14:57
• ._. How this thing work... Jun 26, 2016 at 10:15
• "string of your program".unpack("C*").map { |x| " " * x }.join("\n")
– dzuc
Jun 26, 2016 at 14:14

## Brainfuck - 626 656

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


Goes from 1 to 255

• Turns out this actually does BuzzFizz. It gets FizzBuzz correct for %15, but it swaps %3 and %5. I may try to fix it, but for now my brain is officially F'ed Dec 15, 2011 at 23:32
• Fixed at cost of 30. Could have golfed it more with effort, but I have already wasted enough time on this. Dec 15, 2011 at 23:36
• "waste" is a strong word ... Aug 22, 2014 at 23:00

Brainfuck, 708 characters

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


Description of how it works is available in my Code Review question

## Haskell - 147142 138 characters

fi=zz.bu
bu=zz.(:).(++"zz")
[]#zz=zz;zz#__=zz
zZ%zz=zZ zz$zZ%zz zz=(([[],[]]++).) z=zipWith3(((#).).(++))(bu%"Fi")(fi%"Bu")$map show[1..]


The code is 19 characters longer than it needs to be, but I thought the aesthetics were worth it! I believe all three "objectives" are satisfied.

> take 20 z
["1","2","Fizz","4","Buzz","Fizz","7","8","Fizz","Buzz","11","Fizz","13","14",
"FizzBuzz","16","17","Fizz","19","Buzz"]

• Hi, I try to get to understand your code, but I am unable to run it! The function zZ' is applied to six arguments, but its type (a0 -> b0 -> c0) -> [a0] -> [b0] -> [c0]' has only three Jan 31, 2013 at 20:07
• And I, while being able to run it, only get ["1","2","3","4","5","6"...]. Feb 1, 2013 at 18:14
• Fixed - The right version was still on my disk... must have mis-pasted the text long ago! Feb 5, 2013 at 4:52
• please specify how can it be shortened by 19 characters, or show the code. i am curious and i have no idea Jul 18, 2014 at 15:31
• There are 19 occurrances of 2 letter names: bu, fi, zz, and zZ. These could be shortened to one letter names. Jul 19, 2014 at 1:17

# 𝔼𝕊𝕄𝕚𝕟, 33 chars / 92 bytes (noncompetitive)

ѨŃ(1,ṥ)ć⇀ᵖɘƃ႖סР깜 #ē($%3⅋4,$%5?4:8)⋎$⸩  Try it here (Firefox only). This language is way too OP for restricted source challenges. # Javascript, 469 bytes This was probably the most fun I've ever had. z=0;_=(function(){b=0;window[0xA95ED.toString(36)]((function(){yay="&F bottles of beer on the wall, &F bottles of beer. Take one down, pass it around, &z Bottles of beer on the wall.";return atob("eisrOyAg") + "console.log(((function(y){if((y%0xf)==0){return [1,72,84,84,86,78,84,84]}else if(y%0b11==0){return [1,72,84,84]}else if(y%0b101==0){return [86,78,84,84]}else{b=1;return [y]}})(z).map(function(x){return b==0?yay[x]:x}) ).join(''))"})())});setInterval(_,1000);  Try it here • Dang, I just realized that the objective was to be short and hard to follow... Sorry :P Nov 2, 2015 at 23:55 • +1 Might have missed on the shortness, but at least you didn't have fizz buzz in there Nov 3, 2015 at 0:00 ## Ruby - 165 characters (1..100).each{|i|i%0xF==0? puts(["46697A7A42757A7A"].pack("H*")):i%(0xD-0xA)==0? puts(["46697A7A"].pack("H*")):i%(0xF-0xA)==0? puts(["42757A7A"].pack("H*")):puts(i)}  This was my first attempt at code golf. I had a lot of fun. =) # Perl 6 (52 bytes) say "Fizz"x$_%%(2+1)~"Buzz"x$_%%(4+1)||$_ for 1..100


Let me put an explanation here. It's the worst rule abuse I've done in such task. I know what you are saying - there is obvious Fizz and Buzz here. But let's take a look at the rules.

To be considered obfuscated, it should satisfy at least one of the following:

This avoids 3, 5 and 15. Therefore, it's valid and really short solution.

## Scala, 295 characters

object F extends Application{var(f,i,z)=("",('z'/'z'),"FBiuzzzz");while(i<(-'b'+'u'+'z'/'z')*('¥'/'!')){if(i%(-'f'+'i'/('z'/'z'))==0)f+=z.sliding(1,2).mkString;if(i%((-'b'+'u'+'z'/'z')/('f'/'f'+'i'/'i'+'z'/'z'+'z'/'z'))==0)f+=z.drop(1).sliding(1,2).mkString;if(f=="")f+=i;println(f);i+=1;f="";}}


# C (237 209 characters)

#include<stdlib.h>
#define e printf
a=50358598,b=83916098,c=1862302330;_(m,n){return(m%((c&n)>>24))
||!(e(&n)|e(&c));}main(_);(*__[])(_)={main,exit};main(i){_(i,a)
&_(i,b)&&e("%i",i);e("\n");__[i>=100](++i);}


Though I'm not sure this conforms to the C standard :)
It works, though. On Linux using GCC, that is.

# Python 3 - 338

import sys
def fibu():
(F,I,B,U),i,u,z=sys._getframe(0).f_code.co_name,0xf,0xb,lambda x,y:x%((i//u)+(i^u))==u>>i if y>u else x%(((u<<(u>>2))&i)>>(u>>2))==i>>u
A,RP = "",chr(ord(U)+((i//u)+(i^u)))*2
for x in range(100):print(x if not (z(x,u)or z(x,i))else A.join((F+I+RP if z(x,u)else A,B+U+RP if z(x,i)else A)))
fibu()


This is my first golf. Not the shortest, but it's pretty ugly! None of the forbidden numbers or string literals. Firp, Burp!

# Python - 157

from itertools import cycle as r
c=str.replace
[c(c(c(z+y,'x','fix'),'y','bux'),'x','zz').strip() or x for z,y,x in zip(r('  y'),r('    x'),range(1,101))]


Not quite the shortest, but I hope the reader will appreciate the pure functional style and extensibility to arbitrarily long counts.

# K, 155

{m:{x-y*x div y};s:{"c"$(10-!#x)+"i"$x};$[&/0=m[x]'(2+"I"$"c"$49;4+"I"$"c"$49);s"<rs<pvw";0=m[x;2+"I"$"c"$49];s"<rs";0=m[x;4+"I"$"c"$49];s"8lrs";x]}'!100  I could golf it quite a bit but I'd rather it be more obfuscated. # JavaScript 111 chars - no key numbers a=b=c=0;while(a++<99)document.write((b>1?(b=0,"Fizz"):(b++,""))+(c==4?(c=0,"Buzz"):(c++,""))+(b*c?a:"")+"<br>") ## C# - 218 characters using System;class D{static void Main(){int l,i,O=1;l++;string c="zz",a="fi",b="bu";l++;l++;i=l;i++;i++;for(;O<101;O++)Console.WriteLine(((O%l)>0&&1>(O%i))?a+c:(1>(O%l)&&(O%i)>0)?b+c:(1>(O%l)&&1>(O%i))?a+c+b+c:O+"");}}  Could be shortened if I introduced other numbers like so: (210 characters total) using System;class D{static void Main(){int l=1,i,O=1;string c="zz",a="fi",b="bu";l+=2;i=l;i+=2;for(;O<101;O++)Console.WriteLine(((O%l)>0&&1>(O%i))?a+c:(1>(O%l)&&(O%i)>0)?b+c:(1>(O%l)&&1>(O%i))?a+c+b+c:O+"");}}  Decided to remove the obvious word fizz and buzz and go for slightly more obfuscation. Second one is shorter than the first one but is slightly more direct on what's occurring in the addition. This isn't exactly golfed, its about 120 lines. I thought I'd do something that took advantage of all the fun potential for undefined behavior with C++ memory management. #include <iostream> #include <string> using namespace std; class Weh; class HelloWorld; class Weh { public: string value1; string value2; void (*method)(void * obj); Weh(); string getV1(); static void doNothing(void * obj); }; class HelloWorld { public: static const int FOO = 1; static const int BAR = 2; static const int BAZ = 4; static const int WUG = 8; string hello; string world; void (*doHello)(HelloWorld * obj); HelloWorld(); void * operator new(size_t size); void tower(int i); const char * doTower(int i, int j, int k); static void doHe1lo(HelloWorld * obj); }; Weh::Weh() { method = &doNothing; } void Weh::doNothing(void * obj) { string s = ((Weh *) obj)->getV1(); ((HelloWorld *) obj)->tower(1); } string Weh::getV1() { value1[0] += 'h' - 'j' - 32; value1[1] += 'k' - 'g'; value1[2] += 'u' - 'g'; value1[3] = value1[2]; value2 = value1 = value1.substr(0, 4); value2[0] += 'd' - 'h'; value2[1] += 'w' - 'k'; value2[2] = value1[2]; value2[3] = value1[3]; return "hello"; } void * HelloWorld::operator new(size_t size) { return (void *) new Weh; } HelloWorld::HelloWorld() { hello = "hello"; world = "world"; } void HelloWorld::doHe1lo(HelloWorld * obj) { cout << obj->hello << " " << obj->world << "!" << endl; } void HelloWorld::tower(int i) { doTower(0, 0, i); tower(i + (FOO | BAR | BAZ | WUG)); } const char * HelloWorld::doTower(int i, int j, int k) { static const char * NOTHING = ""; int hello = BAR; int world = BAZ; int helloworld = FOO | BAR | BAZ | WUG; if ((hello & i) && (world & j)) cout << this->hello << this->world << endl; else if (hello & i) { cout << this->hello << endl; cout << doTower(0, j + 1, k + 1); } else if (world & j) { cout << this->world << endl; cout << doTower(i + 1, 0, k + 1); } else { cout << k << endl; cout << doTower(i + 1, j + 1, k + 1); } return NOTHING; } int main() { HelloWorld * h = new HelloWorld; h->doHello(h); }  # Ruby - 89 chars puts (0..99).map{|i|srand(1781773465)if(i%15==0);[i+1,"Fizz","Buzz","FizzBuzz"][rand(4)]}  I can't take credit for this piece of brilliance, but I couldn't leave this question without my favorite obfuscated implementation :) The implementation above was written by David Brady and is from the fizzbuzz ruby gem. Here is the explanation from the source code: Uses the fact that seed 1781773465 in Ruby's rand will generate the 15-digit sequence that repeats in the FizzBuzz progression. The premise here is that we want to cleverly trick rand into delivering a predictable sequence. (It is interesting to note that we don't actually gain a reduction in information size. The 15-digit sequence can be encoded as bit pairs and stored in a 30-bit number. Since 1781773465 requires 31 bits of storage, our cleverness has actually cost us a bit of storage efficiency. BUT THAT'S NOT THE POINT! # Ruby - 87 chars puts (0..99).map{|i|srand(46308667)if(i%15==0);["FizzBuzz","Buzz",i+1,"Fizz"][rand(4)]}  Here's a different version which uses a shorter seed but the lookup table is in a different order. Here is the explanation from the source code: The first implementation (89 chars) adheres to the specific ordering of 0=int, 1=Fizz, 2=Buzz, 3=FizzBuzz. It may be possible to find a smaller key if the ordering is changed. There are 24 possible permutations. If we assume that the permutations are evenly distributed throughout 2*31 space, and about a 50% probability that this one is "about halfway through", then we can assume with a decent confidence (say 20-50%) that there is a key somewhere around 1.4e+9 (below 2*28). It's not much gain but it DOES demonstrate leveraging rand's predefined sequence to "hide" 30 bits of information in less that 30 bits of space. Result: The permutation [3,2,0,1] appears at seed 46308667, which can be stored in 26 bits. • very sweet, but does contain a literal "Fizz", "Buzz" etc so not valid according to the rules Jun 28, 2014 at 20:05 # Python, 1 line, 376 characters pep8-E501 ignored. Only works in python3. print(*((lambda x=x: ''.join(chr(c) for c in (102, 105)) + (2 * chr(122)) + ''.join(chr(c) for c in (98, 117)) + (2 * chr(122)) + '\n' if x % (30 >> 1) == 0 else ''.join(chr(c) for c in (102, 105)) + (2 * chr(122)) + '\n' if x % (6 >> 1) == 0 else ''.join(chr(c) for c in (98, 117)) + (2 * chr(122)) + '\n' if x % (10 >> 1) == 0 else str(x) + '\n')() for x in range(1, 101)))  Alternative Ruby (126 characters) (1..100).map{|i|(x="\xF\3\5\1Rml6ekJ1eno=".unpack('C4m'))[-1]=~/(.*)(B.*)/ [*$~,i].zip(x).map{|o,d|i%d>0||(break $><<o<<?\n)}}  Short and obscure, just how we like it. The 3 and the 5 are actually in there but not as integer literals so I think that still counts. Note that the this is the shortest Ruby version without literal 'Fizz', 'Buzz', 'FizzBuzz' on here. ## Python 2 - 54 chars i=0 while 1:i+=1;print'FizzBuzz'[i%~2&4:12&8+i%~4]or i  ## Python 3 - 56 chars i=0 while 1:i+=1;print('FizzBuzz'[i%~2&4:12&8+i%~4]or i)  If you do not want 'FizzBuzz' to appear : ## Python 2 - 58 chars i=0 while 1:i+=1;print' zzuBzziF'[12&8+i%~2:i%~4&4:-1]or i  ## Python 3 - 60 chars i=0 while 1:i+=1;print(' zzuBzziF'[12&8+i%~2:i%~4&4:-1]or i)  Or how to beat GolfScript with Python ;) • The first two seem to do nothing, since i=0 means the while loop is never entered. – xnor Nov 10, 2015 at 21:45 • Lol I used my test version, in which the condition is i<20. – Labo Nov 10, 2015 at 21:53 • But now it works :) – Labo Nov 10, 2015 at 22:39 • Shouldn't it stop at 100 according to the original FizzBuzz problem? Jan 27, 2016 at 0:33 Squeak (4.4) Smalltalk 206 bytes |f i zz b u z|z:=''.b:=28r1J8D0LK. 1to:100do:[:o|0<(f:=(i:=(zz:=b\\4)//2*4)+(u:=zz\\2*4))or:[z:=z,o].b:=zz<<28+(b//4).z:=z,((z first:f)replaceFrom:1to:f with:28r1A041FHQIC7EJI>>(4-i*u*2)startingAt:1),' '].z  Or same algorithm with less explicit messages, same number of characters |l f i zz b u z|z:=#[].b:=36rDEB30W. 1to:100do:[:o|0<(f:=(i:=(zz:=b\\4)//2)+(u:=zz\\2)*4)or:[z:=z,('',o)].b:=zz<<28+(b//4).l:=36r2JUQE92ONA>>(1-u*i*24).1to:f do:[:k|z:=z,{l-((l:=l>>6)-1<<6)}].z:=z,' '].'',z  My apologizes to Alan Kay for what I did to Smalltalk. Some of these hacks are portable across Smalltalk dialects, some would require a Squeak compatibility layer... Note that if you execute in a Workspace, you can omit declarations |f i zz b u z| and gain 14 characters. If we can afford 357 characters (315 with single letter vars), then it's better to avoid trivial #to:do: loop: |fizz buzz if f fi zz b u bu z|f:=fizz:=buzz:=0.z:=#[].b:=814090528.if:=[:i|i=0or:[fi:=28.zz:=27<<7+i.u:=26.(fizz:=[zz=0or:[z:=z,{(u:=u//2)\\2+1+(zz+((fi:=fi//2)\\2+2-(zz:=zz//8)*8)*4)}.fizz value]])value]].(buzz:=[(f:=f+1)>100or:[(fi:=(zz:=b\\4)//2*17)+(bu:=zz\\2*40)>0or:[z:=z,('',f)].b:=zz<<28+(b//4).if value:fi;value:bu.z:=z,' '.buzz value]])value.'',z  ## Haskell 226 bytes, including the whitespace for layout ;) z=[fI$ (++)            \
(fi zz 1 "Fi" )        \
(fi zz 2 "Bu" )        \
:[show zz]  | zz<-[1..]]
fI (zZ:zz)  | zZ==[]   \
= concat zz | 1==1=zZ
fi zZ bu zz | zZ%bu=   \
(zz++"zz")  | 1==1=[]
bu%zz=mod bu (zz*2+1)==0


The 'real' code is 160 bytes and can be compressed, but loses fizz-buzz-ness then.

Run it (for nice output):

putStrLn (unwords (take 20 z ))


Output:

1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz 16 17 Fizz 19 Buzz


# Perl

use MIME::Base64;print map{map{(++$i,'Fizz','Buzz','FizzBuzz')[$_]."\n"}(3&ord,3&ord>>2,3&ord>>4,3&ord>>6)}split//,decode_base64"EAZJMIRBEgxhkARDGCTBEAZJMIRBEgxhkA"


One I made in 2009. It's pretty easy to figure out, though.

Edit: Darn, it uses "Fizz" and "Buzz!" :( I thought I changed that. Nevermind then.

# C 216 bytes

#define t(b) putchar(p+=b);
main(p,v,c){p=70;for(v=c=1;v<=p*2-40&&!(c=0);++v){if(!(v%(p/23))){t(0)t(35)t(17)t(0)++c;}if(!(v%(p/(14+c*9)))){t(-56+!c*52)t(51)t(5)t(0);++c;}if(c){t(-112)p+=60;}else printf("%i\n",v);}}
`