# Re: Smallest FizzBuzz program

**URL:** <https://www.ruby-forum.com/t/re-smallest-fizzbuzz-program/87472>\
**Category:** Ruby\
**Created:** [March 2, 2007, 8:51pm UTC](https://www.ruby-forum.com/t/re-smallest-fizzbuzz-program/87472 "2007-03-02T20:51:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![scoundrel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3ec8ea/32.png) [@scoundrel](https://www.ruby-forum.com/u/scoundrel)\
**Post date:** [March 2, 2007, 8:51pm UTC](https://www.ruby-forum.com/t/re-smallest-fizzbuzz-program/87472/1 "2007-03-02T20:51:21Z")

</div>

> > 
> 
> Nice work. I removed ,x from |i,x| on a whim and it still works - 57  
> bytes! (you have to count file size which as an EOF char)

I think you don’t have to. Otherwise you have to count hard disk drive  
sector size (a file cannot have it’s size \< sector size, which is  
usually 512 byte) 🙂

---

<div class="post-metadata">

**Author:** ![scoundrel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3ec8ea/32.png) [@scoundrel](https://www.ruby-forum.com/u/scoundrel)\
**Post date:** [March 2, 2007, 9:00pm UTC](https://www.ruby-forum.com/t/re-smallest-fizzbuzz-program/87472/2 "2007-03-02T21:00:22Z")

</div>

Alexey K. wrote:

> > Nice work. I removed ,x from |i,x| on a whim and it still works - 57  
> > bytes! (you have to count file size which as an EOF char)
> 
> I think you don’t have to. Otherwise you have to count hard disk drive  
> sector size (a file cannot have it’s size \< sector size, which is  
> usually 512 byte) 🙂

Well, I didn’t make the rules. When you upload a file to the following  
site (if it wasn’t down):

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

The site saves the uploaded file and computes the file size. Regarding  
your sector size, that’s a separate issue. Save the code to a file and  
do:

ls -l fizzbuzz.rb

Surely we can knock one measly byte off of this sucker 🙂

Brian

---

<div class="post-metadata">

**Author:** ![scoundrel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3ec8ea/32.png) [@scoundrel](https://www.ruby-forum.com/u/scoundrel)\
**Post date:** [March 2, 2007, 9:37pm UTC](https://www.ruby-forum.com/t/re-smallest-fizzbuzz-program/87472/3 "2007-03-02T21:37:26Z")

</div>

On Mar 2, 2007, at 3:00 PM, Brian A. wrote:

> Surely we can knock one measly byte off of this sucker 🙂

Omit the new line:

-rw-r–r-- 1 schapht schapht 56 Mar 2 15:35 fizzbuzz.rb

-Mat

---

<div class="post-metadata">

**Author:** ![scoundrel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3ec8ea/32.png) [@scoundrel](https://www.ruby-forum.com/u/scoundrel)\
**Post date:** [March 2, 2007, 10:51pm UTC](https://www.ruby-forum.com/t/re-smallest-fizzbuzz-program/87472/4 "2007-03-02T22:51:40Z")

</div>

Mat S. wrote:

> > ls -l fizzbuzz.rb
> > 
> > Surely we can knock one measly byte off of this sucker 🙂
> 
> Omit the new line:
> 
> -rw-r–r-- 1 schapht schapht 56 Mar 2 15:35 fizzbuzz.rb

Interesting. For me, vim shows 56 bytes of actual code, but ls shows 57  
bytes, so I assumed that included an EOF character. There is no newline  
in my file.

---

<div class="post-metadata">

**Author:** ![scoundrel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3ec8ea/32.png) [@scoundrel](https://www.ruby-forum.com/u/scoundrel)\
**Post date:** [March 3, 2007, 4:06am UTC](https://www.ruby-forum.com/t/re-smallest-fizzbuzz-program/87472/5 "2007-03-03T04:06:06Z")

</div>

On Mar 2, 2007, at 4:50 PM, Brian A. wrote:

> Interesting. For me, vim shows 56 bytes of actual code, but ls  
> shows 57  
> bytes, so I assumed that included an EOF character. There is no  
> newline  
> in my file.

You sure? If you do File.read(filename) in irb is there a \n at the  
end?  
-Mat

---

<div class="post-metadata">

**Author:** ![scoundrel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3ec8ea/32.png) [@scoundrel](https://www.ruby-forum.com/u/scoundrel)\
**Post date:** [March 3, 2007, 4:41am UTC](https://www.ruby-forum.com/t/re-smallest-fizzbuzz-program/87472/6 "2007-03-03T04:41:08Z")

</div>

Mat S. wrote:

> On Mar 2, 2007, at 4:50 PM, Brian A. wrote:
> 
> > Interesting. For me, vim shows 56 bytes of actual code, but ls shows 57  
> > bytes, so I assumed that included an EOF character. There is no newline  
> > in my file.
> 
> You sure? If you do File.read(filename) in irb is there a \n at the end?  
> -Mat

My bad - dude, you’re a genius. Little did I know that Vim was sneaking  
in an extra newline on me ☹

So it’s official, we’re tied for 1st now - checkout comp.lang.ruby on:

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

I don’t think I’ll ever do a golf challenge again - what a time sync!
