#include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX 2000000001 unsigned char *K = 0; int main() { K = (unsigned char*)malloc(MAX); K[1]=1; K[2]=2; int r=0; int m=1; int k=1; for (int n=1; n<MAX; n++) { K[n] = k; r++; if (r==K[m]) { r=0; m++; k=k==1 ? 2 : 1; } } int o=2; for (int w=1; w<=10000; w++) { while (memcmp(K+1, K+o, w)) { o++; if (o+w>=MAX) { // the end return 0; } } printf("%d %d\n", w, o); fflush(stdout); } free(K); K=0; return 0; }