## A342585

A Fediverse friend contacted me yesterday. They had listened to one of my algorithmic compositions and told me “*use this in something*”. “*this*” was given by two URLs:
https://oeis.org/A342585 and https://youtu.be/_AOGsnH3UCs.

The first link led me to a page of **The On-line Encyclopedia of Integer Sequences (founded in 1964 by N. J. A. Sloane)** — the page describing inventory sequence “**A342585**“:

“record the number of zeros thus far in the sequence, then the number of ones thus far, then the number of twos thus far and so on, until a zero is recorded; the inventory then starts again, recording the number of zeros.”

The page also provided links to interesting plots, such as Rémy Sigrist's “Scatterplot of the first 10^8 terms” of the sequence, which made me think of so-called **permutation numbers** I had studied years ago. I immediately decided to follow my friend's suggestion! I wrote a tiny program that fed my generative engine with strings such as A(0)A(1)...A(n), where the argument of A() is the corresponding number in A342585.

The thing that I found particularly intriguing is that the procedure generating the sequence **emitted zeroes with a certain frequency** (at first, zeroes are the most frequent numbers; later on, other numbers become more frequent). Now, zero has a **special meaning** in my own generative engine: it is the code of the only “**bad card**” in the game that my engine simulates. This means that the behavior of the game (and thus, the music generated by my engine) **would exhibit two “trends”**: a regular one, when a non-zero was found in A342585, and an irregular one, when a zero was found. In other words, the fate of the game would only change when a zero is found in A342585. In musical terms, when the new input string has a non-zero A(n), then the “music quantum” generated by my engine would be very similar to that generated from the previous input string.

I did some experiments and found out that the generated music was particularly interesting when n was between 18 and 28. In that region only two zeroes were part of the sequence, which leads to simulations that produce much stability with occasional trend changes. More importantly, the stable “episodes” produced in the [18, 28] region were good to my ear.

The result was manually adjusted by cutting off some music at the beginning; orchestrating the midi file generated by my engine with soundfonts for acoustic bass, marimba, celesta, kalimba, piano, oud, and percussion; and adding a bass fragment at the “new beginning” and at the end of the piece.

I hope you will enjoy the result as much as I enjoyed “playing” with A342585. My thanks to Gav for their wonderful suggestion!

Music by Eidon. © Eidon (Eidon@tutanota.com, eidon.songs@gmail.com). All rights reserved.

48MHz 24-bit FLAC on Bandcamp.

Picture: “*distances between permutation numbers of 01234567*”, processed with G'MIC filters. Used by permission.

Video: Excerpts from “Anagnos” (https://archive.org/details/anagnos-, by tinkture.org, Public Domain Mark 1.0 Creative Commons License) On #youtube at https://youtu.be/WToCbLSGHME

If you like my music, please follow me on bandcamp, youtube, and facebook. Thank you!