Author:
- Name: Ilya Kurdyukov
Location: RU - Russian Federation (Russia)
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
- Numbers are limited in the interval [1, 2^15).
- The shortest in terms of string length (spaces are counted).
- This may not be the shortest possible for some numbers due to the limited search range.
- When compiled with -O3, the program calculates the result in about 4 seconds on an average PC. The computation time is almost independent of the length of the lists.
Inventory for 2025/kurdyukov
Primary files
- prog.c - entry source code
- Makefile - entry Makefile
- prog.orig.c - original source code
- try.sh - script to try entry
Secondary files
- 2025_kurdyukov.tar.bz2 - download entry tarball
- README.md - markdown source for this web page
- .entry.json - entry summary and manifest in JSON
- .gitignore - list of files that should not be committed under git
- .path - directory path from top level directory
- .date-range - copyright date range for this directory
- index.html - this web page
Jump to: top
