Prepare for the winners of **IOCCC28**. > However these are not the 2024 droids you are looking for. :-) The HTML menu (both JavaScript and non-JavaScript) has been updated. The `Status -> Rules and guidelines' have been replaced with two separate menus `Status -> IOCCC rules` and `Status -> IOCCC guidelines`. Added a new top level `social.html` page: built from a new `social.md`. Sorted rules for building specific web pages in the top level `Makefile`. Added `make social` to make the `social.html` page from `social.md`. The `bin/gen-top-html.sh` now is able to process a argument of **social** to process the new top level `social.html` page. Changed `bin/gen-top-html.sh` VERSION from "2.0.0 2025-03-13" to "2.0.1 2025-07-25". Below `About -> Home page` a new `About -> IOCCC social media` menu item as added. Because the menu change touched every HTML file, we changed the general copyright date range for HTML files from "1984-2024" to "1984-2025" due to the extensive changes made for **IOCCC28**. Those markdown files that were modified in 2025 had their copyright date range also changed from "1984-2024" to "1984-2025". Rebuilt tarballs and sitemap due to the extensive HTML rebuilding. Ran `make update` to perform the above.
To build:
make all
To use:
./dalbec
Try:
./try.sh
Why does the output end with 121?
Judges' remarks:
The output is mis-leading ... why does it also print 2047?
For a hint see https://web.archive.org/web/20000510191341/https://www.utm.edu/research/primes/prove2.html.
... and then try to understand the source! :-)
We (the judges) recommend that you take the time needed to understand how this program works. The source is small enough to make the effort reasonable, and complex enough to make it interesting.
Author's remarks:
This program assumes that your terminal wraps lines automatically. If this is not the case, you may need to change the space in the "printf" format string to a newline character.
An extra feature of this program is that it allows you (in most cases) to estimate the stack space available to programs on your system. Simply allow the program to run to completion. The stack space is roughly proportional to the last number printed.
(On SunOS/cc, the proportionality constant is about 48 bytes.)
On completion, the program produces a core file that may be used to
refine this estimate. (Or you could try typing limit if you're
running csh.) In rare cases the stack space may exceed 24*INT_MAX
bytes, in which case the program will produce an inaccurate estimate.
This program is obfuscated by:
-
The use of easily-confused variable names.
-
Using the implicit
!=0in conditional expressions. -
Substituting expressions such as
!afor0wherea!=0and!afor1wherea==0. -
The fact that
main()is a single expression and so beautifies poorly. -
The fact that
main()is used:- to compute powers in modular arithmetic.
- to recursively call itself in the main loop.