# Smallest FizzBuzz program

**URL:** <https://www.ruby-forum.com/t/smallest-fizzbuzz-program/87441>\
**Category:** Ruby\
**Created:** [March 2, 2007, 5:10pm UTC](https://www.ruby-forum.com/t/smallest-fizzbuzz-program/87441 "2007-03-02T17:10:47Z")\
**Posts on this page:** 13\
**Page:** 2

<div class="post-metadata">

**Author:** ![zakifataya](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/c89c15/32.png) [@zakifataya](https://www.ruby-forum.com/u/zakifataya)\
**Post date:** [March 3, 2007, 1:40am UTC](https://www.ruby-forum.com/t/smallest-fizzbuzz-program/87441/21 "2007-03-03T01:40:56Z")

</div>

On 3/3/07, Rick DeNatale [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> And here I could have sworn that I’d actually tried that very code in irb.
> 
> That’s why I’m against code golfing, rots the brain! 😉  
> That’s why I love it, nothing to lose 😉  
> But this one got on my nervers now, good night everyone!

---

<div class="post-metadata">

**Author:** ![zakifataya](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/c89c15/32.png) [@zakifataya](https://www.ruby-forum.com/u/zakifataya)\
**Post date:** [March 5, 2007, 6:50am UTC](https://www.ruby-forum.com/t/smallest-fizzbuzz-program/87441/22 "2007-03-05T06:50:34Z")

</div>

I was trying to submit to program for the prime number challenge, but I  
can’t make it work because I don’t understand how does this website do  
the  
input to the submitted programs.  
I mean that when I use ARGV or $\*, it seems these variables are empty  
(just  
submitting a test program that does a “pp ARGV” outputs an empty array).

Is there anyone who knows how can I get the input for this website ?

---

<div class="post-metadata">

**Author:** ![zakifataya](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/c89c15/32.png) [@zakifataya](https://www.ruby-forum.com/u/zakifataya)\
**Post date:** [March 3, 2007, 4:16am UTC](https://www.ruby-forum.com/t/smallest-fizzbuzz-program/87441/23 "2007-03-03T04:16:07Z")

</div>

Brian A. wrote:

> This is really bugging me. Someone posted a golf challenge to write a  
> smallest FizzBuzz program here:
> 
> [anarchy golf - FizzBuzz](http://golf.shinh.org/p.rb?FizzBuzz) (although the site was down when I  
> checked it a few minutes ago)

I submitted the resulting program to the site (which is back up now)  
under ‘comp.lang.ruby’ since multiple people contributed. Comes in at 57  
bytes - only 1 byte longer than the best. So apparently the site does  
count the EOF byte.

1.upto(?d){|i|i%3\<1&&x=:Fizz;puts i%5\<1?“#{x}Buzz”:x||i}

[http://golf.shinh.org/p.rb?FizzBuzz](http://golf.shinh.org/p.rb?FizzBuzz)

Interestingly, the following Ruby program (with a little help from sed  
that my friend passed along) comes in at exactly 56 bytes, but the test  
site rightfully failed it due to the attempt to shell the command:

puts `seq 100|sed -e'5~5s/.*/Buzz/;3~3s/^[0-9]*/Fizz/'`

---

<div class="post-metadata">

**Author:** ![zakifataya](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/c89c15/32.png) [@zakifataya](https://www.ruby-forum.com/u/zakifataya)\
**Post date:** [March 5, 2007, 5:12pm UTC](https://www.ruby-forum.com/t/smallest-fizzbuzz-program/87441/24 "2007-03-05T17:12:06Z")

</div>

On 3/5/07, Guillaume Nargeot  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I was trying to submit to program for the prime number challenge, but I  
> can’t make it work because I don’t understand how does this website do the  
> input to the submitted programs.  
> I mean that when I use ARGV or $\*, it seems these variables are empty (just  
> submitting a test program that does a “pp ARGV” outputs an empty array).
> 
> Is there anyone who knows how can I get the input for this website ?

Did you try to read from $stdin? I know that is kind of stupid to ask,  
but sometimes we do not see what is hidden in front of our eyes 🙂

Robert

---

<div class="post-metadata">

**Author:** ![zakifataya](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/c89c15/32.png) [@zakifataya](https://www.ruby-forum.com/u/zakifataya)\
**Post date:** [March 7, 2007, 3:32pm UTC](https://www.ruby-forum.com/t/smallest-fizzbuzz-program/87441/25 "2007-03-07T15:32:42Z")

</div>

On 3/7/07, Jenda K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hey! Stop this! It’s supposed to be the dreadfull scripting language  
> called Pearl that’s totally unreadable and it’s abusers waste the  
> precious time trying to beat each other by writing something in as few  
> characters as possible!

The email address simply drips irony 🙂

m.

---

<div class="post-metadata">

**Author:** ![zakifataya](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/c89c15/32.png) [@zakifataya](https://www.ruby-forum.com/u/zakifataya)\
**Post date:** [March 7, 2007, 3:24pm UTC](https://www.ruby-forum.com/t/smallest-fizzbuzz-program/87441/26 "2007-03-07T15:24:55Z")

</div>

Brian A. wrote:

> This is really bugging me. Someone posted a golf challenge to write a  
> smallest FizzBuzz program here:  
> …

Hey! Stop this! It’s supposed to be the dreadfull scripting language  
called Pearl that’s totally unreadable and it’s abusers waste the  
precious time trying to beat each other by writing something in as few  
characters as possible!

😛

Jenda

---

<div class="post-metadata">

**Author:** ![zakifataya](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/c89c15/32.png) [@zakifataya](https://www.ruby-forum.com/u/zakifataya)\
**Post date:** [March 7, 2007, 8:09pm UTC](https://www.ruby-forum.com/t/smallest-fizzbuzz-program/87441/27 "2007-03-07T20:09:42Z")

</div>

On 3/7/07, Rick DeNatale [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> And what’s pearl? I thought it was perl. What does it mean if one  
> doesn’t know how to properly spell one’s favorite language?
> 
> You could always tell who was really in the Smalltalk community or at  
> least who wasn’t when they spelled it SmallTalk.
> 
> –  
> Rick DeNatale

Oh Rick just forget him, he will become a stone in the sun.

R

---

<div class="post-metadata">

**Author:** ![zakifataya](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/c89c15/32.png) [@zakifataya](https://www.ruby-forum.com/u/zakifataya)\
**Post date:** [March 7, 2007, 8:51pm UTC](https://www.ruby-forum.com/t/smallest-fizzbuzz-program/87441/28 "2007-03-07T20:51:49Z")

</div>

On 3/7/07, Robert D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Oh Rick just forget him, he will become a stone in the sun.

Why does conjure up a picture of Mick J. lying on a beach?

---

<div class="post-metadata">

**Author:** ![zakifataya](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/c89c15/32.png) [@zakifataya](https://www.ruby-forum.com/u/zakifataya)\
**Post date:** [March 7, 2007, 8:02pm UTC](https://www.ruby-forum.com/t/smallest-fizzbuzz-program/87441/29 "2007-03-07T20:02:41Z")

</div>

On 3/7/07, Martin DeMello [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On 3/7/07, Jenda K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Hey! Stop this! It’s supposed to be the dreadfull scripting language  
> > called Pearl that’s totally unreadable and it’s abusers waste the  
> > precious time trying to beat each other by writing something in as few  
> > characters as possible!
> 
> The email address simply drips irony 🙂

And what’s pearl? I thought it was perl. What does it mean if one  
doesn’t know how to properly spell one’s favorite language?

You could always tell who was really in the Smalltalk community or at  
least who wasn’t when they spelled it SmallTalk.

---

<div class="post-metadata">

**Author:** ![zakifataya](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/c89c15/32.png) [@zakifataya](https://www.ruby-forum.com/u/zakifataya)\
**Post date:** [March 8, 2007, 1:09am UTC](https://www.ruby-forum.com/t/smallest-fizzbuzz-program/87441/30 "2007-03-08T01:09:31Z")

</div>

On 3/7/07, Robert D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On 3/7/07, Rick DeNatale [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > On 3/7/07, Robert D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> > 
> > > Oh Rick just forget him, he will become a stone in the sun.
> > 
> > Why does conjure up a picture of Mick J. lying on a beach?
> 
> I guess I lack some cultural reference to understand this 🙂  
> I was just talking about Trolls as in Tollkien et al…

Mick J. is the lead singer of the Rolling Stones.

Robert my friend you must be either very old or very young (more likely)

–  
Rick DeNatale

My blog on Ruby  
[http://talklikeaduck.denhaven2.com/](http://talklikeaduck.denhaven2.com/)

---

<div class="post-metadata">

**Author:** ![zakifataya](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/c89c15/32.png) [@zakifataya](https://www.ruby-forum.com/u/zakifataya)\
**Post date:** [March 8, 2007, 7:27am UTC](https://www.ruby-forum.com/t/smallest-fizzbuzz-program/87441/31 "2007-03-08T07:27:05Z")

</div>

On Thu, Mar 08, 2007 at 04:01:46AM +0900, Rick DeNatale wrote:

> And what’s pearl? I thought it was perl. What does it mean if one  
> doesn’t know how to properly spell one’s favorite language?

Actually, in this context, I think “Jenda” is being intentionally  
ironic. That’s a jab at people who complain about Perl being unreadable  
and suitable only for golf and obfu.

---

<div class="post-metadata">

**Author:** ![zakifataya](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/c89c15/32.png) [@zakifataya](https://www.ruby-forum.com/u/zakifataya)\
**Post date:** [March 7, 2007, 9:36pm UTC](https://www.ruby-forum.com/t/smallest-fizzbuzz-program/87441/32 "2007-03-07T21:36:55Z")

</div>

On 3/7/07, Rick DeNatale [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On 3/7/07, Robert D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Oh Rick just forget him, he will become a stone in the sun.
> 
> Why does conjure up a picture of Mick J. lying on a beach?
> 
> –  
> Rick

I guess I lack some cultural reference to understand this 🙂  
I was just talking about Trolls as in Tollkien et al…

R.

---

<div class="post-metadata">

**Author:** ![zakifataya](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/c89c15/32.png) [@zakifataya](https://www.ruby-forum.com/u/zakifataya)\
**Post date:** [March 8, 2007, 8:49am UTC](https://www.ruby-forum.com/t/smallest-fizzbuzz-program/87441/33 "2007-03-08T08:49:11Z")

</div>

On 3/8/07, Rick DeNatale [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Mick J. is the lead singer of the Rolling Stones.
> 
> Robert my friend you must be either very old or very young (more likely)

Actually I am quite old (not as old as the Stones but almost), but  
incredibly stupid, I just did not get the pun!!!

> –  
> Rick DeNatale  
> Thx for bringing the light to the blind.

Robert

[Previous page](https://www.ruby-forum.com/t/smallest-fizzbuzz-program/87441.md?page=1)
