
HAKMEM (1972) - Cieplak
http://www.inwap.com/pdp10/hbaker/hakmem/hakmem.html
======
EdwardCoffin
Item 70, The chess problem "stolen from Chess for Fun, Chess for Blood" by
Lasker is problem 66 from that book [1]. The problem as stated in the memo is
wrong: the white bishop is on the eighth rank, not the seventh, so it should
say Bishop on KB8, not on KB7. The problem in FEN is then:

5B2/6P1/1p6/8/1N6/kP6/2K5/8 w - - 1 1

The version from Lasker's book is _much_ more interesting. It happens that the
version from HAKMEM is also a mate-in-3, but kind of a mundane one, relative
to Lasker's anyway.

[1] Lasker's book is on Google Books, and you can see the relevant page (page
145)
[https://books.google.ca/books?id=y90UTQeLeeIC&pg=PA145](https://books.google.ca/books?id=y90UTQeLeeIC&pg=PA145)
(spoiler: the solution is described on that page).

------
SeanLuke
It's worth mentioning that many aspects of HAKMEM have found their way into
"Hacker's Delight", one of the more impressive CS books ever published IMHO.

[http://www.hackersdelight.org/](http://www.hackersdelight.org/)

See also Guy Steele's forward to the book, in which he talks about its
relationship to HAKMEM.

[http://www.hackersdelight.org/foreword.pdf](http://www.hackersdelight.org/foreword.pdf)

~~~
cup-of-tea
I wouldn't call it a computer science book. It's certainly one of the most
impressive programming books, though. These days I do most of my program in
languages like Lisp and Python and I am a bit sad that I don't get to apply
the bit fiddling type hacks found in that book.

------
hakmem
There are a lot of pearls in this - I would call it lab book.

A while ago, I made a slow Clojure implementation of a generalized version of
Bill Gospers continued fraction arithmetics from the HAKMEM

[http://github.com/timrichardt/stern-brocot-
tree](http://github.com/timrichardt/stern-brocot-tree)

~~~
mci
Ten years ago, I implemented Gosper's continued fraction arithmetics in
Python:
[http://sun.aei.polsl.pl/~mciura/software/cf.py](http://sun.aei.polsl.pl/~mciura/software/cf.py)
My module can also compute exp() and log() as well as trigonometric and
inverse trigonometric functions. Here are slides from my presentation about
it:
[http://sun.aei.polsl.pl/~mciura/cf.pdf](http://sun.aei.polsl.pl/~mciura/cf.pdf)

~~~
hakmem
Great, I will definitely have a look at it. Did you implement exp(x) for any
continued fraction x?

~~~
mci
Yes. The key to that is approximating reals by the second Ostrogradsky series
(or, more properly, Ostrogradsky-Sierpiński series): x = ⎣x⎦ + 1/q₁ − 1/q₂ +
1/q₃ - 1/q₄ + ⋯, where the denominators qₖ are greedily chosen as the largest
possible. The following formulas are true: exp(1/q) = [1; q−1, 1, 1, 3q−1, 1,
1, 5q-1,…], exp(x + y) = exp(x)exp(y), and exp(x - y) = exp(x)/exp(y). The
algorithm keeps two most recent partial sums of the O-S series: sₖ₋₁ and sₖ.
As long as the partial quotients of exp(sₖ₋₁) and exp(sₖ) are equal, it emits
them; otherwise, it computes the next partial sum sₖ₊₁. Similar formulas work
for tan(x).

------
vog
Interestingly, there's not only theorems but also conjectures in this list.

Interesting bit:

 _> ITEM 125 (Polya):_

 _> CONJECTURE: If a function has a power series with integer coefficients and
radius of convergence 1, then either the function is rational or the unit
circle is a natural boundary._

 _> Reference: Polya, Mathematics and Plausible Reasoning, volume 2, page 46._

Has this conjecture been proved or disproved by now?

~~~
fdej
Yes, this was proved by F. Carlson in 1921 and it is known as the
Pólya–Carlson theorem.

------
drallison
This is a classic. IMHO, HAKMEM should be required reading for everyone who
programs computers. Likewise, everyone should own and read Hank Warren's
_Hackers Delight_. For advanced practitioners, Knuth's _Art of Computer
Programming_ (particularly Volume 4) has some similar material. All explore
the deep relationship between mathematics and programming.

------
conistonwater
Item 1 (expressing (p/q)! in terms of other (p/q)!) has no general solution
still, as far as I know, but can easily be handled empirically for medium-
sized n with the PSLQ algorithm.

Item 96 ("Solve go") can be made tractable by setting the board size to n=2.

~~~
strangecasts
_Item 96 ( "Solve go") can be made tractable by setting the board size to
n=2._

At first I thought this was an "assume a spherical cow"-style joke, but no, it
turns out there are _386 billion_ possible games you can play on a 2x2 Go
board:

[http://tromp.github.io/go/legal19.html](http://tromp.github.io/go/legal19.html)

~~~
conistonwater
I thought indeed that I was making a "spherical cow" joke. I was actually
thinking of this:
[https://tromp.github.io/java/go/twoxtwo.html](https://tromp.github.io/java/go/twoxtwo.html),
so only 1446 nodes after pruning.

------
mietek
_> Programs below this line are considered unfeasible._

[http://www.inwap.com/pdp10/hbaker/hakmem/proposed.html#item9...](http://www.inwap.com/pdp10/hbaker/hakmem/proposed.html#item94)

------
brassattax
I'm glad they provided this in 'html' format.

~~~
fit2rule
I'm looking, but cannot find some way to view the whole thing as a single HTML
page (as it should be), so "wget -m -np" it is ..

~~~
phoyd
A single page version is here: [http://hakmem.org/](http://hakmem.org/)

~~~
fit2rule
Ah, that is indeed very nice - thanks!

------
vowelless
Is there a modern (latex) version? Reading the math on those pages is an
arduous undertaking.

~~~
ZoF
Here: w3.pppl.gov/~hammett/work/2009/AIM-239-ocr.pdf

~~~
vowelless
Thanks a lot!

