• Aucun résultat trouvé

T

N/A
N/A
Protected

Academic year: 2022

Partager "T"

Copied!
42
0
0

Texte intégral

(1)

COMPUTER PROGRAMMING

VOLUME 4 PRE-FASCICLE 4B

A DRAFT OF SECTION 7.2.1.7:

HISTORY OF COMBINATORIAL

GENERATION

DONALD E.KNUTH StanfordUniversity

ADDISON{WESLEY

6

77

(2)

Seealsohttp://www-s-faulty. sta nf or d. ed u/~ kn ut h/ sg b.h tm lforinformation

aboutTheStanfordGraphBase,inludingdownloadablesoftwarefordealingwiththe

graphsusedinmanyoftheexamplesinChapter7.

Anotherpage,http://www-s-faulty .s ta nf or d.e du /~ kn ut h/ pro gr am s. ht ml, on-

tainsauxiliaryprogramsbytheauthor.

Seealsohttp://www-s-faulty. sta nf or d. ed u/~ kn ut h/ mm ixw ar e. ht ml fordown-

loadablesoftwaretosimulatetheMMIXomputer.

Copyright

2004byAddison{Wesley

Allrightsreserved.Nopartofthispubliationmaybereprodued,storedinaretrieval

system,ortransmitted,inanyform, orby anymeans,eletroni, mehanial,photo-

opying, reording, or otherwise, without the prior onsent of the publisher, exept

that the oÆial eletroni le may be used to print single opies for personal (not

ommerial)use.

Zerothprinting(revision7),28Otober2005

(3)

I like to work in a variety of elds

inorder to spreadmy mistakes morethinly.

| VICTOR KLEE (1999)

This booklet ontains draft material that I'm irulating to experts in the

eld, in hopes that they an help remove its most egregious errors before too

many other people see it. I am also, however, posting it on the Internet for

ourageous and/or random readers who don't mind the risk of reading a few

pagesthathavenotyetreahedaverymaturestate. Beware: Thismaterialhas

notyetbeenproofreadasthoroughlyasthemanusriptsofVolumes1,2,and3

were at the time of theirrst printings. And those arefully-hekedvolumes,

alas,were subsequentlyfoundtoontainthousandsofmistakes.

Giventhisaveat, Ihopethatmyerrorsthistime willnotbesonumerous

and/orobtrusivethatyouwillbedisouragedfromreadingthematerialarefully.

Ididtrytomakeitbothinterestingandauthoritative,asfarasitgoes. Butthe

eldissovast,Iannothopetohavesurroundeditenoughtoorralitompletely.

ThereforeIbegyoutoletmeknowaboutanydeieniesyoudisover.

Toputthematerialinontext,thisisSetion7.2.1.7ofalong,longhapter

onombinatorialalgorithms. Chapter7willeventuallyllthreevolumes(namely

Volumes 4A, 4B, and 4C), assuming that I'm able to remain healthy. It will

begin with a short review of graph theory, with emphasis on some highlights

of signiant graphsin theStanford GraphBase, from whih I will bedrawing

manyexamples. Then omesSetion 7.1, whih deals withthetopi of bitwise

manipulations. (I drafted about 60 pages about that subjet in 1977, but

those pagesneedextensiverevision; meanwhile I'vedeidedto workfor awhile

on the material that follows it, so that I an get a better feel for how muh

to ut.) Setion 7.2 is about generating all possibilities, and it begins with

Setion7.2.1: GeneratingBasiCombinatorialPatterns|whih,inturn,begins

withSetion 7.2.1.1, \Generatingalln-tuples,"Setion7.2.1.2, \Generatingall

permutations," :::, Setion 7.2.1.6, \Generating all trees." (Readers of the

presentbookletshouldhavealreadylookedatthosesetions,draftsofwhihare

availableasPre-Fasiles2A,2B,3A,3B,and4A.)Thestageisnowset forthe

mainontentsofthisbooklet,Setion7.2.1.7: \Historyandfurther referenes."

Setion 7.2.2will dealwithbaktrakingingeneral. Andso it will ontinue,if

allgoeswell; anoutlineofthe entireChapter 7 asurrentlyenvisaged appears

onthetaop webpagethatisitedonpageii.

(4)

WritingabouthistoryisextraordinarilydiÆult,notonlybeausethesoure

materialsarewidelysatteredbutalsobeauseImustoperateatthelimitofmy

ability to understand languages other than English. Furthermore, fats about

reallifearemuhmoreompliatedthanfatsaboutmathematis. Nosummary

anadequatelyonveythetruefeelingsofaneraorthetruespiritofa ulture,

yet the story that I'm trying to tell in this setion overs many enturies of

developmentinmanydierentpartsoftheworld. Thestoryisfasinating,and

many partsof itdo notseemtohavebeentoldbefore, at leastnotinEnglish.

ThereforeI'mkeentohaveprofessionalhistoriansofmathematistakealookat

whatI'vebeenabletopiee together,hopingthattheywill notbetoo shoked

byblundersthathaveresultedfrommypresentignoraneand/orinompetene.

I hopealso to get advie from people of many dierent ultures whoknow of

relevanttraditionsthathavenotyetbeenwellstudiedbyprofessionalhistorians.

Theanswertoexerise 6posestwo historialproblemsthat Ihaven'tbeen

abletoresolve. Iurgentlyneedyourhelpalsowithrespettosomeexerisesthat

ImadeupasIwaspreparingthismaterial. Iertainlydon'tliketoreeiveredit

forthingsthathavealreadybeenpublishedbyothers,andmostoftheseresults

are quite natural \fruits" that were just waiting to be \pluked." Therefore

pleasetellmeifyouknowwhodeservestoberedited,withrespettotheideas

foundinexerises2,8,10,17,20, 26,and/or27.

Ishallhappilypayander'sfeeof$2.56foreaherrorinthisdraftwhenitis

rstreportedtome,whetherthaterrorbetypographial,tehnial,orhistorial.

ThesamerewardholdsforitemsthatIforgottoputintheindex. Andvaluable

suggestions forimprovementsto the text areworth 32/eah. (Furthermore, if

younda bettersolutiontoanexerise,I'llatuallyrewardyouwithimmortal

gloryinsteadofmeremoney,bypublishingyournameintheeventualbook: )

Cross referenes to yet-unwritten material sometimes appear as `00'; this

impossiblevalueisaplaeholderfortheatualnumberstobesuppliedlater.

Happyreading!

Stanford,California D.E.K.

12Otober 2004

(5)

[This subjet℄ has a relation

to almosteveryspeies of useful knowledge

that themindof man an beemployed upon.

| JAMES BERNOULLI,Ars Conjetandi (1713)

7.2.1.7. History and further referenes. Earlyworkon thegeneration of

ombinatorialpatterns beganas ivilizationitself wastaking shape. The story

isquitefasinating,andwewillseethatitspansmanyulturesinmanypartsof

theworld,withtiestopoetry,musi,andreligion.Thereisspaeheretodisuss

onlysome oftheprinipalhighlights;but perhaps a fewglimpsesinto thepast

willstimulatethereadertodigdeeperintotherootsofthesubjet,astheworld

getseversmallerandasglobalsholarshipontinuestoadvane.

Lists of binary n-tuples an be traed bak thousands of years to anient

China,India,and Greee. Themostnotablesoure|beauseitstillis a best-

sellingbook inmodern translations|is the Chinese I Ching or Yijing, whose

namemeans\theBibleofChanges." Thisbook,whihisoneofthevelassis

ofConfuianwisdom,onsistsessentiallyof2 6

=64hapters;andeahhapter

is symbolizedby a hexagramformed from sixlines, eah of whih is either

(\yin")or (\yang"). Forexample,hexagram1ispureyang, ; hexagram2

ispureyin, ;andhexagram64intermixesyinandyang,withyangontop: .

Hereistheompletelist:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32

33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48

49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64

(1)

Thisarrangementof the64possibilitiesisalledKingWen's ordering,beause

thebasitextoftheIChinghastraditionallybeenasribedtoKingWen(.1100

B.C.),thelegendaryprogenitoroftheChoudynasty. Anienttextsare,however,

notoriouslydiÆultto datereliably,and modernhistorianshavefoundnosolid

evidenethatanyoneatuallyompiledsuhalistofhexagramsbeforethethird

enturyB.C.

Notiethatthehexagramsof(1)ourinpairs: Thosewithoddnumbersare

immediatelyfollowedbytheirtop-to-bottomreetions,exeptwhen reetion

would make no hange; and the eight symmetrial diagrams are paired with

their omplements (1 = 2, 27 = 28, 29 = 30 , 61 = 62). Hexagrams that are

omposedfromtwotrigramsthatrepresentthefourbasielementsheaven( ),

earth( ),re( ),andwater( )havealsobeenplaedjudiiously. Otherwise

thearrangement appears to beessentially random, as if a person untrainedin

mathematis kept listing dierent possibilities until being unable to ome up

with any more. A few intriguingpatterns do exist between the pairs, but no

morethanarepresentbyoinideneinthedigitsof(see3.3{(1)).

(6)

Yinand yang represent omplementaryaspetsof theelementaryfores of

nature,alwaysintension,alwayshanging. TheIChing issomewhatanalogous

toathesaurusinwhihthehexagramsserveasanindextoaumulatedwisdom

aboutfundamentaloneptslikegiving( ), reeiving( ), modesty ( ),joy

( ), fellowship ( ), withdrawal ( ), peae ( ), onit ( ), organization

( ), orruption ( ), immaturity ( ), elegane ( ), et. One an hoose

a pair of hexagrams at random, obtaining the seond from the rst by, say,

independently hanging eah yin to yang (or vie versa) with probability1/4;

this tehnique yields 4096 ways to ponder existential mysteries, as well as a

Markovproessbywhihhangeitself mightperhapsgivemeaningtolife.

A stritly logialwayto arrange thehexagrams was eventuallyintrodued

aboutA.D.1060byShaoYung. Hisordering,whihproeededlexiographially

from to to to to toto to (readingeah hexagramfrom

bottomtotop),wasmuhmoreuser-friendlythantheKingWenorder,beause

a random pattern ould now be found quikly. When G. W. Leibniz learned

aboutthissequeneofhexagramsin1702,hejumpedtotheerroneousonlusion

that Chinese mathematiians had one been familiar with binary arithmeti.

[SeeFrankSwetz, Mathematis Magazine 76 (2003), 276{291. Further details

abouttheIChing anbefound,forexample,inJosephNeedham'sSieneand

CivilisationinChina2(CambridgeUniversityPress,1956),304{345;R.J.Lynn,

TheClassiofChanges(NewYork:ColumbiaUniversityPress,1994).℄

AnotheranientChinesephilosopher,YangHsiung,proposedasystembased

on81ternarytetragramsinsteadof64binaryhexagrams. HisCanonofSupreme

Mystery,written.2B.C.,hasreentlybeentranslatedintoEnglishbyMihael

Nylan (Albany, NewYork: 1993). Yang desribed a omplete, hierarhial ter-

narytreestrutureinwhihthereare3regions,with3provinesineahregion,

3departmentsineahprovine,3familiesineahdepartment,and9shortpoems

alled\appraisals"foreah family,hene729appraisalsinall|makingalmost

exatly2appraisalsforeveryday intheyear. Histetragramswerearrangedin

stritlexiographi order whenread top-to-bottom: , , , , , , ,

:::, . Infat,asexplainedonpage28ofNylan'sbook,Yangpresentedasimple

waytoomputetherankofeahtetragram,asifusingaradix-3numbersystem.

ThushewouldnothavebeensurprisedorimpressedbyShaoYung'ssystemati

orderingofbinaryhexagrams,although Shaolivedmorethan1000yearslater.

Indianprosody. Binaryn-tupleswerestudiedinaompletelydierentontext

bypunditsinanientIndia,whoinvestigatedthepoeti metersofsaredVedi

hants. Syllables in Sanskrit are either short (.) or long (_), and the study

of syllable patterns is alled \prosody." Modern writers use the symbols ^

and instead of. and _. A typial Vedi verse onsists of four lines with

nsyllablesperline,forsomen8;prosodiststhereforesoughtawaytolassify

all2 n

possibilities. ThelassiworkChandah

.

sastra byPingala,_ writtenbefore

A.D.400andprobablymuhearlier(theexatdateisquiteunertain),desribed

proedures by whih one ouldreadilyndtheindex k ofanygivenpattern of

^sand s,aswellastondthekthpattern,givenk. Inotherwords,Pingala_

explainedhow torank anygiven patternas wellas to unrank anygivenindex;

(7)

thushewentbeyondtheworkofYangHsiung,whohadonsideredrankingbut

not unranking. Pingala's_ methods were also related to exponentiation, as we

havenotedearlierinonnetionwithAlgorithm4.6.3A.

The next important step was taken by a prosodist named Kedara in his

workVr

.

ttaratnakara,thoughtto havebeenwritteninthe8thentury. Kedara

gave a step-by-step proedure for listing all then-tuples from ::: to

^ ::: to ^ ::: to ^^ ::: to ^::: to ^ ^:::

toto^^^:::^,essentiallyAlgorithm7.2.1.1Mintheaseofradix2. His

method may well have beenthe rst-ever expliit algorithm for ombinatorial

sequenegeneration. [SeeB.vanNooten,J.IndianPhilos.21(1993),31{50.℄

Poeti meters an also be regardedas rhythms,with one beat foreah ^

andtwo beatsforeah . Ann-syllablepatternan involvebetweennand2n

beats,butmusialrhythmssuitableformarhingordaninggenerallyarebased

ona xed numberof beats. Therefore itwas natural to onsider theset of all

sequenesof^sand sthathaveexatlymbeats,forxedm. Suh patterns

are now alledMorse ode sequenes of length m, and we know from exerise

4.5.3{32 that there are exatly F

m+1

of them. For example, the 21 sequenes

whenm=7are

^ , ^ ,^^^ , ^ , ^^ ^ ,

^ ^^ , ^^ ^ ,^^^^^ , ^,

^^ ^,^ ^ ^, ^^ ^, ^^^^ ^,

^ ^^, ^ ^^,^^^ ^^, ^^^,

^^ ^^^,^ ^^^^, ^^^^^,^^^^^^^.

(2)

InthiswayIndianprosodistswereledtodisovertheFibonaisequene,aswe

haveobservedinSetion1.2.8.

Moreover, the anonymous author of Prakr

.

ta Paingala (.1320) disovered

elegantalgorithmsfor rankingandunranking withrespet tom-beatrhythms.

To nd thekth pattern, one startsby writingdown m^s, then expressesthe

dierened=F

m+1

kasa sumofFibonainumbersF

j

1

++F

j

t

;hereF

j

1

isthelargestFibonainumberthatisdandF

j

2

isthelargestd F

j

1 ,et.,

ontinuinguntiltheremainderiszero. Thenbeatsj 1andjaretobehanged

from^^ to , forj =j

1 , :::, j

t

. Forexample, togetthe 5thelementof (2)

weompute21 5=16=13+3=F

7 +F

4

;theansweris^^ ^ .

A few yearslater, Narayan

. a Pan

. d

.

itatreated the more generalproblem of

ndingall ompositions of m whose parts are q, where q is any givenposi-

tiveinteger. As a onsequene he disovered the qth-order Fibonai sequene

5.4.2{(4), whih was destined to be used 600 years later in polyphase sorting;

he also developed the orresponding ranking and unranking algorithms. [See

ParmanandSingh,HistoriaMathematia12 (1985),229{244, andexerise16.℄

Pingala_ gavespeialode-namestoallthethree-syllablemeters,

= m (m), ^ = t (t),

^ = y (y), ^ ^ = j(j),

^ = r (r), ^^ = B (bh),

^^ = s(s), ^^^ = n (n),

(3)

(8)

and students of Sanskrit have been expeted to memorize them ever sine.

Somebody long ago devised a lever way to reall these odes, by inventing

thenonsense wordyamatarajabhanasalagam (ymAtArAjBAnslgAm);thepoint

isthatthetensyllablesofthiswordan bewritten

ya

^

ma ta ra ja

^ bha na

^ sa

^ la

^ gam

(4)

and eah three-syllable pattern ours just after its ode name. Theorigin of

yama:::lagam is obsure, but Subhash Kak [Indian J. History of Siene 35

(2000),123{127℄ hastraedit bakat leastto C. P.Brown'sSanskrit Prosody

(1869),page28;thusitqualiesastheearliestknownappearaneofa\deBruijn

yle"that enodesbinaryn-tuples.

Meanwhile, in Europe. Inasimilarway, lassiGreekpoetry wasbasedon

groupsofshortand/orlongsyllablesalled\metrialfeet,"analogoustobarsof

musi. Eah basi typeof foot aquired a Greekname; forexample, two short

syllables`^^'werealledapyrrhi,andtwolongsyllables` 'werealleda

spondee,beausethoserhythmswereusedrespetivelyinasongofwar(purrqh)

orasongofpeae(sponda). Greeknamesformetrifeetweresoonassimilated

intoLatinandeventuallyintomodernlanguages, inludingEnglish:

^ arsis

thesis

^^ pyrrhi

^ iambus

^ trohee

spondee

^^^ tribrah

^^ anapest

^ ^ amphibrah

^ bahius

^^ datyl

^ amphimaer

^ palimbahius

molossus

^^^^ proeleusmati

^^^ fourth pon

^^ ^ third pon

^^ minor ioni

^ ^^ seond pon

^ ^ diiambus

^ ^ antispast

^ rstepitrite

^^^ rstpon

^^ horiambus

^ ^ ditrohee

^ seond epitrite

^^ majorioni

^ third epitrite

^ fourth epitrite

dispondee

(5)

Alternative names, like \horee" instead of \trohee," or \reti" instead of

\amphimaer,"werealsoinommonuse. Moreover,bythetimeDiomedeswrote

his Latin grammar (approximately A.D. 375), eah of the 32 ve-syllable feet

hadaquiredatleastonename. Diomedesalsopointedouttherelationbetween

omplementarypatterns; hestated forexamplethat tribrahand molossusare

\ontrarius," as areamphibrah and amphimaer. Buthe alsoregardeddatyl

as the ontrary of anapest,and bahius as the ontrary of palimbahius, al-

thoughtheliteralmeaningofpalimbahiusisatually\reversebahius." Greek

prosodistshadnostandardorderinwhihtolisttheindividualpossibilities,and

(9)

theform ofthenamesmakesitlearthatnoonnetiontoaradix-twonumber

systemwas ontemplated. [See H. Keil,Grammatii Latini 1 (1857),474{482;

W.vonChrist,MetrikderGriehenundRomer (1879),78{79.℄

Surviving fragmentsof a work by Aristoxenus alled Elementsof Rhythm

(.325 B.C.) showthat thesame terminologywas applied also to musi. And

indeed,thesametraditionslivedonaftertheRenaissane;forexample,wend

onpage 32of AthanasiusKirher's Musurgia Universalis 2(Rome: 1650),and

Kirherwentontodesribeallofthethree-noteandfour-noterhythmsof(5).

Earlylistsofpermutations. We'vetraedthehistoryofformulasforounting

permutations in Setion 5.1.2; but nontrivial lists of permutations were not

publisheduntilhundreds ofyearsafter theformulan!wasdisovered. Therst

suhtabulationurrentlyknownwasompiledbytheItalianphysiianShabbetai

DonnoloinhisommentaryonthekabbalistiSeferYetzirah,writteninA.D.946.

Table1showshislistforn=5asitwassubsequentlyprintedinWarsaw(1884).

(TheHebrewletters inthis table are typeset ina rabbinial font traditionally

usedfor ommentaries; notie that theletter hangesits shapeto when it

appears at the left end of a word.) Donnolowent on to list 120 permutations

of the six-letter word , all beginning with shin ( ); then he noted that

120more ouldbeobtainedwitheahofthe othervelettersinfront, making

720inall. His listsinvolvedgroupingsofsixpermutations,but inahaphazard

fashion that led him into error (see exerise 4). Although he knew how many

permutationsthereweresupposedtobe,andhowmanyshouldstartwithagiven

letter,heevidentlydidn'thaveanalgorithmforgeneratingthem.

Table1

AMEDIEVAL LIST OF PERMUTATIONS

Aompletelistofall720 permutationsoffa;b;;d;e;fgappearedonpages

668{671ofJeremiasDrexel'sOrbisPhaethon(Munih:1629;alsoonpages526{

531of theCologneeditionin1631). Heoereditas proofthat a manwith six

guests ouldseat them dierentlyat lunh and dinner every day for a year|

(10)

altogether360 days, beause therewerevedays offasting duringHolyWeek.

Shortly afterwards, Marin Mersenne exhibited all 720 permutations of the six

tones fut;re;mi;fa;sol;lag, on pages 111{115 of his Traitez de la Voix et des

Chants (Volume 2 of Harmonie Universelle, 1636); then on pages 117{128 he

presentedthesamedatainmusialnotation:

Drexel's table was organized lexiographially by olumns; Mersenne's tables

werelexiographiwithrespettotheorderut<re<mi<fa<sol<la,begin-

ningwith\ut,re,mi,fa,sol,la"andendingwith\la,sol,fa,mi,re,ut." Mersennealso

prepared a \grandetimmense" manusript that listedall 40,320permutations

ofeight noteson672foliopages,followedbyrankingandunrankingalgorithms

[BibliothequenationaledeFrane,FondsFranais, no.24256℄.

We sawin Setion 7.2.1.2 that the important ideaof plain hanges, Algo-

rithm7.2.1.2P,was inventedinEnglandafewyearslater.

Methods for listing all permutations of a multiset with repeated elements

wereoftenmisunderstoodbyearlyauthors. Forexample,whenBhaskaraexhib-

itedthepermutationsoff4;5;5;5;8ginsetion271ofhis L

l avat

(.1150),he

gavetheminthefollowingorder:

48555 84555 54855 58455 55485

55845 55548 55584 45855 45585

45558 85455 85545 85554 54585

58545 55458 55854 54558 58554

(6)

Mersenneused a slightlymore sensiblebut notompletely systematiorderon

page 131 of his book when he listed sixty anagrams of the Latin name IESVS.

When Athanasius Kirher wanted to illustrate the 30 permutations of a ve-

notemelodyonpages10and11ofMusurgiaUniversalis2(1650),thislakofa

systemgothimintotrouble(seeexerise5):

(7)

But John Wallis knew better. On page 117 of his Disourse of Combinations

(1685)heorretlylistedthe60anagramsof\messes" inlexiographiorder,if

weletm<e<s;andonpage126hereommendedrespetingalphabetiorder

\thatwemaybethemore sure,nottomiss any."

Wewill seelaterthat theIndian mathematiianNarayan

. a Pan

. d

.

itahadal-

readydevelopedatheoryofpermutationgenerationinthe14thentury,although

hisworkremainedalmosttotallyunknown.

(11)

Seki'slist. TakakazuSeki(1642{1708)wasaharismatiteaherandresearher

whorevolutionizedthe studyof mathematis in17th-enturyJapan. Whilehe

wasstudyingtheeliminationofvariablesfromsimultaneoushomogeneousequa-

tions, he was led to expressions suh as a

1 b

2 a

2 b

1 and a

1 b

2

3 a

1 b

3

2 +

a

2 b

3

1 a

2 b

1

3 +a

3 b

1

2 a

3 b

2

1

, whih we now reognize as determinants.

In1683 he published a booklet about this disovery, introduing an ingenious

shemeforlistingallpermutationsinsuhawaythathalfofthemwere\alive"

(even)andtheotherhalfwere\dead"(odd).Startingwiththeasen=2,when

`12'wasaliveand`21'was dead,heformulatedthefollowingrulesforn>2:

1) Takeeverylivepermutationforn 1,inreaseallitselementsby1,andinsert

1infront. Thisruleprodues(n 1)!=2\basipermutations"off1;:::;ng.

2) Fromeahbasipermutation,form2n othersbyrotation andreetion:

a

1 a

2 :::a

n 1 a

n

; a

2 :::a

n 1 a

n a

1

; :::; a

n a

1 a

2 :::a

n 1

; (8)

a

n a

n 1 :::a

2 a

1

; a

1 a

n a

n 1 :::a

2

; :::; a

n 1 :::a

2 a

1 a

n

: (9)

Ifnisodd,thoseintherstrowarealiveandthoseintheseondaredead;

ifniseven,thoseineahrowarealternativelyalive,dead,:::,alive,dead.

For example, when n = 3 the only basi permutation is 123. Thus 123, 231,

312arealivewhile321,132,213aredead,andwe'vesuessfullygeneratedthe

sixtermsof a 33 determinant. Thebasi permutations forn=4 are 1234,

1342,1423;andfrom,say,1342wegeta setofeight,namely

+1342 3421+4213 2134+2431 1243+3124 4321; (10)

alternatelyalive(+) anddead( ). A44 determinantthereforeinludes the

termsa

1 b

3

4 d

2 a

3 b

4

2 d

1

+ a

4 b

3

2 d

1

andsixteenothers.

Seki's rulefor permutation generation isquite pretty, but unfortunately it

hasa serious problem: It doesn't work when n > 4. His error seems to have

goneunreognizedforhundreds ofyears. [SeeY. Mikami,TheDevelopment of

Mathematis in China and Japan (1913), 191{199; Takakazu Seki's Colleted

Works(Osaka:1974),18{20, :: ;andexerises 7{8.℄

Listsofombinations. Theearliestexhaustivelistofombinations knownto

havesurvivedtheravagesoftimeappearsinthelastbookofSusruta'swell-known

Sanskrittreatise onmediine,Chapter63, writtenbeforeA.D.600andperhaps

muh earlier. Noting that mediine an be sweet, sour, salty, peppery, bitter,

and/or astringent, Susruta's book diligently listed the (15;20;15;6;1;6) ases

thatarisewhenthosequalitiesourtwo,three,four,ve,six,andoneatatime.

Bhaskararepeatedthisexampleinsetions110{114ofL

lavat

,andobserved

thatthesamereasoningappliestosix-syllablepoetimeterswithagivennumber

oflongsyllables. Buthesimplymentionedthetotals,(6;15;20;15;6;1),without

listingtheombinations themselves. Insetions274 and 275,heobservedthat

thenumbers(n)(n 1):::(n k+1)=(k(k 1):::(1))enumerateompositions

(thatis,orderedpartitions)aswellasombinations;againhegavenolist.

To avoidprolixity thisis treatedina brief manner;

for thesieneof alulationis an oeanwithout bounds.

| Bhaskara (.1150)

(12)

Anisolatedbut interestinglistofombinationsappearedintheremarkable

algebra text Al-Bahir 'l-h

.

isab (TheShining Book of Calulation), writtenby

al-Samaw'alof Baghdad when hewas only19 yearsold (1144). Inthe losing

partofthatworkhepresentedalistof 10

6

=210simultaneouslinearequations

in10unknowns:

Al-Samaw'al'sArabioriginal Equivalentmodernnotation

65 654321 m (1) x1+x2+x3+x4+x5+x6=65

70 754321 o (2) x1+x2+x3+x4+x5+x7=70

75 854321 ~ (3) x1+x2+x3+x4+x5+x8=75

.

.

.

.

.

.

91 1098764 ¢ (209)x

4 +x

6 +x

7 +x

8 +x

9 +x

10

=91

100 1098765 ݐ (210)x

5 +x

6 +x

7 +x

8 +x

9 +x

10

=100 (11)

Eah ombination of ten things taken six at a time yielded one of his equa-

tions. Hispurposewasevidentlytodemonstratethatover-determinedequations

an still have a unique solution|whih in this ase was (x

1

;x

2

;:::;x

10 ) =

(1;4;9;16;25;10;15;20;25;5). [Salah Ahmad and Roshdi Rashed,Al-Bahir en

Algebred'As-Samaw'al(Damasus:1972),77{82, 248{231.℄

Rolling die. Some glimmerings of elementary ombinatoris arose also in

medievalEurope,espeiallyinonnetionwiththequestionoflistingallpossible

outomeswhen three dieare thrown. There are, of ourse, 8

3

= 56 ways to

hoose3thingsfrom6whenrepetitionsareallowed. GamblingwasoÆiallypro-

hibited;yetthese56waysbeameratherwellknown. InaboutA.D.965,Bishop

Wibold ofCambrai innorthernFrane deviseda gamealledLudus Clerialis,

so that members of the lergy ould enjoy rolling die while remaining pious.

Hisideawasto assoiateeah possiblerollwithone of56virtues,aording to

thefollowingtable:

q q q

love

q

q q

q

q q q

q q q

perseverane q q

q q

q

q q

q q

q hospitality q q

q

q q q

q q q q

q q q

mortiation

q q

q q

faith

q

q q q

q q q q

q kindness q q

q q

q

q q q

q q q

eonomy q q

q

q q

q q

q q q

q q

q innoene

q q

q q

q

hope

q

q q q

q q q

q q

q modesty q q

q q q

q q q q

q patiene q q

q

q q

q q

q q q q

q q q

ontrition

q q

q q q

q justie

q

q q q

q q q q

q q q

resignation q q

q q q

q q q

q q

q zeal q

q q

q q q

q q q

q q q

q q q

onfession

q q

q q

q q

q prudene q

q q

q q

q q q

q q

q gentleness q q

q q q

q q q q

q q q

poverty q q q

q q q q

q q q q

q maturity

q q

q q q

q q q

temperane q

q q

q q

q q q q

q q q

generosity q q

q q

q q

q q q

q q

q softness q q q

q q q q

q q q

q q

q soliitude

q

q q

q q

ourage q

q q q

q q q

q q q

q q q

wisdom q

q

q q

q q

q q q q

q q q

virginity q q q

q q q q

q q q q

q q q

onstany

q

q q

q q

q

peae q

q

q q

q q

remorse q q

q q q

q q q

q q q

q q q

respet q q q

q q q

q q

q q q

q q

q intelligene

q

q q

q q q

q hastity q q

q q

q q

q

joy q

q q

q q

q

q q

q

piety q

q q

q q q

q q

q q q q

q q q

sighing

q

q q

q q

q q

q mery q

q

q q

q q q

q sobriety q q

q

q q

q

q q q

q indulgene q q q

q q q q

q q q

q q q

q q q

weeping

q

q q

q q q

q q q

obediene q q

q q

q q

q q

q satisfation q q

q

q q

q

q q

q q

q prayer q q

q q

q q q

q q

q q q

q q

q heerfulness

q

q q

q

q q

q

fear q

q

q q

q q q

q q q

sweetness q q

q

q q

q

q q q

q q q

aetion q q

q q

q q q

q q

q q q q

q q q

ompassion

q

q q

q

q q q

q foresight q q

q q

q

q q

q

leverness q q

q

q q q

q q q q

q judgment q q

q q

q q q q

q q q

q q q

q q q

self-ontrol

q

q q

q

q q

q q

q disretion q q

q q

q

q q q

q simpliity q q

q

q q q

q q q

q q

q vigilane q q q

q q q

q q q

q q q

q q q

q q q

humility

Playerstookturns,andthersttorolleahvirtueaquiredit. Afterallpossibil-

itieshadarisen,themostvirtuousplayerwon. Wiboldnotedthatlove(aritas)

is the best virtue of all. He gavea ompliated soring system by whih two

virtuesouldbeombinedifthesumofpipsonallsixoftheirdie was 21;for

(13)

example,love+humility or hastity+intelligeneould bepairedin thisway,

andsuh ombinationsrankedaboveany individual virtue. Healsoonsidered

moreomplexvariantsofthegameinwhihvowelsappearedonthedieinstead

ofspots,so thatvirtuesouldbelaimediftheirvowelswerethrown.

Wibold's table of virtues was presented in lexiographi order, as above,

when it was rst desribed by Balderi in his Chronion Cameraense, about

150yearslater. [PatrologiaLatina134(Paris:1884), 1007{1016.℄ Butanother

medievalmanusriptpresentedthepossibledierollsinquitea dierentorder:

q q q

q q q

q q q

q q q

q q q

q q q

q q

q q

q q q

q q

q q q

q q

q q q q

q q q q

q q q q

q q q

q

q q

q

q q

q

q q

q q

q q

q q q

q q q

q q q

q q q

q q q

q q

q q

q

q q q

q q q

q q q

q q q

q q q

q q q q

q q q

q q q

q q q

q q

q

q q q

q q q

q q q

q q q

q q

q q q

q q q

q q q

q q q

q

q q

q q

q q q

q q

q q q q

q q q

q q

q q

q q q

q q

q q q q

q q q

q q

q q q

q q

q q q

q

q q

q q

q q q

q q

q q q

q q

q q

q q q

q q

q q

q q q

q q q q

q q q q

q q q

q q q

q q q q

q q q

q q

q q q q

q q q q

q q q

q

q q q

q q q q

q q q

q q q

q q q q

q q

q q

q

q q

q

q q q

q q q

q q

q

q q

q

q q

q q

q q q

q

q q

q

q q q

q q q

q

q q

q

q q

q q

q

q q

q

q

q q

q q

q q q

q q q

q q

q q

q q

q q

q

q q

q q

q q q

q q q

q q

q q

q

q q

q q

q q q

q q q

q q q

q q

q q

q q

q q q

q q q

q q q

q q

q

q q

q q

q q q

q q q

q q

q q

q q q q

q q q

q q

q q q q

q q q

q

q q q

q q q

q

q q

q q

q

q q

q

q q q

q q q

q q q

q q q

q q q

q q q

q q q

q q

q q q

q q q

q q

q

q

q q

q q

q q q

q

q

q q q

q q q

q q

q q

q q q

q

q q q

q q q

q q

q q

q q q

q q q

q q q

q q

q q

q q

q q q

q q q

q q

q

q q

q q

q q q

q

q q q

q q q

q

q q

q q

q q q q

q q q

q q

q q

q q q q

q q

q q q

q q q

q q q

q q q

q

q q q

q q q

q

q

q q q

q q q

q q

q

q q

q q

q q

q q q

q

q q

(12)

Inthisasetheauthor knewhow todealwith repeatedvalues, buthad a very

ompliated,adhowaytohandletheasesinwhihalldieweredierent. [See

D.R.Bellhouse,InternationalStatistialReview 68(2000),123{136.℄

An amusing poem entitled \Chaune of the Dyse," attributed to John

Lydgate, was writtenin the early 1400s for use at parties. Its opening verses

invite eah person to throw three die; then the remaining verses, whih are

indexedindereasinglexiographiorderfrom q q q

q q q

q q q

q q q

q q q

q q q

to q q q

q q q

q q q

q q q

q q

q q

q toto q q q

,

give56 harater skethes that light-heartedly desribe thethrower. [The full

text was published by E. P. Hammond in Englishe Studien 59 (1925), 1{16;

atranslationintomodernEnglishwouldbedesirable.℄

Iprayto god that euery wightmayaste

Vpon three dyseryght asis in hysherte

Whether he be rehelesse or stedfaste

Somootehe lawghen outher elles smerte

He that is giltyhis lyfe to onverte

Theythat introuthe hauesuredmany athrowe

Mootether haune fal asthey moote be knowe.

|The Chaune of the Dyse (.1410)

Ramon Llull. Signiant ripples of ombinatorial onepts also emanated

fromanenergeti and quixotiCatalanpoet,novelist,enylopedist,eduator,

mysti,andmissionarynamedRamonLlull (.1232{1316). Llull's approahto

knowledge was essentially to identifybasi priniplesand then to ontemplate

ombiningthem inallpossibleways.

For example, one hapter in his Ars Compendiosa Inveniendi Veritatem

(.1274)beganbyenumeratingsixteenattributesofGod: Goodness,greatness,

eternity,power,wisdom,love,virtue,truth,glory,perfetion,justie,generosity,

mery, humility, sovereignty, and patiene. Then Llull wrote 16

2

=120 short

essaysofabout80wordseah,onsideringGod'sgoodnessasrelatedtogreatness,

(14)

God'sgoodnessasrelatedtoeternity,andsoon,endingwithGod'ssovereigntyas

relatedtopatiene. Inanotherhapterheonsideredsevenvirtues(faith,hope,

harity,justie,prudene,fortitude,temperane)andsevenvies(gluttony,lust,

greed, sloth,pride, envy, anger), with 14

2

=91 subhapters todeal witheah

pairinturn. Other hapters were systematiallydividedina similar way, into

8

2

=28, 15

2

=105, 4

2

=6,and 16

2

=120subsetions. (Onewonders what

might have happened if he had beenfamiliar with Wibold's list of 56 virtues;

would hehaveproduedommentariesonall 56

2

=1540oftheirpairs?)

Fig. 44. Illustrationsinamanusriptpresentedby Ramon Llullto

thedogeofVeniein1280. [FromhisArsDemonstrativa,Bibliotea

Mariana,VI200,folio3 v

.℄

Llullillustratedhismethodologybydrawingirulardiagramslikethosein

Figure 44. Theleft-handirle inthis illustration, Deus, namessixteen divine

attributes|essentiallythesame sixteen listedearlier, exeptthat love(amor)

wasnowalledwill(voluntas),andthenalfourwerenowrespetivelysimpliity,

rank, mery, and sovereignty. Eah attribute is assigned a ode letter, and

the illustration depits their interrelations as the omplete graph K

16

on ver-

ties (B;C;D;E;F;G;H;I;K;L;M;N;O;P;Q;R). The right-hand gure, virtutes

etvitia,showsthesevenvirtues(b;;d;e;f;g;h)interleavedwiththesevenvies

(i;k;l;m;n;o;p);in theoriginalmanusript virtuesappeared inblue ink while

vies appeared in red. Notie that in this ase his illustration depited two

independentompletegraphs K

7

, one ofeah olor. (Henolonger bothered to

ompareeahindividualvirtuewitheahindividualvie,sineeveryvirtuewas

learlybetterthaneveryvie.)

Llull used the same approah to write about mediine: Instead of juxta-

posing theologial onepts, his Liber Prinipiorum Mediin (.1275) on-

sidered ombinations of symptoms and treatments. And he also wrote books

(15)

Fig.45. Llullianillustrations

fromamanusriptpresentedto

thequeenofFrane,.1325.

[BadisheLandesbibliothekKarls-

ruhe,CodexSt.Peterperg.92,

folios28 v

and39 v

.℄

onphilosophy, logi, jurisprudene, astrology, zoology, geometry, rhetori, and

hivalry|morethan200worksinall. Itmustbeadmitted,however,thatmuh

ofthismaterialwashighlyrepetitive;moderndataompressiontehniqueswould

probablyredue Llull'soutputtoasize muh lessthanthatof, say,Aristotle.

He eventually deided to simplify his system by working primarily with

groupsofninethings. See,forexample,Fig.45,whereirleAnowlistsonlythe

rstnine of God's attributes (B;C;D;E;F;G;H;I;K). The 9

2

= 36assoiated

pairs(BC;BD;:::;IK)appearinthestairstephartattherightofthatirle. By

addingtwomorevirtues,namelypatieneandompassion|aswellastwomore

vies, namelylying and inonsisteny|he ouldtreat virtuesvis-a-vis virtues

andviesvis-a-vis vies withthesame hart. Healso proposed usingthesame

hart to arry out an interesting sheme for voting, in an eletion with nine

andidates[see I.MLeanandJ.London, StudiaLulliana32(1992),21{37℄.

The enirled triangles at the lower left of Fig. 45 illustrate another key

aspetofLlull'sapproah. Triangle(B;C;D)standsfor(dierene,onordane,

ontrariness);triangle(E;F;G)standsfor(beginning,middle,ending);andtrian-

gle(H;I;K)standsfor(greater,equal,less). Thesethreeinterleavedappearanes

ofK

3

representthreekindsofthree-valuedlogi. Llullhadexperimentedearlier

with other suh triplets, notably `(true, unknown, false)'. We an get an idea

(16)

ofhowhe usedthe trianglesbyonsidering howhe dealt withombinationsof

thefour basi elements(earth, air,re, water): Allfour elementsare dierent;

earth is onordant with re, whih onords with air, whih onords with

water, whih onordswithearth; earth isontrary to air,and reis ontrary

to water; these onsiderations omplete an analysis with respet to triangle

(B;C;D). Turningtotriangle(E;F;G),henotedthatvariousproessesinnature

beginwith one element dominating another; then a transition or middle state

ours,until agoalisreahed, likeairbeoming warm. For triangle(H;I;K)he

said that in general we have re >air > water > earth with respet to their

\spheres," their \veloities," and their \nobilities"; nevertheless we also have,

for example, air >re with respet to supporting life, while airand rehave

equalvaluewhentheyareworkingtogether.

LlullprovidedthevertialtableattherightofFig.45asafurtheraid. (See

exerise11 below.) Healsointroduedmovableonentriwheels,labeledwith

the letters (B;C;D;E;F;G;H;I;K) and with other names, so that many things

ould be ontemplated simultaneously. In this way a faithful pratitioner of

the Llullian art ould be sure to have all the bases overed. [Llull may have

seen similar wheels that were used innearby Jewish ommunities;see M.Idel,

J.WarburgandCourtauldInstitutes51(1988),170{174andplates 16{17.℄

Severalenturieslater,AthanasiusKirherpublishedanextensionofLlull's

system as part of a large tome entitled Ars Magna Siendisive Combinatoria

(Amsterdam: 1669), with ve movable wheels aompanying page 173 of that

book. KirheralsoextendedLlull'srepertoireofompletegraphsK

n

byprovid-

ingillustrationsofompletebipartitegraphsK

m;n

;forexample,Fig.46istaken

from page 171 of Kirher's book, and his page 170 ontains a glorious piture

ofK

18;18 .

Fig.46. K9;9 aspre-

sentedbyAthanasius

Kirherin1669.

It is an investigative andinventive art.

When ideas areombined in allpossibleways,

thenewombinations start themindthinkingalongnovelhannels

and oneisled to disoverfresh truths andarguments.

|MARTIN GARDNER,Logi MahinesandDiagrams (1958)

The most extensive modern development of Llull-like methods is perhaps

TheShillingerSystemofMusialCompositionbyJosephShillinger(NewYork:

(17)

Carl Fisher, 1946), a remarkable two-volume work that presents theories of

rhythm, melody, harmony, ounterpoint,omposition,orhestration, et., from

a ombinatorial perspetive. On page 56, for example, Shillinger lists the 24

permutations offa;b;;dgin theGray-ode orderof plain hanges (Algorithm

7.2.1.2P);thenonpage57heappliesthemnottopithesbutrathertorhythms,

tothedurationsofnotes. Onpage364heexhibitsthesymmetrialyle

(2;0;3;4;2;5;6;4;0;1;6;2;3;1;4;5;3;6;0;5;1); (13)

a universal yle of 2-ombinations for the seven objets f0;1;2;3;4;5;6g; in

otherwords,(13)is anEulerian trailinK

7 : All

7

2

=21 pairsof digitsour

exatly one. Suh patterns are grist for a omposer's mill. But we an be

gratefulthatShillinger'sbetterstudents(likeGeorgeGershwin)didnotommit

themselvesentirelyto astritlymathematialsenseof aesthetis.

Taquet, van Shooten, and Izquierdo. Threeadditionalbooksrelatedto

ourstorywerepublishedduringthe1650s. AndreTaquetwroteapopulartext,

ArithmetiTheoriaetPraxis (Louvain:1656),that wasreprintedandrevised

oftenduringthenextftyyears. Neartheend,onpages376and377,hegavea

proedureforlistingombinationstwo ata time,thenthreeata time,et.

FransvanShooten'sExeritationesMathemati(Leiden:1657)wasmore

advaned. Onpage373 helistedallombinationsinanappealinglayout

a

b:ab

:a:b:ab

d:ad:bd:abd:d: ad:bd:abd

(14)

andheproeededonthenextfewpagesto extendthis patternto theletterse,

f,g,h,i,k,\etsiininnitum." Onpage376heobservedthatoneanreplae

(a;b;;d)by(2;3;5;7)in(14)togetthedivisorsof210 thatexeedunity:

2

3 6

5 10 15 30

7 14 21 42 35 70 105 210

(15)

Andonthefollowingpageheextendedtheideato

a

a:aa

b:ab: aab

:a:aa:b: ab:aab

(16)

therebyallowingtwoa's. Hedidn'treallyunderstandthisextension,though;his

nextexample

a

a:aa

a:aaa

b:ab:aab: aaab

b:bb:abb:aabb:aaabb

(17)

wasbothed,indiatingthelimitsofhisknowledgeatthetime. (Seeexerise13.)

(18)

Onpage411vanShootenobservedthattheweights(a;b;;d)=(1;2;4;8)

ouldbeassignedin(14),leadingto

1

2 3

4 5 6 7

8 9 10 11 12 13 14 15

(18)

afteraddition. Buthedidn'tseetheonnetionwithradix-2arithmeti.

Sebastian Izquierdo's two-volume work Pharus Sientiarum (Lyon: 1659),

\TheLighthouseofSiene,"inludedanielyorganizeddisussionofombina-

torisentitledDisputatio29,DeCombinatione. Hegaveadetaileddisussionof

four key parts of Stanley'sTwelvefold Way, namelythe n-tuples, n-variations,

n-multiombinations,and n-ombinationsof mobjetsthat appear intherst

tworowsandthersttwo olumnsofTable7.2.1.4{1.

InSetions81{84ofDeCombinationehelistedallombinationsofmletters

takennata time,for2n5 andnm9,alwaysinlexiographi order;

healsotabulated themfor m=10and20intheases n=2and 3. Butwhen

he listed the m n

variations of m things taken n at a time, he hose a more

ompliatedordering(seeexerise14).

Izquierdowas rstto disovertheformula

m+n 1

n

for ombinationsof m

thingstakennatatimewithunlimitedrepetition;thisruleappearedinx48{x51

ofhiswork. Butinx105,whenheattemptedtolistallsuhombinationsinthe

asen = 3,he didn't know that there was a simpleway to doit. In fat, his

listingofthe56asesform=6wasratherliketheold,awkwardorderingof(12).

Combinations with repetition were not well understood until James Ber-

noulli'sArsConjetandi, \TheArt ofGuessing," ame outin1713. InPart2,

Chapter 5, Bernoulli simply listed the possibilitiesin lexiographi order, and

showed thattheformula

m+n 1

n

followsbyindutionasaneasyonsequene.

[NioloTartagliahad,inidentally,omelosetodisoveringthisformulainhis

Generaltrattatodinumeri,etmisure 2(Venie:1556),17 r

and 69 v

;sohadthe

MaghrebimathematiianIbnMun`iminhis 13th-enturyFiqhal-H

. isab.℄

Thenullase. Beforeweonludeourdisussionofearlyworkonombinations,

we should notforget a small yetnoble steptakenby John Wallison page 110

of his Disourse of Combinations (1685), where he speially onsidered the

ombination ofm things taken0 at a time: \It ismanifest, That,if wewould

takeNone,thatis,ifwewouldleaveAll;thereanbebutoneasethereof,what

everbetheNumberofthingsexposed." Furthermore,onpage113,heknewthat

0

0

=1: \(for,here,totakeall,orto leaveall,isbutoneandthesame ase.)"

However,when hegavea table ofn! forn24, hedidnotgo so faras to

pointoutthat0!=1,orthatthereisexatlyonepermutationoftheemptyset.

The workofNarayan

.

a. AremarkablemonographentitledGan

.

itaKaumud

(\TreatiseonCalulation"),writtenbyNarayan

. aPan

. d

.

itain1356,hasreently

beome known in detail to sholars outside of India for the rst time, thanks

to anEnglishtranslationbyParmanandSingh[Gan

.

itaBharat 20(1998), 25{

82; 21 (1999), 10{73; 22 (2000), 19{85; 23 (2001), 18{82; 24 (2002), 35{98℄.

(19)

Chapter13ofhiswork,subtitledAnka_ Pasa(\ConatenationofNumbers"),was

devoted to ombinatorial generation. Indeed, although the97 \sutras" of this

hapterwereratherrypti,theypresentedaomprehensivetheoryofthesubjet

thatantiipateddevelopmentsintherestoftheworldbyseveralhundredyears.

Forexample,Narayan

.

adealtwithpermutationgenerationinsutras49{55a,

wherehegavealgorithmstolistallpermutationsofasetindereasingolexor-

der,togetherwithalgorithmstorankagivenpermutationandtounrankagiven

serialnumber. Inthis wayheessentiallydisoveredthefatorialrepresentation

ofpositiveintegers. Theninsutras57{60heextendedthealgorithmstohandle

generalmultisets;forexample,helistedthepermutationsoff1;1;2;4gas

1124;1214;2114;1142;1412;4112;1241;2141;1421;4121;2411;4211;

againindereasingolexorder.

Narayan

.

a's sutras88{92 dealt withsystematigenerationofombinations.

Besidesillustratingtheombinationsoff1;:::;8gtaken3ata time,namely

(678;578;478;:::; 134;124;123);

healsoonsideredabit-stringrepresentationoftheseombinationsinthereverse

order(inreasing olex):

(11100000;11010000;10110000;:::;00010011;00001011;00000111):

Healmost,butnotquite,disovered Theorem7.2.1.3L.

Thus we an legitimately regard Narayan

. a Pan

. d

.

ita as the founder of the

sieneofombinatorialgeneration|eventhough,likemanyotherpioneerswho

were signiantly\aheadof theirtime," hiswork onthesubjet neverbeame

wellknowneveninhisownountry.

Permutable poetry. Let's turn now to a urious question that attrated

theattentionof several prominentmathematiians in theseventeenth entury,

beause it sheds onsiderable lighton the stateof ombinatorial knowledge in

Europeat that time. A Jesuitpriestnamed BernardBauhuishad omposed a

famousone-linetributetotheVirginMary,inLatin hexameter:

Tot tibisuntdotes,Virgo,quotsideralo. (19)

[\Thou hast as many virtues, O Virgin, as there are stars in heaven"; see

his Epigrammatum Libri V (Cologne: 1615), 49.℄ His verse inspired Eryius

Puteanus, a professor at the University of Louvain, to write a book entitled

PietatisThaumata(Antwerp:1617),presenting1022permutationsofBauhuis's

words. Forexample,Puteanuswrote

107 Totdotestibi,quotlosuntsidera,Virgo.

270 Dotestot, losuntsideraquot,tibiVirgo.

329 Dotes, losuntquotsidera,Virgo tibitot.

384 Sideraquotlo, totsuntVirgotibidotes.

725 Quotlosuntsidera, totVirgotibidotes.

949 SuntdotesVirgo,quotsidera, tottibilo.

1022 SuntlototVirgotibi,quotsidera,dotes.

(20)

(20)

Hestoppedat 1022,beause1022wasthenumberofvisible starsinPtolemy's

well-knownatalogoftheheavens.

Theideaofpermutingwords inthis waywaswellknownat thetime;suh

wordplay was what JuliusSaliger had alled\Proteus verses" inhis Poeties

LibriSeptem(Lyon:1561),Book2,Chapter30. TheLatinlanguagelendsitself

topermutationslike(20),beauseLatinwordendingstendtodenethefuntion

ofeahnoun,makingtherelativewordordermuhlessimportanttothemeaning

of a sentene than it is in English. Puteanus did state, however, that he had

speially avoidedunsuitablepermutations suhas

Sideratotlo,Virgo,quotsunttibidotes, (21)

beausetheywould plaeanupper boundontheVirgin'svirtuesratherthan a

lowerbound. [Seepages12and103 ofhisbook.℄

Of ourse there are 8!= 40;320 ways to permute the words of (19). But

thatwasn'tthepoint;mostofthosewaysdon't\san." EahofPuteanus's1022

verses obeyed the strit rules of lassial hexameter, the rules that had been

followedbyGreekandLatinpoetssinethedaysofHomerandVergil,namely:

i) Eahwordonsistsofsyllablesthatareeitherlong( )or short(^);

ii) Thesyllablesofeahlinebelongtoone of32patterns,

n

^^

on

^^

on

^^

on

^^

o

^^

n

^ o

: (22)

Inotherwords therearesixmetrialfeet,whereeahoftherstfouriseithera

datylor aspondeeintheterminologyof(5); thefthfootshould bea datyl,

andthelastiseithertroheeorspondee.

TherulesforlongversusshortsyllablesinLatinpoetryaresomewhattriky

ingeneral, but the eight words of Bauhuis's verse an be haraterized by the

followingpatterns:

tot= ; tibi= n

^^

^ o

; sunt= ; dotes= ;

Virgo= n

^ o

; quot= ; sidera= ^^; lo= : (23)

Notie that poets had two hoies when they used the words `tibi' or `Virgo'.

Thus,forexample,(19)tsthehexameterpattern

Tot

^

ti-

^

bi suntdo- tes, Vir- go,quot si-

^

de-

^

ra -lo.

(24)

(Datyl, spondee, spondee, spondee, datyl, spondee; \dum-diddy dum-dum

dum-dumdum-dumdum-diddydum-dum."Theommasrepresentslightpauses,

alled\suras,"whenthewordsareread;theydon'tonernushere,although

Puteanusinsertedthemarefullyintoeah ofhis1022permutations.)

A natural questionnow arises: IfwepermuteBauhuis's words at random,

whataretheoddsthattheysan? Inotherwords,howmanyofthepermutations

obeyrules(i)and(ii),giventhesyllablepatternsin(23)? G.W.Leibnizraised

(21)

thisquestion, amongothers, inhis Dissertatiode ArteCombinatoria (1666),a

workpublishedwhenhewasapplyingforapositionattheUniversityofLeipzig.

At this time Leibnizwas just 19 years old, largely self-taught, and his under-

standingofombinatoriswasquitelimited;forexample,hebelievedthatthere

are 600 permutations of fut;ut;re;mi;fa;solg and 480 of fut;ut;re;re;mi;fag,

andheevenstatedthat(22)represents76possibilitiesinsteadof32. [Seex5and

x8inhisProblem6.℄

But Leibniz did realize that it would be worthwhile to develop general

methods for ounting all permutations that are \useful," in situations when

many permutations are \useless." He onsidered several examples of Proteus

verses,enumeratingsome ofthesimpleronesorretlybut makingmanyerrors

whenthewords wereompliated. AlthoughhementionedPuteanus'swork, he

didn'tattempttoenumeratethesannable permutationsof(19).

AmuhmoresuessfulapproahwasintroduedafewyearslaterbyJean

Prestetinhis

ElemensdesMathematiques (Paris:1675),342{438. Prestetgave

a lear exposition leadingto theonlusion that exatly2196 permutations of

Bauhuis'sversewouldyieldaproperhexameter. However,hesoonrealizedthat

he had forgotten to ount quite a few ases|inluding those numbered 270,

384,and725in(20). Soheompletelyrewrotethismaterialwhenhepublished

Nouveaux

ElemensdesMathematiquesin1689. Pages127{133ofPrestet'snew

book weredevotedto showingthatthetruenumberofsannablepermutations

was3276,almost 50%largerthanhis previoustotal.

MeanwhileJohnWallishadtreatedtheprobleminhisDisourseofCombi-

nations (London: 1685), 118{119, published as a supplement to his Treatise of

Algebra. Afterexplainingwhyhebelievedtheorretnumbertobe3096,Wallis

admittedthat he may haveoverlooked some possibilities and/orountedsome

asesmorethanone;\butIdonot,atpresent,diserneithertheoneandother."

AnanonymousreviewerofWallis'sworkremarkedthatthetruenumberof

metriallyorretpermutationswasatually2580|buthegavenoproof[Ata

Eruditorum5 (1686), 289℄. The reviewerwas almost ertainly G. W. Leibniz

himself, although no lue to the reasoning behind the number 2580 has been

foundamong Leibniz'svoluminousunpublishednotes.

Finally James Bernoulli entered the piture. In his inaugural leture as

Dean of Philosophy at the University of Basel, 1692, he mentioned the tot-

tibi enumeration problem and stated that a areful analysis is neessary to

obtain the orret answer|whih, he said, was 3312(!). His proof appeared

posthumouslyintherst editionof hisArs Conjetandi(1713), 79{81. [Those

pageswere, inidentally, omitted from later editionsof that famous book, and

fromhisolletedworks,beausehedidn'tatuallyintendthemforpubliation;

aproofreaderhadinsertedthembymistake. SeeDieWerkevonJakobBernoulli

3(Basel:Birkhauser,1975),78,98{106,108,154{155.℄

Sowhowasright? Arethere2196sannablepermutations,or3276,or3096,

or2580,or3312? W.A.Whitworthand W.E.Hartleyonsideredthequestion

anewinTheMathematialGazette2(1902),227{228,wheretheyeahpresented

elegant arguments and onluded that the true total was in fat none of the

(22)

above. Theirjoint answer,2880,representedthersttime that anytwo math-

ematiianshadindependentlyometo thesame onlusionaboutthisproblem.

But exerises 21 and 22, below, reveal the truth: Bernoulli is vindiated,

and everybody else was wrong. Moreover, a study of Bernoulli's systemati

andarefullyindented3-page derivationindiatesthathewas suessfulhiey

beause he adhered faithfully to a disipline that we now all the baktrak

method. WeshallstudythebaktrakmethodthoroughlyinSetion7.2.2,where

we will also see that the tot-tibiquestion is readilysolved as a speial ase of

theexatoverproblem.

Even thewisest andmost prudent peopleoftensuerfrom

whatLogiiansall insuÆient enumerationof ases.

| JAMES BERNOULLI (1692)

Setpartitions. ThepartitionsofasetseemtohavebeenstudiedrstinJapan,

where a parlor game alled genji-ko (\Genji inense") beame popular among

upperlasspeopleaboutA.D.1500. Thehostofagatheringwouldseretlyselet

ve pakets of inense, some of whih might be idential, and he would burn

them one at a time. Theguests would tryto disernwhih of thesentswere

thesameandwhihweredierent;inotherwords,theywouldtrytoguesswhih

ofthe$

5

=52partitionsoff1;2;3;4;5ghadbeenhosenbytheirhost.

Fig.47. Diagramsusedto represent setpartitions

in16thenturyJapan. [Fromaopyintheolle-

tionofTamakiYanoatSaitamaUniversity.℄

Soonitbeameustomarytorepresentthe52possibleoutomesbydiagrams

likethoseinFig.47. For example,theuppermostdiagram ofthat illustration,

whenreadfromrighttoleft,wouldindiatethatthersttwosentsareidential

andsoarethelastthree;thusthepartitionis12j345. Theothertwodiagrams,

similarly, are pitorial ways to representthe respetive partitions 124j35 and

1j24j35. As an aid to memory, eah of the 52 patterns was named after a

hapterofLadyMurasaki'sfamous11th-enturyTaleofGenji,aordingtothe

followingsequene[EnylopediaJaponi (Tokyo:Sanseido,1910),1299℄:

(25)

(One again, as we've seen in many other examples, thepossibilities were not

arrangedinanypartiularlylogialorder.)

(23)

Theappealingnature ofthesegenji-kopatternsled manyfamiliestoadopt

themasheraldirests. Forexample,thefollowingstylizedvariantsof(25)were

foundinstandardatalogs ofkimonopatternsearlyinthe20thentury:

[SeeFumieAdahi,JapaneseDesignMotifs(NewYork:Dover,1972),150{153.℄

Earlyinthe1700s,TakakazuSekiandhisstudentsbegantoinvestigatethe

number ofset partitions $

n

forarbitrary n,inspiredby theknown resultthat

$

5

=52. YoshisukeMatsunagafoundformulasforthenumberofsetpartitions

whenthere are k

j

subsets ofsize n

j

for 1 j t, withk

1 n

1

++k

t n

t

=n

(see the answer to exerise 1.2.5{21). He also disovered the basi reurrene

relation7.2.1.5{(14),namely

$

n+1

=

n

0

$

n +

n

1

$

n 1 +

n

2

$

n 2

++

n

n

$

0

; (26)

bywhihthevaluesof$

n

anreadilybeomputed.

Matsunaga'sdisoveriesremainedunpublisheduntilYoriyukiArima'sbook

Shuki Sanpo ame outin 1769. Problem 56 of that book asked thereader to

solvethe equation \$

n

= 678570" for n; and Arima's answer, worked out in

detail(withreditdulygiventoMatsunaga),was n=11.

Shortly afterwards, Masanobu Saka studied thenumber

n

k

of ways that

ann-setanbepartitionedintoksubsets,inhisworkSanpo-Gakkai(1782). He

disovered thereurrene formula

n

n+1

k o

= k n

n

k o

+ n

n

k 1 o

; (27)

andtabulatedtheresultsforn11. JamesStirling,inhis Methodus Dieren-

tialis(1730),haddisoveredthenumbers

n

k

inapurelyalgebraiontext;thus

Saka was therstpersontorealizetheirombinatorialsigniane.

Aninterestingalgorithmforlistingset partitionswassubsequentlydevised

byToshiakiHonda(seeexerise24). Furtherdetailsaboutgenji-koanditsrela-

tiontothehistoryofmathematisanbefoundinJapanese artilesbyTamaki

Yano,SugakuSeminar 34,11(Nov.1995),58{61;34,12(De.1995),56{60.

Setpartitions remainedvirtuallyunknown inEuropeuntil muhlater, ex-

ept for three isolated inidents. First, George and/or Rihard Puttenham

published The Arte of English Poesie in 1589, and pages 70{72 of that book

(24)

ontaindiagramssimilartothoseofgenji-ko. For example,thesevendiagrams

(28)

were usedtoillustratepossiblerhymeshemesfor5-linepoems, \whereofsome

ofthembeharsherandunpleasauntertotheearethenothersomebe." Butthis

visuallyappealinglistwasinomplete(seeexerise25).

Seond, an unpublished manusript of G. W. Leibnizfrom the late 1600s

shows that he had tried to ount the number of ways to partition f1;:::;ng

into three or foursubsets, but with almost nosuess. Heenumerated

n

2 by

a very umbersome method, whih would not haveled himto see readily that

n

2

= 2 n 1

1. He attempted to ompute

n

3 and

n

4

onlyfor n 5, and

made several numerial slips leading to inorret answers. [See E. Knobloh,

StudiaLeibnitianaSupplementa 11(1973),229{233; 16(1976),316{321.℄

ThethirdEuropeanappearaneofsetpartitionshadaompletelydierent

harater. JohnWallisdevotedthe third hapter ofhis Disourse ofCombina-

tions(1685)toquestionsabout\aliquotparts,"theproperdivisorsofnumbers,

andinpartiularhestudiedthesetofallwaystofatorizeagiveninteger. This

questionisequivalenttothestudyofmultiset partitions;forexample,thefator-

izationsofp 3

q 2

rareessentiallythesameasthepartitionsoffp;p;p;q;q;rg,when

p,q,andr areprimenumbers. Wallisdevisedanexellentalgorithmforlisting

allfatorizationsofagivenintegern,essentiallyantiipatingAlgorithm7.2.1.5M

(seeexerise28). Buthedidn'tinvestigatetheimportantspeialasesthatarise

when nis the powerof a prime(equivalent to integer partitions)or when n is

squarefree(equivalenttosetpartitions). Thus,althoughWalliswasabletosolve

themoregeneralproblem,itsomplexitiesparadoxiallydeetedhimfromdis-

overingpartitionnumbers,Bellnumbers,orStirlingsubsetnumbers,orfromde-

visingsimplealgorithmsthatwouldgenerateintegerpartitionsorsetpartitions.

Integer partitions. Partitions of integers arrived on the sene even more

slowly. Bishop Wibold (. 965) knew the partitions of n into exatly three

parts 6. So did Galileo, who wrote a memo about them (. 1627) and also

studiedtheirfrequenyofourreneasrollsofthreedie. [\Sopralesopertede

idadi,"inGalileo'sOpere,Volume8,591{594;helistedpartitionsindereasing

lexiographiorder.℄

Mersennelistedthepartitionsof9intoanynumberofparts,onpage130of

hisTraitezdelaVoixetdesChants(1636). Witheahpartition9=a

1

++a

k

healsoomputedthemultinomialoeÆient9!=(a

1

!:::a

k

!);aswe'veseenearlier,

he was interestedinountingvarious melodies, and he knewfor example that

there are 9!=(3!3!3!) = 1680 melodies on the nine notes fa;a;a;b;b;b;;;g.

But he failed to mentionthe ases 8+1 and 3+2+1+1+1+1, probably

beausehehadn'tlistedthepossibilitiesinanysystematiway.

Leibniz onsidered two-part partitions in Problem 3 of his Dissertatio de

ArteCombinatoria(1666),andhisunpublishednotesshowthathesubsequently

spent onsiderable time trying to enumerate the partitions that have three or

(25)

more summands. He alled them \diserptions," or (less frequently) \divul-

sions"|inLatin of ourse|or sometimes\setions"or \dispersions"or even

\partitions." Hewas interested inthem primarily beause of their onnetion

withthe monomialsymmetrifuntions P

x a

1

i

1 x

a

2

i

2

:::. Buthis manyattempts

ledtoalmosttotalfailure,exeptintheaseofthreesummands,whenhealmost

(butnotquite)disoveredtheformulafor

n

3

inexerise7.2.1.4{31. Forexample,

hearelesslyountedonly21partitionsof8,forgettingthease2+2+2+1+1;

and he got only 26 for p(9), after missing 3 +2+2+2, 3+2+2 +1+1,

2+2+2+1+1+1,and2+2+1+1+1+1+1|inspiteof thefatthat

hewastryingtolistpartitionssystematiallyindereasinglexiographiorder.

[SeeE.Knobloh,StudiaLeibnitianaSupplementa11(1973),91{258;16(1976),

255{337;HistoriaMathematia1(1974),409{430.℄

Abrahamde Moivrehadthe rstrealsuess withpartitions, inhis paper

\AMethodofRaisinganinniteMultinomialtoanygivenPower,orExtrating

anygivenRootofthesame"[PhilosophialTransations19(1697),619{625and

Fig.5℄. He proved that theoeÆient of z m+n

in(az+bz 2

+z 3

+) m

has

onetermforeahpartitionof n;forexample,theoeÆientofz m+6

is

m

6

a m 6

b 6

+5 m

5

a m 5

b 4

+4 m

4

a m 4

b 3

d+6 m

4

a m 4

b 2

2

+3 m

3

a m 3

b 2

e+6 m

3

a m 3

bd+2 m

2

a m 2

bf+ m

3

a m 3

3

+2 m

2

a m 2

e+ m

2

a m 2

d 2

+ m

1

a m 1

g: (29)

Ifweseta=1,thetermwithexponentsb i

j

d k

e l

::: orrespondstothepartition

with i 1s, j 2s, k 3s, l 4s, et. Thus, for example, when n =6 he essentially

presentedthepartitionsintheorder

111111; 11112; 1113; 1122; 114; 123; 15; 222; 24; 33; 6: (30)

Heexplained howto list the partitions reursively, as follows (but in dierent

language related to his own notation): For k =1, 2, :::, n, start with k and

appendthe(previouslylisted)partitionsofn kwhosesmallestpart isk.

[Mysolution℄ wasordered tobepublished intheTransations,

not so muh as a matter relating to Play,

but as ontainingsome general Speulations

not unworthy tobeonsideredby theLoversof Truth.

| ABRAHAM DE MOIVRE (1717)

P. R.de Montmorttabulatedall partitions ofnumbers 9 into 6 parts

inhis Essay d'Analyse surles Jeuxde Hazard (1708), inonnetion with die

problems. His partitionswerelistedinadierentorderfrom (30);forexample,

111111; 21111; 2211; 222; 3111; 321; 33; 411; 42; 51; 6: (31)

Heprobablywas unawareofdeMoivre'spriorwork.

Sofaralmost noneoftheauthors we'vebeendisussingatuallydesribed

theproedures by whih theygenerated ombinatorial patterns. Wean only

infertheirmethods,orlakthereof,bystudyingtheliststhattheyatuallypub-

lished. Furthermore,inrareases suhasdeMoivre'spaperwhereatabulation

(26)

method was expliitly desribed, the author assumed that allpatterns for the

rstases1,2,:::,n 1hadbeenlistedbeforeitwastimetotakletheaseof

ordern. Nomethodforgenerating patterns\on they,"movingdiretlyfrom

one pattern to its suessor without looking at auxiliary tables, was atually

explained by any of the authors we have enountered, exept for Kedara and

Narayan

.

a. Today's omputerprogrammers naturallyprefer methods that are

morediretandneedlittlememory.

Roger Joseph Bosovih published the rst diret algorithm for partition

generation in Giornalede' Letterati (Rome, 1747), on pages 393{404 together

withtwofoldout tablesfaingpage404. His method,whihproduesforn=6

therespetiveoutputs

111111; 11112; 1122; 222; 1113; 123; 33; 114; 24; 15; 6; (32)

generatespartitionsinpreiselythereverseorderfromwhihtheyarevisitedby

Algorithm7.2.1.4P;andhismethodwouldindeedhavebeenfeaturedinSetion

7.2.1.4, exeptforthefatthat thereverseorderturns outtobeslightlyeasier

andfasterthantheorderthathehadhosen.

Bosovih published sequels inGiornalede'Letterati (Rome,1748), 12{27

and84{99,extendinghisalgorithmintwoways. First,heonsideredgenerating

onlypartitionswhosepartsbelongtoagivensetS,sothatsymbolimultinomials

withsparseoeÆientsouldberaisedtothemthpower. (Hesaidthatthegd

ofallelementsofS shouldbe1;infat,however,hismethodouldfailif12= S.)

Seond,heintrodued analgorithm forgeneratingpartitionsofnintomparts,

given m andn. Againhe was unluky: A slightly better way to do that task,

Algorithm7.2.1.4H,wasfoundsubsequently, diminishinghis hanesforfame.

Hindenburg's hype. The inventorof Algorithm 7.2.1.4Hwas Carl Friedrih

Hindenburg, who also redisovered Narayan

.

a's Algorithm 7.2.1.2L, a winning

tehniqueforgeneratingmultisetpermutations. Unfortunately,thesesmallsu-

essesledhimtobelievethathehadmaderevolutionaryadvanesinmathemat-

is|althoughhedidondesendtoremarkthatotherpeoplesuhasdeMoivre,

Euler,andLamberthadomelosetomakingsimilardisoveries.

Hindenburgwas a prototypial overahiever,extremely energeti ifnot in-

spired. HefoundedorofoundedGermany'srstprofessionaljournalsofmath-

ematis(published 1786{1789and 1794{1800),and ontributedlong artilesto

eah. He served several times as aademi dean at the University of Leipzig,

where hewas also theRetor in1792. If hehad beena better mathematiian,

Germanmathematis mightwellhaveourishedmore inLeipzigthaninBerlin

orGottingen.

Buthis rstmathematial work, Beshreibung einerganzneuen Art, nah

einem bekannten Gesetze fortgehende Zahlen durh Abzahlen oder Abmessen

bequemundsiherzunden(Leipzig:1776), amplyforeshadowed what was to

ome: His\ganzneue"(ompletelynew)ideainthatbookletwassimplytogive

ombinatorialsignianeto thedigitsofnumberswrittenindeimalnotation.

Inredibly,heonludedhismonographwithlargefoldoutsheetsthatontained

Références

Documents relatifs

The theory of O-fiat modules is obtained by a dualization of the theory of O-injective modules (see.. The proofs of the following two results are dual to the proofs

Pour les ddmonstrations nous utilisons la mdthode des unitds, modifide selon le caract~re du corps, et souvent combinde avec application du thdor~me de Thue...

BROLIN, Invariant sets under iteration of rational functions Theorem 12.1.. Consider the set Pq of predecessors of q,

Si les conditions du th6orbme sont remplies, les xq, coefficients de % nous donnent une solution du syst6me... ARKIV FOR

Here, where a sample function is (in part) a derivative, it becomes a right derivative after imposition of right continuity. An exchange of correspondence with

Some further general remarks on algebras with a Hilbert space structure are given in this paper (sec.. The verifications are left to the reader.. ARKIV FOR

Our smooth- ness condition precludes the possibility of an equation with double characteristics having non-singular characteristics or of a surface being strongly

I1 faut d'abord recapituler certains faits sur les corps biquadratiques, ce qui aura lieu dans le paragraphe 3.. Dans le dernier paragraphe nous allons