IOCCC image by Matt Zucker

The International Obfuscated C Code Contest

2025/kurdyukov - Most likely to count

Solves number puzzles

Author:

Award: Most likely to count

To build:

    make all

To use:

    ./prog number .. 0 answer ..

Try:

    ./try.sh

Judges’ remarks:

How many arithmetic ways can we form numbers out of other numbers? The answer is a great deal. But to find the shortest mathematical expression: that is more of a challenge. To do that in only 1196 bytes of C code: that is impressive!

A fun challenge

Create an alternative form of prog.c (i.e., prog.alt.c) to allow the use of numbers in the interval [1, 2^31), or even the interval [1, 2^63).

The above fun challenge is still open. See the “Fun challenge Info” section for details.

Author’s remarks:

Magic Equations

Usage

    ./prog 7 77 777 0 2025 2026 2027 2028 2029
    (777 / 7 - 7) * (77 + 7) / 7 + 777 = 2025
    777 / 7 * 77 / 7 + 777 + 77 - 7 * 7 = 2026
    777 + 777 - 77 + 77 * 7 + 77 / 7 = 2027
    (77 + 7 / 7) * (7 + 7 + (77 + 7) / 7) = 2028
    77 * (7 + 7 + 77 / 7) + 777 / 7 - 7 = 2029

The program finds the shortest mathematical expression that uses numbers from the first list and +-*/ operators along with parentheses to represent numbers in the second list. Lists are separated by a zero.

Notes

Inventory for 2025/kurdyukov

Primary files

Secondary files


 Jump to: top