Merge pull request #379 from xexyl/1992-ant
Format fix 1992/ant/README.md
This commit is contained in:
2 files changed
+87
-62
No files matched your search
+63
-46
@@ -1,26 +1,32 @@
|
|||||||
# Most Useful Program:
|
# Most Useful Program:
|
||||||
|
|
||||||
Albert van der Horst
|
Albert van der Horst
|
||||||
S P&A R&C
|
S P&A R&C
|
||||||
Oranjestraat 8
|
Oranjestraat 8
|
||||||
3511 RA UTRECHT
|
3511 RA UTRECHT
|
||||||
The Netherlands
|
The Netherlands
|
||||||
|
|
||||||
## To build:
|
## To build:
|
||||||
|
|
||||||
make all
|
```sh
|
||||||
|
make all
|
||||||
|
```
|
||||||
|
|
||||||
## To run:
|
## To run:
|
||||||
|
|
||||||
./albert number
|
```sh
|
||||||
|
./albert number
|
||||||
|
```
|
||||||
|
|
||||||
## Try:
|
## Try:
|
||||||
|
|
||||||
./albert 1234567890123456789
|
```sh
|
||||||
|
./albert 1234567890123456789
|
||||||
|
```
|
||||||
|
|
||||||
## Alternate code:
|
## Alternate code:
|
||||||
|
|
||||||
An alternate version of this entry, albert.alt.c, is provided.
|
An alternate version of this entry, [albert.alt.c](albert.alt.c), is provided.
|
||||||
Leo Broukhis, before he was an IOCCC judge, sent the IOCCC
|
Leo Broukhis, before he was an IOCCC judge, sent the IOCCC
|
||||||
judges this Email message:
|
judges this Email message:
|
||||||
|
|
||||||
@@ -46,7 +52,9 @@ is the file before applying Leo Broukhis' fix.
|
|||||||
|
|
||||||
To compile this alternate version:
|
To compile this alternate version:
|
||||||
|
|
||||||
make alt
|
```sh
|
||||||
|
make alt
|
||||||
|
```
|
||||||
|
|
||||||
Use `albert.alt` as you would `albert` above.
|
Use `albert.alt` as you would `albert` above.
|
||||||
|
|
||||||
@@ -56,65 +64,74 @@ We were impressed with the speed at which it was able to factor
|
|||||||
arbitrarily large numbers consisting of factors that fit into
|
arbitrarily large numbers consisting of factors that fit into
|
||||||
a long.
|
a long.
|
||||||
|
|
||||||
## Author's comments
|
## Author's comments:
|
||||||
|
|
||||||
The Obfuscated version of the Horst algorithm.
|
The Obfuscated version of the Horst algorithm.
|
||||||
|
|
||||||
This program will factor unlimited length numbers and print the
|
This program will factor unlimited length numbers and print the
|
||||||
factors in ascending order. Numbers of one digit (e.g. 8)
|
factors in ascending order. Numbers of one digit (e.g. 8)
|
||||||
are rejected without notice.
|
are rejected without notice.
|
||||||
It quits as soon as there is at most one
|
|
||||||
factor left, but that factor will not be shown.
|
It quits as soon as there is at most one factor left, but that factor will not
|
||||||
It accomplishes this efficiently, without resorting to division
|
be shown. It accomplishes this efficiently, without resorting to division or
|
||||||
or multiplication, until the candidate factor no longer fits in
|
multiplication, until the candidate factor no longer fits in a signed long.
|
||||||
a signed long.
|
|
||||||
|
|
||||||
The nicest way is to rename the program into e.g. 4294967297
|
The nicest way is to rename the program into e.g. 4294967297
|
||||||
if you want to factor Fermat's 4th number. Then just run it.
|
if you want to factor Fermat's 4th number. Then just run it.
|
||||||
Or you may type "prog <some-number>"
|
|
||||||
A nice one is also (30 ones)
|
Or you may type `./albert <some-number>`
|
||||||
albert 111111111111111111111111111111
|
A nice one is also (30 ones):
|
||||||
|
|
||||||
|
```sh
|
||||||
|
./albert 111111111111111111111111111111
|
||||||
|
```
|
||||||
|
|
||||||
Apart from the foregoing there are no special execution instructions.
|
Apart from the foregoing there are no special execution instructions.
|
||||||
|
|
||||||
To customize the program into a factorizer of a fixed number, use
|
To customize the program into a factorizer of a fixed number, use
|
||||||
|
|
||||||
|
```sh
|
||||||
cc albert.c -o 4294967297
|
cc albert.c -o 4294967297
|
||||||
|
```
|
||||||
|
|
||||||
or some such.
|
or some such.
|
||||||
|
|
||||||
There are no data files used, and it is not possible to feed input
|
There are no data files used, and it is not possible to feed input
|
||||||
via stdin.
|
via stdin.
|
||||||
|
|
||||||
I think this program is a nice example of algorithmic obfuscation.
|
I think this program is a nice example of algorithmic obfuscation. Several
|
||||||
Several times two similar algorithms are merged into one. Then you
|
times two similar algorithms are merged into one. Then you need quite some
|
||||||
need quite some tricks to get it running, such as long jumps
|
tricks to get it running, such as long jumps through recursive subroutines. I
|
||||||
through recursive subroutines. I felt like a sword smith,
|
felt like a sword smith, welding the sword very long, folding it again to the
|
||||||
welding the sword very long, folding it again to the proper
|
proper length, keep on hammering till it is tight, then fold again. Always
|
||||||
length, keep on hammering till it is tight, then fold again.
|
keeping it at the proper red hot temperature, but not too hot lest the hardness
|
||||||
Always keeping it at the proper red hot temperature, but not too
|
fades.
|
||||||
hot lest the hardness fades.
|
|
||||||
The strict naming conventions for subroutines did not make things
|
|
||||||
much clearer after all, but it was not supposed to.
|
|
||||||
|
|
||||||
I would like to draw attention to the robustness of the program
|
The strict naming conventions for subroutines did not make things much clearer
|
||||||
with respect to error handling and the nice stopping criterion.
|
after all, but it was not supposed to.
|
||||||
The aesthetic appeal of some lines is at the expense of clearness,
|
|
||||||
I apologize.
|
I would like to draw attention to the robustness of the program with respect to
|
||||||
Running the program through the c-beautifier reveals nothing,
|
error handling and the nice stopping criterion. The aesthetic appeal of some
|
||||||
it will only destroy some of the lay out.
|
lines is at the expense of clearness, I apologize.
|
||||||
Running the program through lint shows the usual remarks for a
|
|
||||||
K&R program. Defeating this through casts does not make a program
|
Running the program through the C-beautifier reveals nothing, it will only
|
||||||
|
destroy some of the lay out. Running the program through lint shows the usual
|
||||||
|
remarks for a K&R program. Defeating this through casts does not make a program
|
||||||
cleaner in my opinion.
|
cleaner in my opinion.
|
||||||
|
|
||||||
Here are some hints, but they may not be too helpful.
|
### Hints:
|
||||||
1. The Horst algorithm is described in the Hobby Computer Club
|
|
||||||
Newsletter, year 82, part 4, a real Dutch treat.
|
Here are some hints, but they may not be too helpful:
|
||||||
Assembler, c and Forth version have been around for some years.
|
|
||||||
|
1. The Horst algorithm is described in the Hobby Computer Club Newsletter, year
|
||||||
|
82, part 4, a real Dutch treat. Assembly, C and Forth version have been around
|
||||||
|
for some years.
|
||||||
2. Does fractal programming exist after all?
|
2. Does fractal programming exist after all?
|
||||||
3. You remember the ToomCook algorithm in Knuth?
|
3. You remember the ToomCook algorithm in Knuth? It uses iteration instead of
|
||||||
It uses iteration instead of recursion and is quite jumpy.
|
recursion and is quite jumpy. This program shares these disadvantages in a
|
||||||
This program shares these disadvantages in a modified form.
|
modified form.
|
||||||
4. The Conversion is to be found in Knuth, not so the Observation.
|
4. The Conversion is to be found in Knuth, not so the Observation. The
|
||||||
The Observation: "if it ends in a zero, it is divisible by ten"
|
Observation: "if it ends in a zero, it is divisible by ten".
|
||||||
|
|
||||||
## Copyright and CC BY-SA 4.0 License:
|
## Copyright and CC BY-SA 4.0 License:
|
||||||
|
|
||||||
|
|||||||
+24
-16
@@ -1,43 +1,51 @@
|
|||||||
# Best Utility:
|
# Best Utility:
|
||||||
|
|
||||||
Anthony C Howe
|
Anthony C Howe
|
||||||
Mortice Kern Systems Inc.
|
Mortice Kern Systems Inc.
|
||||||
Unit 1, 14 Weber Street North
|
Unit 1, 14 Weber Street North
|
||||||
Waterloo, Ontario
|
Waterloo, Ontario
|
||||||
N2J 3G4
|
N2J 3G4
|
||||||
Canada
|
Canada
|
||||||
|
|
||||||
## To build:
|
## To build:
|
||||||
|
|
||||||
make all
|
```sh
|
||||||
|
make all
|
||||||
|
```
|
||||||
|
|
||||||
## To run:
|
## To run:
|
||||||
|
|
||||||
./am Makefile
|
```sh
|
||||||
|
./am Makefile
|
||||||
|
```
|
||||||
|
|
||||||
where `Makefile` is a Makefile to use.
|
where `Makefile` is a Makefile to use.
|
||||||
|
|
||||||
|
|
||||||
## Try:
|
## Try:
|
||||||
|
|
||||||
./ant ant.test.mk
|
```sh
|
||||||
|
./ant ant.test.mk
|
||||||
|
```
|
||||||
|
|
||||||
We also suggest that you try:
|
We also suggest that you try:
|
||||||
|
|
||||||
make am
|
```sh
|
||||||
./am Makefile am_clobber # clobber everything except am
|
make am
|
||||||
./am Makefile all
|
./am Makefile am_clobber # clobber everything except am
|
||||||
|
./am Makefile all
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## Judges' comments
|
## Judges' comments:
|
||||||
|
|
||||||
|
|
||||||
Like much of Posix, obfuscation has its place. Your task is to
|
Like much of POSIX, obfuscation has its place. Your task is to
|
||||||
figure out where.
|
figure out where.
|
||||||
|
|
||||||
This entry comes complete with a Posix-like command description.
|
This entry comes complete with a Posix-like command description.
|
||||||
Interested Posix balloters should lobby the IEEE for an obfuscated
|
Interested POSIX balloters should lobby the IEEE for an obfuscated
|
||||||
P1003 sub-committee.
|
P1003 subcommittee.
|
||||||
|
|
||||||
|
|
||||||
## Author's comments:
|
## Author's comments:
|
||||||
|
|||||||
Reference in new issue
Block a user