% CHANGES TO VOLUME 2 OF THE ART OF COMPUTER PROGRAMMING % % Copyright (C) 2022,2023 by Donald E. Knuth % This file may be freely copied provided that no modifications are made. % All other rights are reserved. % % Three levels of changes to the books are distinguished here: % % "\bugonpage" introduces the correction of an error; % "\amendpage" introduces new material for future editions; % "\improvepage" introduces ameliorations of lesser importance. % % (Changes introduced by \improvepage do not appear in the hardcopy listing.) % % Also, "\planforpage" introduces some of the author's half-baked intentions. % % NOTE: TO PUT THE INDEX ON A SEPARATE PAGE, RUN THIS WITH THE COMMAND LINE % tex "\let\indexeject+ \input err2" \newif\ifall % \alltrue means show the trivial items too \relax % hook \def\vertical{|} \def\inref#1 #{\expandafter\def\csname\vertical#1\endcsname} \catcode`|=\active \let|\inref \input \jobname.ref \catcode`|=12 \input taocpmac % use the format for TAOCP, with modifications below \def\becomes{\ifmmode\ \hbox\fi{\manfnt y}\ } % wiggly arrow indicates a change \def\bugonpage#1.#2 #3 (#4) { \medbreak\defaultpointsize \line{\kern-5pt\llap{\manfnt x}% print a black triangle in left margin {\bf Page #2}\enspace #3 \leaders\hrule\hfill\ \eightrm\date#4.} \nobreak\smallskip\iftrue\noindent} \def\amendpage#1.#2 #3 (#4) { \medbreak\defaultpointsize \line{\kern-5pt{\bf Page #2}\enspace #3 \leaders\hrule\hfill\ \eightrm\date#4.} \nobreak\smallskip\iftrue\noindent} \def\improvepage#1.#2 #3 (#4) {\ifall \medbreak\ninepoint \line{\kern-6pt{\sl Page #2\enspace #3\/} \leaders\hrule\hfill\ \eightrm\date#4.} \nobreak\smallskip\noindent} \def\planforpage#1.#2 #3 (#4) { \medbreak\defaultpointsize \line{\kern-5pt{\bf Page #2}\enspace #3 \leaders\hbox to 5pt{\hss.\hss}\hfill\ \eightrm\date#4.} \nobreak\smallskip\begingroup\let\endchange=\endgroup\sl\noindent} \let\endchange=\fi \def\nl{\par\noindent} \def\nlh{\par\noindent\hangit} \def\hangit{\hangindent2em} \def\cutpar{{\parfillskip=0pt\par}} \def\date#1.#2.#3.{% convert "yy.mm.dd." to "dd Mon 19yy" #3 \ifcase#2\or Jan\or Feb\or Mar\or Apr\or May\or Jun\or Jul\or Aug\or Sep\or Oct\or Nov\or Dec\fi \ \ifnum #1<97 \hundred#1\else19#1\fi} \def\hundred{20} % the "century" for dates before '97 \def\ex #1. [#2]{\ninepoint \textindent{\bf#1.}[{\it#2\/}]\kern6pt} \def\EX #1. [#2]{\ninepoint \textindent{\llap{\manfnt x}\bf#1.}[{\it#2\/}]\kern6pt} \def\foottext#1{\medskip \hrule height\ruleht width5pc \kern-\ruleht \kern3pt \eightpoint \smallskip\textindent{#1}} \def\volheadline#1{\line{\cleaders\hbox{\raise3pt\hbox{\manfnt\char'36}}\hfill \titlefont\ #1\ \cleaders\hbox{\raise3pt\hbox{\manfnt\char'36}}\hfill}} \def\refin#1 {\let|\inref \input #1.ref \let|\crossref} \let\defaultpointsize=\tenpoint %%%%%%%%%%%%%% opening remarks %%%%%%%%%%%%%%%%%%%%%%%% \def\lhead{INTRODUCTION} \let\rhead=\lhead \titlepage \volheadline{THE ART OF COMPUTER PROGRAMMING} \bigskip \volheadline{ERRATA TO VOLUME 2 (after 2021)} \bigskip \noindent This document is a transcript of the notes that I have been making in my personal copy of {\sl The Art of Computer Programming}, Volume~2 (third edition, 45th printing) since it was first printed in 2022. Previous errata are recorded in another file `{\tt all2-pre.ps}'. \ifall Four levels of updates\dash---``errors,'' ``amendments,'' ``plans,'' and ``improvements''\dash---appear, indicated by four \else Three levels of updates\dash---``errors,'' ``amendments,'' and ``plans''\dash---appear, indicated by three \fi different typographic conventions: \begingroup\def\hundred{17} \bugonpage 0.666 line 1 (76.07.04) Technical or typographical errors (aka bugs) are the most critical items, so they are flagged with a `\thinspace{\manfnt x}\thinspace' preceding the page number. The date on which I first was told about the bug is shown; this is the effective date on which I paid the finder's fee. The necessary corrections are indicated in a straightforward way. If,~for example, the book says `$n$' where it should have said `$n+1$', the change is shown thus: \smallskip $n$ \becomes $n+1$ \endchange \amendpage 0.666 line 2 (89.07.14) Amendments to the text appear in the same format as bugs, but without the~`\thinspace{\manfnt x}\thinspace'. These are things I wish I had known about or thought of when I wrote the original text, so I added them later. The date is the date I drafted the new text. \endchange \def\hundred{19} \planforpage 0.666 line 3 (17.11.20) Plans for the future represent a third kind of item. In such notes I~sketched my intentions about things that I wasn't ready to flesh out further when I~wrote them down. You can identify these items because they're written in slanted type, and preceded by a bunch of dots `\hbox to 6em{\leaders\hbox to 5pt{\hss.\hss}\hfill}' leading to the date on which I recorded the plan in my files. \endchange \improvepage 0.666 line 4 (38.01.10) The fourth and final category\dash---indicated by page and line number in smaller, slanted type\dash---consists of minor corrections or improvements that most readers don't want to know about, because they are so trivial. You wouldn't even be seeing these items if you hadn't specifically chosen to print the complete errata list in all its gory details. Are you sure you wanted to do that? \endchange \endgroup \ifall\else\medskip\ninepoint My personal file of updates also includes a fourth category of items, not shown in this list. They are miscellaneous minor corrections or improvements that most readers don't want to know about, because they are so trivial. If you really want to see all of the gory details, you can download the full list from Internet webpage $$\.{http://www-cs-faculty.stanford.edu/\char`\~knuth/taocp.html}$$ by selecting the ``long form'' of the errata. \fi \medskip \tenpoint My shelves at home are bursting with preprints and reprints of significant research results that I want to digest and summarize, where appropriate, in the ultimate edition of Volume~2. I didn't do that in the third edition because I would surely have to do it over again later: New results continue to pour forth at a great rate, and I will have time to rewrite that volume only~once. Volumes 4 and~5 need to be finished first. So I've put most of my effort so far into writing up those parts of the total picture that seem to have converged to their near-final form. It follows, somewhat paradoxically, that the updates in this document are most current in the areas where there has been least activity. On the other hand I do believe that the changes listed here bring Volume~2 completely up to date in two respects: (1)~All of the research problems in the previous edition\dash---i.e., all exercises that were rated 46 and above\dash---have received new ratings of 45 or less whenever I learned of a solution; and in such cases, the answer now refers to that solution. (2)~All of the historical information about pioneering developments has been amended whenever new details have come to my attention. \beginconstruction The ultimate, glorious, 100\% perfect editions of Volumes 1--4 are works in progress. Please let me know of any improvements that you think I ought to make. Send your comments either by snail mail to D.~E. Knuth, Computer Science, Gates Building 1B, Stanford University, Stanford CA~94305-9015, or by email to {\tt taocp{\char`\@}cs.stanford.edu}. (Use email for book suggestions only, please\dash---all other correspondence is returned unread to the sender, or discarded, because I have no time to read ordinary email.) Although I'm working full time on Volume~4 these days, I~will try to reply to all such messages within a year of receipt. Current news about {\sl The Art of Computer Programming\/} is posted on $$\.{http://www-cs-faculty.stanford.edu/\char`~knuth/taocp.html}$$ and updated regularly. \par\endconstruction \rightline{\dash---Don Knuth, January 2011} \bigskip \bigskip {\quoteformat Oh! If only someone would give me time, time, time to do everything\/ {\rm properly}, to read everything at\/ {\rm my own\/} tempo, to take it apart and put it together again. \author KARL BARTH (1922) % letter to Edvard Thurneysen, spring 1922 % found in Revolutionary Theology in the Making: Barth-Thurneysen % Correspondence 1914--1925, tr by Jas. D. Smart % Richmond VA: John Knox Press, 1964, p43 \vfill\eject } \def\today{\number\day\space\ifcase\month\or January\or February\or March\or April\or May\or June\or July\or August\or September\or October\or November\or December\fi \space\number\year} %%%%%%%%%%%%%%% CHANGES FOR VOLUME 2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\lhead{CHANGES TO VOLUME 2: SEMINUMERICAL ALGORITHMS} \let\rhead=\lhead \titlepage \volheadline{SEMINUMERICAL ALGORITHMS} \bigskip \rightline{Copyright \copyright\ 2022, 2023 Addison\with Wesley} \rightline{Last updated \today} \bigskip \rightline{\sl Most of these corrections have already been made in recent printings.} \smallskip \let\defaultpointsize=\tenpoint \bugonpage 2.57 Smirnov reference near the bottom (22.11.10) 176--206 \becomes 179--206 \endchange \amendpage 2.61 line 7 (22.12.14) eleven kinds \becomes twelve kinds \endchange \amendpage 2.198 line 22 (23.11.08) 1586--1610. \becomes 1586--1610. (In India, al-K\=ash\ii's contemporary M\=adhava had computed $9\cdot10^{11}\pi\approx 2827433388233$, according to N{\ii}lakantha's commentary on Ga\d{n}ita \S10 of the {\sl \=Aryabha\d{t}\={\i}ya\/}.) \endchange \amendpage 2.199 line 9 (23.11.08) man's custom \becomes human custom \endchange \amendpage 2.200 lines 13--14 (22.08.10) as early as 1679 \dots\ ``decimal''). \becomes already in 1679 or earlier, and that he often experimented with radix-16 numbers. \endchange \amendpage 2.200 line 17 (22.08.10) 1973). Zacher points out \becomes 1973), and extended by L.~Strickland and H. Lewis (Cambridge, Mass.:\ MIT Press, 2022), who have provided English translations. Zacher pointed out \endchange \bugonpage 2.200 line $-18$ (22.08.10) 35-digit \becomes 35-place \endchange \improvepage 2.200 lines $-13$ and $-12$ (22.08.10) The motive \dots\ could be observed in \becomes Bernoulli and Leibniz were hoping to discover a simple pattern in \endchange \amendpage 2.201 line 1 (22.08.10) \indent More than a century later, a prominent \becomes\nl\indent The eccentric British schoolmaster T. W. Hill spent more than 50 years of his life experimenting with radix~16. His public lecture in 1845, published posthumously, described ingenious ways to say and to write hexadecimal numbers and fractions [{\sl Selections from the Papers of the Late Thomas Wright Hill, Esq.\ F.R.A.S.} (London:\ 1860), 63--85]. But he gave no examples of arithmetic. Independently, a prominent \endchange \amendpage 2.201 delete an obsolete paragraph (22.08.10) The book {\sl History of Binary\/} \dots\ 243]. \becomes \endchange \amendpage 2.202 line 5 (22.08.08) sexadecimal \becomes sexdecimal \endchange \amendpage 2.209 lines 25 and 26 (22.11.02) Several questions \dots\ by W. Parry, \becomes Intriguing questions concerning {\it irrational\/} radices have been investigated by A.~R\'enyi, {\sl Acta Math.\ Acad.\ Sci.\ Hung.\ \bf 8} (1957), 477--493; W.~Parry, \endchange \amendpage 2.209 just before the exercises (22.11.02) Gray code \becomes regular continued fractions (Section 4.5.3); Gray codes \endchange \amendpage 2.213 line 2 (23.02.18) {\sl Crelle\/ \bf127} (1904), 51--84. \becomes\nl {\sl Jahresbreicht der Deutschen Mathematiker-Vereinigung\/ \bf6} (1897), 83--88. \endchange \bugonpage 2.311 in the Harvey / van der Hoeven reference (22.11.10) {\bf 191} \becomes (2) {\bf 193} \endchange \amendpage 2.409 lines $-17$ and $-16$ (23.09.08) all exponents \dots; his \becomes all exponents $<65{,}610{,}011$ were checked as of November 8, 2023; his \endchange \bugonpage 2.431 in Table 1 (22.11.21) rows $C_1$ and $C_0$: $d_2^2b_6^4/c_4^5$ \becomes $d_2^3b_6^4/c_4^5$\nl row $D_0$: $e_2^2c_4^2/d_2^3b_6^2$ \becomes $e_1^2c_4^2/d_2^3b_6^2$ \endchange \bugonpage 2.432 three lines before {\eq(23)} (22.12.08) $C_{n_2+n_j-1}$ becomes $C_{n_2-n_j-1}$ \endchange \amendpage 2.477 lines 20 and 21 (22.08.12) using a backtrack \dots cases. \becomes using the backtrack method in a program called \.{ACHAIN0} now on the Internet, involved a detailed examination of more than 100 cases. \endchange \amendpage 2.477 replacement for the table at the bottom (22.08.13) \noindent $$\openup-1.2pt\vcenter{\halign{\hfil$#$&\quad\hfil$#$\cr r&c(r)\kern-.3em\cr\noalign{\vskip3pt} 0&1\cr 1&2\cr 2&3\cr 3&5\cr 4&7\cr 5&11\cr 6&19\cr 7&29\cr 8&47\cr 9&71\cr 10&127\cr 11&191\cr }}\hskip3em\vcenter{\halign{\hfil$#$&\quad\hfil$#$\cr r&c(r)\ \cr\noalign{\vskip3pt} 12&379\cr 13&607\cr 14&1087\cr 15&1903\cr 16&3583\cr 17&6271\cr 18&11231\cr 19&18287\cr 20&34303\cr 21&65131\cr 22&110591\cr 23&196591\cr }}\hskip3em\vcenter{\halign{\hfil$#$&\quad\hfil$#$\cr r&c(r)\ \ \ \cr\noalign{\vskip3pt} 24&357887\cr 25&685951\cr 26&1176431\cr 27&2211837\cr 28&4169527\cr 29&7624319\cr 30&14143037\cr 31&25450463\cr 32&46444543\cr 33&89209343\cr 34&155691199\cr 35&298695487\cr }}\hskip3em\vcenter{\halign{\hfil$#$&\quad\hfil$#$\cr r&c(r)\ \ \ \cr\noalign{\vskip3pt} 36&550040063\cr 37&994660991\cr 38&1886023151\cr 39&3502562143\cr 40&6490123999\cr 41&11889505663\cr 42&22899028607\cr 43&41866170239\cr 44&76086635263\cr 45&142771387391\cr 46&257661019487\cr 47&498691112447\cr }}$$ \endchange %\bugonpage 2.478 line 6 (11.08.30) %$c(33)$ \becomes $c(39)$ %\endchange \amendpage 2.478 lines 4--8 (22.08.13) The values listed \dots\ this agrees \becomes The values of $c(r)$ listed here for $18%% Unicode char "9ad8 \GC73:74:-4:61% G2134 <00006000001c000000000000f000001f000000000000f800001fc00000000001fc00001f% e00000000001fe00001fe00000000003fe00001fc00000000003f800001fc00000000007% f000001f800070000007e000003f0000f800000fc000003f0001fc00001f8000007e0003% fe00001f07ffffffffffff00003e03ffffffffffff80007c0100007c0000000000f80000% 00780000000000f0000000780000000001e0000000700000000003c03838007000070000% 07807c3c00f0000f80001f007f3f00e0001f80003e00ffbfffffffffc0007c00ffbfffff% ffffe000f801ff1fffffffffe000c001fe1f03e0780f80000003fe1f03e0780f80000003% fc1f03e0780f80000007f81f03e0780f80000007f01f03e0780f8000000fe01f03e0780f% 8000000fc01f03e0780fc000001f801f03e0780fc000003f001f03e0780fc000003fe01f% 03e0780fc000007fe01f03e0780fc00000ffe01f03e0780fc00000ffc01fffffffffc000% 01ffc01fffffffffc00001ff803fffffffffc00001ff803f0000000f800003df803f0000% 000f8000079f803f0000000038000f9f803f000000007c001f1f800000000000fe003e1f% 800000000001ff007c1fbfffffffffffff80f81f9fffffffffffff80e01f880000000000% 0000801f8000003000000000001f8000001c00000000001f8000f01e00000000001f8000% fc0f001e0000001f8000ff0f801f0000001f8060ff07c00f8000001f8060ff07e00fe000% 001f8060fe03e007f000001f8060fc03e003f800001f8060fc03f003fc00001f80e0fc03% f0c1fe00001f81e0fc03f0c0ff00001f81e0fc03e0e0ff00001f83e0fc01e0e07f00001f% 83e0fc0000e07f00001f87e0fc0000e03f00001f9fe0fc0001f03f00001fbfe0fc0001f0% 1f00001fbfe0fc0003f01f00001f9fe0fe0003f81800001f9fc0fffffff80000001f8380% fffffff80000001f80007ffffff80000001f80003ffffff00000001f80001ffffff00000% 001f8000000000000000001f0000000000000000>%% Unicode char "5fb7 \GC71:74:-3:61% G3641 <000000000003800000000000000003f00000000300000003fc00000003c0000003fc0000% 0003e0000003f800000007f0000003f800000007f0000003f000000007e0000003f00000% 0007e0000003f000000007c0000003f00000000fc0000003f00000000f80000003f00000% 001f00000003e00000001f00000003e000e0003e00038003e001f0003e00c3e003e001f8% 007c00e1f803e003fc007800f1fffffffffe00f801f9fffffffffe00f001fdf003e003fc% 01e003fff003e003f801e007fff003e003f001c007fdf003e003f003800ff9f003e003f0% 03001ff1f003e003f00f003fe1f003e003f01e01ffc1f003e003f0ffffff81f003e003f0% ffffff01f003e003f07ffcfe01f007e003f07ff0fc01f007c003f03fc1f801f007c003f0% 3c01f001f007e003f00003e001f00ff003f00003c001f00ff803f00007c001f00ffc03f0% 000f8001f00f9e03f0001f0001f01f9f83f0001e0001f01f0fc3f0003e0001f01f07e3f0% 007c0001f03e07e3f000f80001f03e03f3f001f00001f03c03f3f007e00ff9f07c03fbf0% 0fc3fff9f07803fbf01fffffc1f0f801fbf01fffff01f0f001fbf00ffff001f1f001fbf0% 0ffc0001f1e001fbf007f00001f3c000fbf007c00001f30000fbf002000001f600007bf0% 00000001f4000003f000000001f4000003f000000001f0000003f000000001f0000003f0% 000003fff0000003f00001fffff0000003f000fffff1f0000003f07fffffe1f0000003f0% 7ffffc01f0000003f07fffe001f0000003f03fff8001f0000003f03ff00001f0000003f0% 3f800001f0000007f01e000001f0003c07f010000001f0000ffff000000001f00003fff0% 00000001f000007ff000000001f000003ff000000001f000001ff000000001f000001fc0% 00000003f000000f80000000000000000e00>%% Unicode char "7eb3 ), ii, iv, vii, 2, 4, 30, 89, 138, 145, 159, 189, 196, 205, 226, 242, 316, 335, 373, 378, 384, 435, 477, 491, 584, 595, 599, 606, 636, 659, 661, 686, 694, 697, 722, 741, 764. % 47th Krishnamurthy, Edayathumangalam Venkataraman ({\tm\\103\\126\\175\\204\\127\\156\\316\\203\\141\\170\\207\\153 \\124\\210\\141\\170\\175\kern.05em\\205\\127\\203\\150 \\220\\315\\161\\176\\353\\155\\147\\227}), 278, 279. % 48th Landsberg, Joseph Montague, 715. % 48th Lewis, Harry Roy, 200. % 47th M\=adhava of Sangamagr\=ama ({\dn s\kern-.6em\raise.4em\hbox{\char21}gmg\llap{\char125}Amc\llap{\char3} mADv}), 198. % 48th Mendlovich, Eliezer Uri\indexbreak ({\heb\Hfz/\Hyy/\Hbb/\Hvv/\Hll/\Hdd/\Hnn/\Hmm/ \Hyy/\Hrr/\Hvv/\Haa/ \Hrr/\Hzz/\Hai/\Hyy/\Hll/\Haa/}), 667. % 48th \MIX\ computer, vi, 210. % 47th Multisets, 170, 473, 483, 697. % 47th N{\ii}lakantha Somayaji ({\dn nFlk{\char23}W somyAEj}), 198. % 48th OEIS\regtm: The On-Line Encyclopedia of Integer Sequences\regtm\ ({\tt oeis\period org}), 667. % 48th Oliveira e Silva, Tom\'as Ant\'onio Mendes, 386. % 48th R\'enyi, Alfr\'ed, 209. % 47th Strickland, Lloyd, 200. % 47th Thurber, Edward Gerrish, II, 466, 470, 477, 478. % 48th Walisch, Kim Georges, 667. % 48th \vfill \enddoublecolumns \endchange \bye [The next printing will be the 49th.] not listed above: pages 62, 63, 64, 65, 67 lots of places for \tt brackets after COUNT page 76 ex 12 too the change to page 198 also affects page 199 page 481 line -2: \tt [ and ] page 563 answer 12, \\ brackets the change to page 673 also affects page 674 page 692 lots of places for \tt brackets ARTICLES "TO APPEAR" THAT ARE STILL PENDING: (I last checked GIMPS in November 2023, they'd doublechecked up to 65.6M)