## Tuesday, November 21, 2023

### Swap

Éric Angelini's blog post last Friday (Underline, reproduce) motivated me to attempt to solve

S9 = ninthtwentieththirtieth, fourth, ninetieth, sixth, seventh, eighth, ...

... wondering how many swaps (of "first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, …") were needed to produce it. It stymied me for a day or so but (using a combination of manual and Mathematica step-throughs) I eventually got this:

S9 = ninth, twentieth, thirtieth, fourth, ninetieth; sixth, seventh, eighth, first, tenth, second, twelfth, fifteenth, thirtyeighththirteenth, fifth, eleventh, eighteenth, nineteenth, seventeenth, twentyfirst, twentysecond, fourteenth; twentyfourth, twentyfifth, twentysixth, twentyseventh, twentyeighth, sixteenththird, thirtyfirst, thirtysecond, thirtythird, thirtyfourth, thirtyfifth, thirtysixth, thirtyseventh, twentythird; thirtyninth, fortieth, fortyfirst, fortysecond, twentyninth; fortyfourth, fortyfifth, fortysixth, fortyseventh, fortyeighth, fortyninth, fortythird; fiftyfirst, fiftysecond, fiftythird, fiftieth, fiftyfifth, fiftyfourth; fiftyseventh, fiftyeighth, fiftyninth, sixtieth, sixtyfirst; sixtysecond, sixtythird, sixtyfourth, sixtyfifth, fiftysixth; sixtyseventh, sixtyeighth, sixtyninth, seventieth, seventyfirst, seventysecond; seventythird, seventyfourth, seventyfifth, seventysixth, seventyseventh, seventyeighth, sixtysixth; eightieth, eightyfirst, eightysecond, eightythird, eightyfourth, eightyfifth, eightysixth, eightyseventh, seventyninth; eightyninth, eightyeighth, ninetyfirst, ninetysecond, ninetythird, ninetyfourth, ninetyfifth, ninetysixth, ninetyseventh, ninetyeighth, ninetyninth, onehundredth; ...

In case you are still wondering what this is all about, the sequence of written-out ordinals reproduces itself if you take its 9th, 20th, 30th, 4th, 90th; 6th, 7th, 8th, 1st, 10th, 2nd, 12th, 15th, 38th; 13th, etc. letters. I have replaced commas with semicolons where the spelling of each ordinal ends. The semicolon after "onehundredth" indicates the end of "thirtyeighth".

So I told Éric that there were 24 swaps, i.e. red-lettered ordinals (where the number does not correspond to its position in the sequence). But in my mind "swap" has a strong sense of pairwise exchanges, which is not the case here. There are three such pairwise exchanges: Positions 1 with 9, 3 with 30, and 13 with 15. But the rest are more involved. Position 14 goes to 38, which goes to 23 (which goes to 14). Position 2 goes to 20, which goes to 17, which goes to 11 (which goes to 2). Finally, position 5 goes to 90, which goes to 88, which goes to 79, which goes to 66, which goes to 56, which goes to 54, which goes to 50, which goes to 43, which goes to 29, which goes to 16 (which goes to 5).

Update: I've calculated 11001 indexed terms for

S10 = tenth, eighteenth, twentyeighth, ninetieth, fifth; second, seventh, eighth, ninth, first, sixth, eleventh, eleventhousandth, fourth, fifteenth; fourteenth, seventeenth, twelfth, third, sixteenth, twentyfirst, twentysecond, twentythird, twentyfourth, twentyfifth, twentieth, twentyseventh; ...

In the linked file, the 1098 red entries are indicated by an asterisk at the end of the line.

#### 1 comment:

1. Thank you for this sequence, Hans! And you are right, "swap" is not exactly the word that describes the kind of "disorder" we have here... I should perhaps have written smthg like: "How many terms in S9 occupy a different place than they occupied in S1?" What do you think?