Remix.run Logo
bjoli 2 days ago

I remember writing it in high school end ending up using a wheel (circular data structure) to avoid any modulo at all. Then my HS teacher said that it should be extensible so I wrote a wheel generator.

Despite writing things in scheme I ended up being the fastest. It is no magic bullet, but if you only want the regular fizz buzz it is a simple way to just about double the speed.

setr 2 days ago | parent [-]

Isn't a circular array implemented with a modula to begin with? I don’t see how you bypass it

teo_zero 2 days ago | parent | next [-]

  m3=m5=m7=1
  for ...
    ...
    m3 = m3==2?0:m3+1
    m5 = m5==4?0:m5+1
    m7 = m7==6?0:m7+1
bjoli a day ago | parent | prev [-]

You keep two counters.