IOCCC image by Matt Zucker

The International Obfuscated C Code Contest

1995/savastio - Most obfuscated syntax

Infinite-precision factorial calculator

Author:

To build:

    make all

Bugs and (Mis)features:

The current status of this entry is:

STATUS: INABIAF - please DO NOT fix

For more detailed information see 1995/savastio in bugs.html.

To use:

    ./savastio
    # enter a POSITIVE number such as 100

NOTE: if you specify a negative number it will get stuck, showing no output. But what happens if you give a non-number?

Try:

    ./try.sh

Judges’ remarks:

I know an l when I see a 1.

Author’s remarks:

This program is an infinite-precision factorial calculator. It will compute the factorial of any number entered to an infinite degree of precision (or the limits of your machine’s memory, whichever comes first). I’d suggest you start with small numbers the first few times you run it and gradually work your way up in order to get a feel for the computation time your machine will require.

Aside from having an artistic code layout and confusing variable names, the algorithm itself takes advantage of some cute C-isms. Try to figure out how it prints the prompt “Enter number:”.

Numbers are represented internally by a linked list of blocks each containing 1000 buckets of 4-digit integers. To further confuse matters, the buckets are arranged backwards in the block. For example, the number 8347108947139478934713847134 is represented as:

    7134 1384 9347 3947 9471 7108 834

Platform limitations

long integers must be at least 4 bytes.

Features

In order to prevent the user from wasting too much time computing useless factorials, the maximum factorial that can be computed is 429539! This limit was selected through extensive research in time management studies and the factorial arts.

Inventory for 1995/savastio

Primary files

Secondary files


Jump to: top