omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / tests / one_layer / generalization / dev / tasks / cases / devgen02 / prompt
| 1 | Write a function shift_sq_sum that takes an unsigned 8-bit number n and a signed 16-bit number c and |
| 2 | returns a signed 32-bit number. Define a helper function g that takes signed 32-bit numbers x and c and |
| 3 | returns (x - c) * (x + c) + x, and use it: shift_sq_sum(n, c) is the sum of g(i, c) for every i from 0 to |
| 4 | n - 1 (shift_sq_sum(0, c) = 0). Use signed 32-bit arithmetic: when the sum does not fit in a signed |
| 5 | 32-bit number, the function traps (overflow). For every input checked, either every partial result fits |
| 6 | in a signed 32-bit number or the final sum itself does not fit. |