News for hackers. Stuff that matters.
Re:FizzBuzz without multiplication or division by Zev on Monday May 02, 2011 @02:14AM (#2505379)
Part 2 (http://jacob.jkrall.net/fizzbuzz-without-multiplication-or-d...) has my favorite solution in the series.
Re:FizzBuzz without multiplication or division by krallja on Monday May 02, 2011 @02:37AM (#2505435)
Me too. What do you think about the line

     if(ix==15) ix = 0;
Should I change this to say

     ix = ix & 15;
Or is that too specific to 3,5-Fizzbuzz?
Re:FizzBuzz without multiplication or division by ponzi on Monday May 02, 2011 @02:53AM (#2505475)
Are those really equivalent? What if ix == 15?

It would work with a 2,8-fizzbuzz, though.

Re:FizzBuzz without multiplication or division by krallja on Monday May 02, 2011 @11:11AM (#2506508)
Whoops, I wrote that far too late last night. 15&15 = 15, so of course it wouldn't work :)

A 2,8-fizzbuzz would only need 8 items in the circular array since the least common multiple of 2 and 8 is 8:

    ix = ix & 8;