Sounds of the Collatz Conjecture: Generating Music from the 3x + 1 Problem
ฝัง
- เผยแพร่เมื่อ 20 พ.ค. 2024
- Using sequences from the famous unsolved Collatz conjecture to generate musical passages as MIDI notes.
The Collatz conjecture is also known as the 3n + 1 problem, the 3x + 1 problem, the Ulam conjecture, Kakutani's problem, the Thwaites conjecture, Hasse's algorithm, or the Syracuse problem.
Different strategies are used to map the "hailstone sequences" into sequences of MIDI note numbers, including a straightforward "additive" numerical mapping, "directional" mappings using fixed jump sizes, and mappings based on pitch class.
These visualizations were written in Java using a graphical library called Processing (processing.org/), and Java's built-in MIDI library for generating MIDI data (package javax.sound.midi).
0:00 The Collatz Conjecture
1:27 Mapping to MIDI Notes
2:07 Strategy No. 1
4:03 Strategy No. 2
4:45 Strategy No. 3
5:21 Strategy No. 4
5:54 Strategy No. 5
7:18 Strategy No. 6
8:04 Strategy No. 7
9:12 Extra Long Example
________
Interested in learning more about algorithms, math, and how to program? Here are some useful and/or classic textbooks that I recommend (these are affiliate links, if you buy one, I get a small commission):
▶ "The Ultimate Challenge: The 3x+1 Problem" by Jeffrey C. Lagarias: amzn.to/4aVejxH
▶ “Algorithms” (4th Edition) by Robert Sedgewick & Kevin Wayne: amzn.to/3uo25xR
▶ “Effective Java” (3rd Edition) by Joshua Bloch: amzn.to/3HOnYJL
▶ “Design Patterns: Elements of Reusable Object-Oriented Software” by Erich Gamma, Richard Helm, Ralph Johnson, & John Vlissides: amzn.to/49fpr7R
▶ “Discrete Algorithmic Mathematics” by Stephen B. Maurer & Anthony Ralston: amzn.to/4bmsOvG
#math #music #musictheory #unsolved #patterns #code #java #software #computerscience #visualization #algorithmicmusic #algorithmiccomposition - เพลง
This sounds like how aliens would compose music
I can sort of hear Hartmann's Youkai Girl in that initial 7 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1
The Composer is a Japanese solo creatist that makes the Touhou franchise , lush with over 18+ mainseries games not including spinoffs. That said, it isn't an exact translation but I am hearing Hartman's Youkai Girl , my favorite song and character of the franchise... 😅 ironically in fact.
To the aliens, we are the aliens!!!
Hi that’s literally me!
this is literally how some contemporary classical music is created
There's an episode of _Star Trek: Voyager_ that uses something not far off this concept.
I love that 8421 ‘motif’ for all the strategy 1s, it sounds kinda like the game over theme for all the failed attempts to disprove the Collatz Conjecture
I'd say it's more of a 16 8 4 2 1 motif
And most mathematicians suspect it is true and have failed to PROVE it.
@@slyar i'd say its more of a powers of two motif
i like the way you think!
Going down the Phrygian scale.
I can see why proving this is so enticing for mathematicians- the patterns start to jump out, which is red meat to a mathematician.
I love how this comment reminds me of Vi Hart (Who joined The Awesomeness Team, a team that I lead!)!
So True, both of y’all.
I love how the sequence starting on 27 using pitch classes has those funny little runs of little trills, particularly the modulo 12 system
moving up and down the circle of fifths sounds pretty neat
So this was just “intro to jazz”?
That seems to check out
I love the use of a marimba for the first few sequences.
@Fire_Axus don't care.
I'm both a computer programmer and a musician so I find this very interesting. It's remarkably musical. I think your choice of sound is great. These sequences would make wonderful percussion solos in a large ensemble (orchestra, brass band, concert band etc) piece. I wish that I could compose. Thanks very much for this.
everybody gangsta until a node hits 16
I'm interested in what it sounds like if you just use the number as a frequency with the units chosen so that 1 is the lowest pitch that can be heard (usually about 20Hz). This makes halving the number musically meaningful because you go down exactly one octave. Multiplying by 3 and adding 1 is slightly more complicated. Multiplying by three is going up an octave plus a perfect fifth. Adding one makes it more than that, exactly how much depending on how high the number was. For example, 3→10 is going up an octave plus a major sixth. 5→16 is going up an octave plus a minor sixth. This system would allow numbers up to about 1,000 for someone with good hearing.
It would be funny to see how that +1 slowly starts pushing you out of the original tuning
good idea
That was what I was thinking too!
What's also interesting is how every key has different properties (e.g. some have better perfect fifths, others have better perfect fourths etc. depending on their prime factorization). Another interesting thing would be to go the other way (i.e. linearly increasing period; the first one would be ~50 microseconds), which also has the same variety in keys, whilst also having a simple physical interpretation- linearly increasing lengths of the vibrating object (e.g., multiples of Tv/4 and Tv/2 for closed and open pipes respectively)
Nice. It would be cool to try something like mod 144. Limits the range but uses more of the keyboard than just the pitch class.
I think the main reason it sounds more musical than a random sequence of notes is that every time it goes up it must go down on the next step, since if n is odd then 3n+1 is even. I'm guessing if you removed that regularity and used f(n) = n/2 if n is even, (3n+1)/2 if n is odd it would just sound random.
I once did an experiment where I used the Collatz conjecture to determine the length of a section in 8th notes. It came out rather decent, rendered an accompanying animation with blender and sent that in for my composing class "exam" in music school a couple of years ago.
Edit: had to look it up to be sure but... I started from 25, which gave a nice balance of number of numbers and not going absurdly high
When I was in college I made a little box where you hit a button a certain number of times and it would play a MIDI sequence based on the hailstone sequence generated from the total number of button presses, then challenged my classmates to make the longest sequence they could as my midterm project. They hated it
4:55 GameCube intro??
You should try this with a pentatonic scale. It would probably sound more sonorous and pleasant.
Beautiful. Just Beautiful.
all positive integers will reach a power of two is another way of putting it i think
Amazing video. I really really like your channel content! Keep it up.A few days ago I asked chatgpt about possible analogs of circle of fifths in 3 dimensions, 4 dimensions or higher. And I got interesting resultings every time I asked. It would be amazing if you do an video about it.
I will paste some interesting results here:
Sure, here are a few potential higher-dimensional analogs of the circle of fifths:
1. **Sphere of Harmonic Relationships:** Imagine a three-dimensional sphere where each point represents a musical key, and the distance between points indicates the harmonic relationship between those keys. This model could incorporate not only fifths but also other intervals and harmonic concepts.
2. **Hypergraph of Musical Elements:** Visualize a hypergraph where each node represents a musical element (such as keys, chords, modes, etc.), and hyperedges represent relationships between multiple elements. This could capture complex relationships beyond just linear progressions.
3. **Tensor Representation:** Utilize a tensor framework where each dimension represents a different musical element (e.g., keys, chords, time signatures), allowing for a multidimensional representation of musical relationships.
4. **Topological Map:** Create a topological map where musical elements are represented as points on a surface, and the topology of the surface captures relationships between elements. This could provide a geometrically intuitive way to explore complex musical structures.
Ok other results from chatgpt with slightly different question about hyperdimensional circle of fifths:
:
1. **Multi-dimensional Pitch Space**: Some music theorists and composers have conceptualized pitch relationships in multi-dimensional spaces beyond the traditional linear or circular representations. These spaces can include dimensions for pitch height, duration, timbre, and other musical parameters.
2. **Spectral Analysis**: In the field of spectral music, composers like Gérard Grisey and Tristan Murail have explored the use of multi-dimensional pitch spaces based on the analysis of sound spectra. These spaces represent complex relationships between harmonic partials and timbral characteristics.
3. **Mathematical Models**: Mathematically inclined composers and theorists have investigated higher-dimensional spaces using concepts from topology, group theory, and other mathematical frameworks. These models aim to represent the intricate relationships between musical elements in more abstract and complex ways.
4. **Interactive Visualization Tools**: With advancements in digital technology, there have been efforts to develop interactive visualization tools for exploring hypertonal analogs and multi-dimensional pitch spaces. These tools often allow users to navigate through complex musical structures and relationships in real-time.
Perhaps limit it to a particular key scale, major or minor instead of chromatic?
this way it's forced to sound good, it won't be more impressive than a monkey pressing random keys in a scale
A pentatonic scale would always sound like it's in tune. Just use the black notes.
mostly if it were major or minor or something like that there would be a lot less room for larger numbers because you’re skipping so many notes
@@contranym675, not necessarily. Instead of using chromatic pitch class (mod 12), you would use a major or minor pitch class (mod 7) to keep the notes in a single key, similar to the latter strategies mentioned in the video. You would not need to skip any numbers. Granted, you are still unlikely to produce an award-winning melody with this.
another idea i came up with: using microtonal scale with logarythmic frequencies. difference between big numbers in your examples are much bigger than between small ones, so log scale can help with it. we already percieve freqeuncies logarithmically, so this scale will basically be smth like "next note is 10hz higher than the previous one" instead of 12EDO "next note is twelfth root of two times higher than the previous one"
Your very inspiring video made me think of the following new thought: given a set of Collatz sequences, when considering a new sequence, terminate the sequence as soon as it falls on a number which has appeared in any sequence already observed. Then the length of the sequence is measured only to that length. I wonder if this "Reduced Collatz Sequence" sheds any new light on things. If we have a function on the natural numbers that yields the "reduced length" of the corresponding Collatz sequence, then how quickly does the envelope of that function increase? ~~~~Arthur Ogawa
new AlgoMotion video just dropped! Give me more combinations of random mathematical concepts with music theory!!!
Bro the tritone major third one is so cool
Wouldn't the most obvious strategy be to go up by a perfect fifth and down by an octave?
I think the main problem with the directional/bounded one is that a number can’t go up two times in a row, so the note sequence generally trends downward.
6:46
“A nice feature of this strategy is that it confines the note to a finite range, so we can arbitrarily long sequences”
The sequence: To infinity, and beyond!
4:54 Gamecube intro ahh beat
strategy 3 sounds great
Because it's cheating.
@@afj810 where are the rules?
@@official-obama it trivializes the harmonic aspect by defining the variation to be harmonious. What's the point of tying it to that sequence at all if you're just going to do this?
@@afj810 the rhythm? plus it can also drift over time
@@official-obama rhythm isn't changing though
7:36 had cool sound to it
This sounds so metal 🤘
Meshuggah specifically.
Obviously I'd heard of 3x+1 quite a few times but I would never have thought about this
how much time do you spend finding these ideas ?
0:01 sounds like a music from portal 2
This sounds good 👌 😌
Strategy 4 sounds like a flashback sequence
Whole tone scale babeeeeey
whole tone scales are always used in flashback sequences and #4 is constrained to the whole tone scale
I was fascinated as to how quickly I adoped to expecting, musically, for the sequence to go to the value 1. Or, again musically, the root if you wish.
Incredible
What a vibe!!
Love the 27
I think using the log of the hailstone numbers would be a good way to help limit the range but keep the shape of the sequence
imagine playing music at a concert but the sheet music is 8:41 or 9:56 :skull:
Yay a new algo video
I'd like to hear one confined to a major scale!
we making a frums song with this one 🔥🔥
I think it would be interesting to potentially use a bounded set of four or five octaves but for half steps exceeding the bounded range add additional notes by the same rules creating chords.
Can you reverse into a sequence starting with 1 and branching where applicable (1 comes from 2 comes from 4 - 4 comes from 8 or 1). There are trails of doubling forever to inaudible, but reliably also these "one less and divide 3" drops down into more trails of doubling. Just seems interesting what chords the branches might make.
Would be interesting to mod 8 the numbers and apply them to the notes of scales. Thumbs up if you agree he should do this.
How about use pitch class + Each digit has Each octave
2 is D in 1st(lowest) octave, 20 is D2 + C#1
2024 is D4 + C#3 + D2 + E1
like that.
you can use UP to 7 digit
and remove 2 black note if you want
Wonderful. I am a mathemusician myself and I'd like to propose the following "bebop" strategy. Fix a note (e.g Bb) and an associated "Bebop scale": this is like the usual major scale, except there is an extra step (Ab) between G and A. This makes the scale of 8 notes and is useful in improvising to stay on the same chord when playing the scale linearly (try to go downward from Bb).
When collatz go up, you would go two steps up on the scale, neglecting the extra step (this will result in upward arpeggios on II/V or I/IV/VI). When collatz go down, you would go one step down on the scale using the extra step, playing a downward scale.
Then swing a bit the notes (even notes last 2 beats and odd notes last 1 beat) and set a trumpet like sound. Regarding boundedness, you can transpose 1 octave down or up the note your going to play if it goes out from the registry you fixed.
I guess this would result in a very nice bebop like improvisation. If you want to rock, add a II/V/I jazz backtrack and you are ready to publish.
I would like to listen to this veery much! Please make it!! A small mathematical note: when we only use the up/down information, it seems like we are using less information. However, froma mathematical pint of view, if you give me the story of a number trhougb Collatz (ups and downs), I am able to uniquely identify the starting number. So on balance we are using the same amount of information.
I feel like there i a critical issue with some of these strategies: seems like we should impose an additional restriction, that 4-2-1-4 puts you back on the same note. it is, after all, a loop
Doing this on a chromatic scale just sounds like Harry Partch percussion runs… can we get this in some 46 note to the octave tuning (i can’t remember exactly how many notes he uses lol)?
Mesmerizing.
First metods resembled some human composed music from 1960-1970 era wich was often used as musical ilutration to educational or documentary movies
The last example reminds me a lot of "Tail of Benin" theme by Walter Smith III 😂
It would be interesting if you mapped the binary representation of the hailstone number to a set of notes eg 0001 -> {C4}, 1011 -> {C4, D4, F#4} etc, there should most definitely be a way to make it sound nice since there are some 'regularities' in collatz sequences in base 2.
Alien jazz, neat
What is your sheet music?
Collatz conjecture
I don't know but an odd number times 3 is an odd number, plus 1 is an even number, then divides 2. And eventually 4 - 2 - 1
this would make a SICK pokémon battle theme
Is it just me or anyone else noticed that the valley points (lowest) of the patterns are always prime numbers?
Yo! Try using the harmonic series(or just multiplying a fundamental freq(preferably a low one) by the hailstone number) instead of the out of tune 12tet!
And coming up with a strategy with that, like locking every note to an octave(2/1) or a 3/1.
The subharmonic series have the opposite feeling to the harmonic series. its dividing a base freq by an integer, instead of multiplying.
Taking logarithm of the number would keep the sequence bound to sensible scale range quite easily. Of course it would need rounding however
you should try turning one of these into an actual good bit of music by messsing with the notes as little as possible (changing their length and adding in silent beats is perfectly cool tho)
2:13 I thought that the most logical interpretation is to make numbers represent degrees of a certain key
2:53 is like boss music, especially if you were to loop it
I like strategy 5
Same
I propose an alternate strategy: the note's pitch and duration should be equal to the pitch and duration at that index of beethoven's 5th symphony (using the modulus of the number of available notes)
Okay!
I did the sequence for the numbers "1234567890" repeated 9 times and it obeyed the conjecture
Why not trying a frequency approach?
Heres an idea: put shepherds tone version of each note so that limiting the range might sound smoother? idk im coming up with this idea at 3 am
What if you played 2 at once?
2:33 Welcome to WHITESPACE.
Maybe I can use these for my ringtone
I am reminded of the Ice Caverns song from final fantasy ix
I had a stroke listening to this
6:33 sounds a little familiar
why do the repeating sequences of B/Bb keep popping up?
This is a math video. Considering you're a very flamboyant, "prolific Whiteboard Fox user" archetype furry, I think this might be a bit too complicated for you.
(Ignore the reply above, just some person trying to get a reaction from you.)
The repeating sequences of B/Bb seem to occur because he is taking the MIDI notes mod 12. (A funny choice, considering that 12 is not coprime with 2 or 3, leading to repetitive patterns like the reocurring B/Bb.) Anyhow, a number that is 10 mod 12 is surely even and thus the next number shall be it's half, due to the rules of the collatz sequence. Well, what are the numbers that it can turn into? If it's 10 mod 12, then it's of the form 12k + 10. Taking that and dividing it by 2, we get 6k + 5, which mod 12 can be 5 or 11... In other words, the note 10 can only come before the note 5 or the note 11. For sufficiently long sequences, it should near around a 50% chance of becoming a note 11. 11 mod 12 is surely odd, and thus it shall become the successor of it's triple amount, due to the rules of the collatz conjecture. 12k + 11 -> 36k + 33 -> 36k + 34 = 12(3k + 2) + 10. In other words, a note that is 11 mod 12 will always become a note that is 10 mod 12.
In other words, whenever you start with a Bb note, it has a 50% chance of returning a B note, which then has a 100% chance of becoming a Bb note right back! It makes it very clear that such a pattern reocurring over and over should not be surprising; as soon we land on a B or a Bb note they will cycle until the Bb note becomes a note denoted by the residue 5 mod 12. If you want to know more, take a look at modular arithmetic! It's definitely one of the easiest to digest and also most useful topics of number theory. (As a side note, do not feel discouraged by the elitism of a rotten few that feel the need to put others down instead of simply explaining the topic at hand. Mathematics could be far more advanced if all people who love it (or at least pretend to do so) put in more effort into making it seem less intimidating)
@@Gordy-io8sb thank you for the funniest reply ive ever received
@@koga2960 thank you for the detailed explanation!!! that makes sense to me now :) and no worries about the other guy's comment i got a good laugh out of it. dude clearly doesnt know that like half the brightest programmers out there right now are either trans or furries haha
@@fossfeen its great you found it funny, just felt like i had to intervene because i remember how people tried discouraging me when i was a beginner at math by saying shit like "uhh this is actually just eaaasyyy and youre just stuuuuupid" lol
As a side note, it is interesting that you mentioned the B/Bb cycle since it's actually the only length 2 cycle that could occur.
They would need to alternate between odd and even, since an odd number always precedes an even number in the collatz sequence (2k + 1 -> 3(2k + 1) + 1 = 6k + 2 = 2(3k + 1)), and not only that, but we would need 2*x congruent to 3*x + 1 for x being the odd number in the cycle. Thus x is congruent to -1 mod 12, thus x must be 11
John Petrucci: "Guys, i have an idea for the next album"
This video have to has millions view
Wow this is cool how about doing this for a really long seed
Ahh, the good ol’ CS50 shorts exercise.
Neat idea. Anyone ever (gasp) tried using one or two of these in (dubble gassp) counterpoint with each other?
27: "hold my beer"
I would have prefered a diatonic hailstone sequence to MIDI mapping
Great video! One small suggestion though: the volume difference between your voice and the notes was quite large, maybe try balancing them a bit better. Apart from that, this video was really cool, well-made and informative! keep up the great work, you've earned yourself a subscriber :3
That last one sounds like a prog metal lead.
Sounds like IO by autechre
"There Is A Fractal Named Collatz"
а такое число есть))) просто нужно его поискать хорошо! более 25 знаков.
I want a piano tutorial for this one
Strategy 2, part 2: who else thought n=15 sounded like the GameCube load screen?
I think you should do it by hertz so 1 goes to 100 hertz, 5 goes to 500 hertz, and so on
Weird music good info 😂
Sounds good when its 2x the speed
I swear 2:55 is from the portal 2 ost
Next up - Collatz Counterpoint!
4:53 ngl this one sounds like the circle of fifths
imagine someone remixes this
"Just be microtonal" -Jacob Collier
Mark my words, I will write a song out of this concept that doesn't sound like randomness