the shortest I could do is 72 characters in PHP. I have no idea how they can do 56.
<? while(++$i<101)echo $i%15?$i%5?$i%3?$i:'Fizz':'Buzz':'FizzBuzz',"\n"; <? while(++$i<101)echo $i%15?$i%5?$i%3?$i:'Fizz':'Buzz':'FizzBuzz',"\n";The comments on the RapLeaf blog post I linked to in this thread has a guy trying out different Ruby solutions. Very clever!
PHP does not require a closing ?>
That shortcut is a result of hyper-optimization and I was thinking more along the lines of code-reusability (e.g. if the rules of FizzBuzz were changed from %3 and %5 to %x and %y) =P
for i in range(1,101):
if i%15==0:print'FizzBuzz'
elif i%3==0:print'Fizz'
elif i%5==0:print'Buzz'
else:print i
Now I am on the hunt to figure out how to do it in 56, there goes my afternoon. for x in range(1,101):print'Fizz'*(x%3==0)+'Buzz'*(x%5==0)or x
Off by 6 bytes!