4 ms·
Collatz’s Ant
- easwee 2y agoLovely.
- thomascountz 2y agoFor those interested, see Daniel Shiffman's Nature of Code[1], a book in which you go from simple "ant" simulations to machine learning, neuroevolution, and NEAT using p5.js for graphics. [1]: natureofcode.com
- cedws 2y agoDaniel Shiffman is brilliant. Haven’t watched The Coding Train for a while now but back in the days I really enjoyed his attitude. I think “creative coding” is the optimal path to get people into programming and he’s an excellent teacher of it.
- keepamovin 2y agoThis is so interesting: not just this visual rep but the conjecture generally, and the iteration's production of 'pseudorandom' patterns. Hints at deep stuff between the two simplest prime divisors of integers: 2 and 3, you have this iterated function that branches based on divisibility by 2 and changes proportional to 3. The addition of plus one really throws a spanner in the works, ensuring it's no longer divisible by 3, but whether it's divisible by 2 or not after the addition seems almost 50-50. So cool - one day we will unravel all these patterns, see the higher order of which these are simpler cases glimpsed partially and it will all make sense! :)
- JadeNB 2y ago> Hints at deep stuff between the two simplest prime divisors of integers: 2 and 3, you have this iterated function that branches based on divisibility by 2 and changes proportional to 3. The addition of plus one really throws a spanner in the works, ensuring it's no longer divisible by 3, but whether it's divisible by 2 or not after the addition seems almost 50-50. Are you sure you said what you mean? If `n` (is an integer that) is not divisible by 2, then `3n + 1` always is. Maybe you were thinking of the model that incorporates this by replacing the iteration formula for `n` odd with `(3n + 1)/2`?
- keepamovin 2y agoHaha you are right! I might have been thinking of that, thanks for your charitable generous interpretation - or I might have been confused. I think I was just confused here, but good point. I guess it's the n/2 one whose divisibility by 2 becomes uncertain. I think I looked at the formula and thought 3n+ 1 if 3n + 1 ~ 1 (mod 2), not 'if n ~ 1' haha that was funny! :) Thanks again :) edit: Also what a lovely way to correct someone -- 'said what you mean' -- I am gonna use that! :)
- wcerfgba 2y agoI'd like to see this for smaller n, to see if there are motifs or patterns, which can be used to implement memoisation like Hashlife (https://en.m.wikipedia.org/wiki/Hashlife https://en.m.wikipedia.org/wiki/Hashlife), or to reveal new formulas for exploring Collatz sequences with.
- Fibra 2y agoGood idea. Although, from the little exploration I did with examples for small n, given the low stopping times, the behaviour was very boring. Nothing necessarily interesting. But then again, I didn't explore it exhaustively.
- wcerfgba 2y agoExactly, so I'm wondering if it's possible to detect those smaller patterns in the bigger ones?
- Fibra 2y agoI'm not sure. I'll explore it a bit. Feel free to fork it and explore it yourself!
- johngossman 2y agoWarning: huge amounts of compute time have been spent trying to find a counter example to this conjecture, which almost everyone believes is true. I kept my office warm this way one winter. It has been described as a way to turn pure Platonic mathematics into heat. Always interesting to try to visualize something though. Ps -- I implemented hashlife one time. Still amazed someone came up with that algorithm
- JadeNB 2y ago> Good idea. Although, from the little exploration I did with examples for small n, given the low stopping times, the behaviour was very boring. Nothing necessarily interesting. But then again, I didn't explore it exhaustively. Long and/or large excursions can happen even for small n! As mentioned at https://en.wikipedia.org/wiki/Collatz_conjecture#Empirical_data https://en.wikipedia.org/wiki/Collatz_conjecture#Empirical_d... , for example, 27 meanders for quite a while before reaching the inevitable cycle.
- travisjungroth 2y agoColor or grayscale changes on a cell for repeat visits would be cool.