Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

MOST OPTIMIZED FIZZBUZZ IMPLEMENTATION

Name: Anonymous 2012-01-29 13:27

ever. (for any arbitery n)

#include <stdio.h>
 
#define N 100
 
int main(void) {
  char arr[] = "%d\n%d\nfizz\n%d\nbuzz\nfizz\n%d\n%d\nfizz\nbuzz\n%d\nfizz\n%d\n%d\nfizzbuzz\n";
  int news[]={0,3,6,11,14,19,24,27,30,35,40,43,48,51,54,63};
  int i=N/15, j=1;
 
  while(i--){
   printf(arr, j, j+1, j+3, j+6, j+7, j+10, j+12, j+13);
   j+=15;
  }
  arr[news[N%15]]='\0';
  printf(arr, j, j+1, j+3, j+6, j+7, j+10, j+12, j+13);
 
  return 0;   
}

Name: Anonymous 2012-01-29 15:15

>>8
Sure, let's restrict ourselves to that set, it would make things easier. I'll give you the honor of constructing the set since it was your idea. Shouldn't be too hard, just use Jot1 to enumerate all programs and select the terminating ones among them. Jot is handy for this task, if you used binary-coded Jot, the new Gödel numbering is the code.

Once you've constructed the set I'll do the analysis to find the most efficient one.

[1] http://semarch.linguistics.fas.nyu.edu/barker/Iota/

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List