***How many apples you have in an **#Apple_Tree**, so many **#Dead_Nodes_Will_eat***** ***I appreciate your work in generally . I think here you are making a mistake. **#Collatz_Conjecture** into negative axes isn't a Collatz Conjecture , and if you follow my work , can see for what. Anyway as promised , I solved Collatz Conjecture via **#Murgu_Lemas** **#Collatz_Conjecture_Logical_Dead_Nodes_Lema** **#Eternal_Triad** (which demonstrated every odd Integers , except Logical Dead Nodes and **#Collatz_Perfect_Numbers_Dead_Nodes** but with a dual sense), and **#Collatz_Conjecture_Murgu_Formulas** --- **#Collatz_Conjecture_Solved** as promised. I worked on it in any **#Rest_Time_Times** , then take it as it is , but is solved at: " **ua-cam.com/video/RPEGFZbNW2A/v-deo.html** "*** ***Anyway , at this time **#Beauty_Math_Curiosity** (**#Mathematics_Curiosity** ) is **#Murgu_Conjecture_Vicious_Redundancy** " **ua-cam.com/video/vn3H7aUmftk/v-deo.html** " for which I don't have dare to start over, because don't have time, but because maybe never will can demonstrate that have to had only 3 roots (1,5,17)***
Coding train is the best. Nothing inspires me to go work on my own projects like you. It is the combination of your personality and seeing you stumble and occasionally fail but still figuring it out in the end. It makes me feel like I can do the same thing.
What amazing timing! This morning as I booted the computer, my goal was to program something creative and fun while learning something new in a casual, relaxed Sunday morning pace. My wish was granted when I saw the Coding in the Cabana notification. Right now the scene outside my window is a snow-globe world of gently swirling snow flakes. Thank you for transporting us all to the cabana and your garden. This series is a wonderful change of pace.
I’ve found the Collatz conjecture is most interesting when viewed in binary, where the even numbers dividing by 2 essentially becomes chopping off all the zeros on the right side, and the odd numbers multiplying by 3 and adding 1 essentially becomes adding a number to itself bit-shifted one bit to the right and adding 1. There’s patterns in binary that you don’t notice in decimal.
I've only recently happened-across this corner of iterative functions... IMHO, you've hit the nail on the head with 'binary'... That 4-2-1 loop (surprisingly 'octal') is, I believe, KEY to understanding this whole business (but I don't have the math skills to express it as a 'proof'... Notice that seeding the function with zero ALSO goes into this loop (3 * 0 + 1 = 1)... All 8 octal bit patterns (0-7), as seeds, are contained within the lowest 3 bits. Adding another 3 bits (seeds ranging 0 - 63) and the trajectories will, like the infamous 27, occasionally take off toward the clouds, but will eventually decay to the loop... Add another 3 bits (0 - 255, total 3 octal digits) and some trajectories go even higher... BUT, they all decay to the loop again. There are interesting observations to be made about 'intervals' between some of the longer trajectories (ones that go for long excursions before landing on a previously 'used' value that is part of a path toward inevitable decay... 4n+1 points to some interesting seeds, like 32 - (4(1)+1) a.k.a. 32 - 5, our old friend "27"... Hmmmm So, it's been shown that all values of the highest octal digit value combined with all values of the middle octal digit value combined with all values of the lowest octal digit value eventually collapse to the 4-2-1 loop... Conceptually, trying 2 "middle" octals between the high octal and the low octal (ie 12 bits or 0 - 4095) should (will) express similar behaviour. Try 3 "middle" octals (total 15 bits) ... same thing... Viewing the intermediate values in binary, it soon becomes apparent that 'bubbles' of multiple zeroes form, and the lowest octal is desperately trying to drag the value lower (4 is even and 2 is even, so divide and divide... The bits have been shifted to the right twice, and stratospheric numbers come back down to the troposphere... Often a 'bubble' of 6 zeroes forms tantalisingly close to the LSB... A few more steps and the entire value collapses several orders of magnitude. It's fate is sealed and destiny a certainty... Veritasium recently claimed all numbers to 2^68 have been tried, and, for all variations of those 68 bits, all numbers eventually 'collapsed'... Excuse me for thinking this... I recognise that infinity is a very, very distant ceiling, but even with my 32bit explorations (lots of bit pattern variations) the decay begins after not too many iterations of the function... There are 'rallies' along some paths taken, but the conclusion seems inevitable... With nothing but this evidence and intuition, I'm happy to conclude that "bubbles will form" quickly enough (in the rightmost bits) that will reverse any excursion toward the stars, and the strange attractor of "4-2-1" is the fate of all positive integers that enter into the Collatz Conjecture...
I think this video merits some clarification: 1. We don't know if the Collatz Conjecture is true, it's just a conjecture. 2. Both methods of visualizing it are actually the same, one is just a different arrangement of the other. 3. 20:45 - "Just take _a minute_ to ponder the fact..." - Slight understatement: Stephen Wolfram has built a whole new kind of science on this idea!
That is a great observation! It's like Daniel is the Bob Ross of coding! edit: I just watched the first in this series and saw that UA-camr István Horváth already made the Bob Ross connection..
This will be the last video in this series using the chalkboard, apologies, I already shot this one before I got all the feedback on the first! Get the code and submit your version here! thecodingtrain.com/CodingInTheCabana/002-collatz-conjecture.html
"I think that I've made a major error." Why does this make me happy ? Will he solve the issue ? How much time will he take ? I learned something today.
Your enthusiasm towards math, programming and the beauty of life overall 20:48 is something, that i think, most of the community shares and what makes you such a enjoyable fella to watch, btw love the new series of coding in the cabena😊
For those who wanna have the pattern like the numberphile video add: If (value%2==0) rotate(0.27-(0.0002*j)) Else rotate(-0.19+(0.00025*j)) Being j the index of value.
Coding in the 'Cabaña' technically speaking. Ñ (lower case ñ, Spanish: eñe, Phonetic Alphabet: /ˈeɲe/ "énye", About this soundpronunciation (help·info)) is a letter of the modern Latin alphabet, formed by placing a tilde (also referred to as virgulilla in Spanish) on top of an upper- or lowercase N. Gracias por tus super classes maestro :)
Haha. I just got this video in my YT feed today, and have not seen your early work before. This was fun and charming! Kinda liked the format, but I guess it attracts attention away from the message. The "studio" format is very good. Just the right amount of messy and personal. Nice work. You have a fun way of almost "telling a coding story about ". Really like it!
While adding the "(3n+1)/2" trick from the Patreon Slack channel (at 18:11) will speed up the processing of getting each 'n' down to 1, surely it's not the "same sequence" anymore? (essentially it's skipping out even numbers). This would mean the visualisation has less clockwise rotation, and would be one reason why Dan's looks different to Edmund Harris' original visualisation. Anyway, loving the chilled out Cabana videos, Dan!! :D
This is cool ! sometime nature seems so simply encodable it's quit astonishing. I'll try making art with this set of sequences. To me you should make a non linear progressive rotation to deal with the superposition you should even try color gradient. ;) Such a peaceful place for programming.
Oddly enough if you put your initial number in the top-left of an Excel grid, then each step if odd move down and if even move right, stopping the moment you get to a power of 2 it maps almost perfectly to a parabolic path where the end is the pivot point.
Oooo yeah, faster and more controllable than an Lsystem. To make it grow you can trail particles. So also size of the particle can be set to be part of the game 🎉
I remember when the Numberphile video came out. I visualised it in p5, and was discussing it in my school with my friends. Another friend of mine was playing volleyball nearby and had given me his phone to broadcast the game on Instagram live. I set-up the phone near me and forgot about it and continued my discussion. The next day, my volleyball friend met me and said that many people messaged him and asked him what kind of nerd friends he has.
Perhaps instead of descending to 1 from every number, you could try to construct the tree recursively starting from 1 instead. For any number, multiplying it by 2 is an option. But when the number is even, you can check if it can be expressed as 3n+1 for an odd n and if yes, you get a branching point.
Hm, other interesting things about this system is that the uneven path can be abstracted to setting it to ceil(1.5*x) because multiplication by three then adding 1 will always result in an even number which will be divided by 2.
Perhaps the issue is that you don't rotate back until you get to the next starting number? I think you should reset the rotation after every move. From what I understood, the tendrils should never be able to do full rotations. They'll all be within the spread -π/6 to π/6
really you can just check if the sequence ever reaches a power of 2 cause if it does then every successive number after it, will divide by 2 until it gets to 1. Im sure there are many other simplifications possible but i get it the point was to get the pretty diagram not efficiency
This problem is rather interesting, it's sort of a 1 step forward two steps backward kind of thing, it is typical for a number to be multiplied by 3 then divided by 4 under the rules given. Any number which ends with a 1 that also has at least two 0s in-between that 1 and the rest of the number will do just that repeatedly until the end 1 reaches the rest of the number. Also, I'm referring to this in binary representation, I almost forgot to mention that.
It seems that this works not only with 3x+1, but also with a polynomial of the form mx+1, where m is an odd number, m∈N ... Let's take x=1 and substitute m for odd coefficient. numbers: With m=1, everything is reduced to the cycle 2→1*; For m=3 everything is clear; For m=5 we arrive at 4→2→1; For m=7 we also get 4→2→1 *But with m=1 and x=2 you get 4→2→1
Warning, slight "rant": Man this was frustrating. My optimistic choice of using js + svg to do this and my inability to calculate coordinates properly were fairly frustrating but the worst part is the fact that original author actually used different angles for odd and even "turns". It should have been obvious if I had just done bit more testing, odd numbers just don't repeat in Collatz sequence and therefore if you use same angle for both turns you just get stuff that goes in circles with slight "scattering effect/fur looking". Well unless you try to be fancy like I was and calculate x coordinate with trigonometry and make mistake with y calculation getting basically sinusoidal curve with slight scattering from collatz's series...
Friend! Could you make a Coding Challange video where you implement the Bresenham algorithm for drawing a line in pixels between two points? It would be cool!
Good old collatz conjecture. I think the second or third coding project I ever did was a program you gave in random numbers and it spat out if they still fit the conjecture (always building on the previous calculations to make the next one's take less time) but since there is no disproving example within the first 2^64 numbers the program was kinda useless xD
I am really glad that we have someone like you in youtube, i am wondering if i can challenge you with some coding with matter.js, can this plugin add physics to text and letters ? would it be able to add physics to it ? for example a circle hitting the text and it would explode ? i would really really appreciate it if you can look into it :)
What if you change the definition of the sequence? Instead of 3n+1, do 5n+1, or something. Maybe it won't go to 1. So you could put a limit on the cycles. Would it look as interesting?
N= positive odd number. N changes to (3N+1)/2 (3N+1)/2 could be: 1- (3N+1)/2 = positive odd integer 2- (3N+1)/2 = positive even integer 1- assume (3N+1)/2 = positive odd integer, Since N = positive odd integer, it could be a value for (3N+1)/2 So, (3N+1)/2 = N 3N + 1 = 2N 3N - 2N = -1 N = -1, which contradicts with N = positive odd integer. So, the assumption (3N+1)/2 = positive odd integer is false. 2- assume (3N+1)/2 = positive even integer, Since N + 1 = positive even integer, it could be a value for (3N+1)/2 So, (3N+1)/2 = N + 1 3N + 1 = 2N + 2 3N - 2N = 2 - 1 N = 1, which does not contradict with N = positive odd integer. So, the assumption (3N+1)/2 = positive even integer is true, and (3N+1)/2 will change to smaller value (3N+1)/4 < N, getting toward the destination 1. If N = 1, (3N+1)/4 will equal 1, which is a term within the destination loop 1 → 2 → 1. So, N = positive odd integer, just changes to (3N+1)/2 = positive even integer, which changes to (3N+1)/4 < N, getting toward the destination 1. So, Collatz conjecture is true. Eng. Mahmoud Attalla. WhatsApp: +20 1112669096.
I LOVE that you let your kids display their art in the background. No offence if it is yours. Ha ha. We all start somewhere. That's probably something I would produce also.
@@TheCodingTrain Encourage your kids do do more. Tell them your audience loves to see their art. I would especially like to see some type of artwork that they enjoy, not necessarily something they were asked to do at school, if that was the case. Looking forward to more from all of you. I watch your videos all the time. You are a great teacher!
What if you tried generating it backwards? The idea being that you start at one, and then do one of two branches each iteration. n * 2, and (n - 1) / 3, but only take that branch if the result is an integer. I just did it on a sheet of paper and it seems like it would work okay, and it might be good for generating a tree structure.
Is the reason it doesn’t look like Edmund Harris’ visual because you haven’t factored in the branching? Also, just to add I’m a recent convert to the Coding Train/Cabana and I absolutely love it! Thank you.
@@TheCodingTrain yes 😄 I haven't made my own variations for a while because I haven't got the time to do so. 😄😄 but i will also do the #TeamTrees one and this one too ❤ #TeamTrees
Hi, is there any way to create a digging algorithm, like, we have a procedural world with biomes, and we can dig any place until the lava core of the world? Not like minecraft, that uses cubes blocks, but like a real world landscape, I really would like to know this algorithm to develop my game.
Wonderful. I'd already seen the Numberphile series about this, and it's fascinating. One comment: Your optimization that changed 3n+1 to (3n+1)/2 might have screwed things up, as far as trying to match the Numberphile pattern, because now your step count (and branch length) will change by 1 for every odd number in the sequence. That would change the length and shape of the path for every branch. By the way, I don't know what those little white fuzzy things are floating around in your cabana, but I hope you're not allergic. ;-)
I'm a super noob - I've gotten the code to work and been playing with it, but how would I go about getting it to draw out the process? Just putting everything in draw only displays the image as it would be in setup, and then after a while that image again, and then after a while that image again, etc. I get that it's just running it as a loop and only showing the end state, and then layering them. I'm guessing that means the code to show each step of the path getting drawn is a very different approach?
Love your videos. I am trying to replicate bubble shooter game in p5. Saw the Minesweeper one and space invaders and tried to incorporate logic from their. Can you please do bubble shooter game as a coding challenge.
You truly are the Bob Ross of programming
Gijs van der Giessen definitly, and by the way: Happy Birthday Bob Ross...
***How many apples you have in an **#Apple_Tree**, so many **#Dead_Nodes_Will_eat*****
***I appreciate your work in generally . I think here you are making a mistake. **#Collatz_Conjecture** into negative axes isn't a Collatz Conjecture , and if you follow my work , can see for what. Anyway as promised , I solved Collatz Conjecture via **#Murgu_Lemas** **#Collatz_Conjecture_Logical_Dead_Nodes_Lema** **#Eternal_Triad** (which demonstrated every odd Integers , except Logical Dead Nodes and **#Collatz_Perfect_Numbers_Dead_Nodes** but with a dual sense), and **#Collatz_Conjecture_Murgu_Formulas** --- **#Collatz_Conjecture_Solved** as promised. I worked on it in any **#Rest_Time_Times** , then take it as it is , but is solved at: " **ua-cam.com/video/RPEGFZbNW2A/v-deo.html** "***
***Anyway , at this time **#Beauty_Math_Curiosity** (**#Mathematics_Curiosity** ) is **#Murgu_Conjecture_Vicious_Redundancy** " **ua-cam.com/video/vn3H7aUmftk/v-deo.html** " for which I don't have dare to start over, because don't have time, but because maybe never will can demonstrate that have to had only 3 roots (1,5,17)***
~ Happy syntax errors ~
I love the feel of these. Coding in nature to master the nature of code. Awesome!
Thank you!
Coding train is the best. Nothing inspires me to go work on my own projects like you. It is the combination of your personality and seeing you stumble and occasionally fail but still figuring it out in the end. It makes me feel like I can do the same thing.
What amazing timing! This morning as I booted the computer, my goal was to program something creative and fun while learning something new in a casual, relaxed Sunday morning pace. My wish was granted when I saw the Coding in the Cabana notification. Right now the scene outside my window is a snow-globe world of gently swirling snow flakes. Thank you for transporting us all to the cabana and your garden. This series is a wonderful change of pace.
Yay, share what you make!
I’ve found the Collatz conjecture is most interesting when viewed in binary, where the even numbers dividing by 2 essentially becomes chopping off all the zeros on the right side, and the odd numbers multiplying by 3 and adding 1 essentially becomes adding a number to itself bit-shifted one bit to the right and adding 1. There’s patterns in binary that you don’t notice in decimal.
Thank you.
Someone has messed with prng algorithms. Either that or has an inherent talent for them and should go dethrone marsaglia, the current rnjesus
I've only recently happened-across this corner of iterative functions...
IMHO, you've hit the nail on the head with 'binary'... That 4-2-1 loop (surprisingly 'octal') is, I believe, KEY to understanding this whole business (but I don't have the math skills to express it as a 'proof'...
Notice that seeding the function with zero ALSO goes into this loop (3 * 0 + 1 = 1)... All 8 octal bit patterns (0-7), as seeds, are contained within the lowest 3 bits.
Adding another 3 bits (seeds ranging 0 - 63) and the trajectories will, like the infamous 27, occasionally take off toward the clouds, but will eventually decay to the loop...
Add another 3 bits (0 - 255, total 3 octal digits) and some trajectories go even higher... BUT, they all decay to the loop again.
There are interesting observations to be made about 'intervals' between some of the longer trajectories (ones that go for long excursions before landing on a previously 'used' value that is part of a path toward inevitable decay... 4n+1 points to some interesting seeds, like 32 - (4(1)+1) a.k.a. 32 - 5, our old friend "27"... Hmmmm
So, it's been shown that all values of the highest octal digit value combined with all values of the middle octal digit value combined with all values of the lowest octal digit value eventually collapse to the 4-2-1 loop...
Conceptually, trying 2 "middle" octals between the high octal and the low octal (ie 12 bits or 0 - 4095) should (will) express similar behaviour. Try 3 "middle" octals (total 15 bits) ... same thing...
Viewing the intermediate values in binary, it soon becomes apparent that 'bubbles' of multiple zeroes form, and the lowest octal is desperately trying to drag the value lower (4 is even and 2 is even, so divide and divide... The bits have been shifted to the right twice, and stratospheric numbers come back down to the troposphere... Often a 'bubble' of 6 zeroes forms tantalisingly close to the LSB... A few more steps and the entire value collapses several orders of magnitude. It's fate is sealed and destiny a certainty...
Veritasium recently claimed all numbers to 2^68 have been tried, and, for all variations of those 68 bits, all numbers eventually 'collapsed'...
Excuse me for thinking this... I recognise that infinity is a very, very distant ceiling, but even with my 32bit explorations (lots of bit pattern variations) the decay begins after not too many iterations of the function... There are 'rallies' along some paths taken, but the conclusion seems inevitable... With nothing but this evidence and intuition, I'm happy to conclude that "bubbles will form" quickly enough (in the rightmost bits) that will reverse any excursion toward the stars, and the strange attractor of "4-2-1" is the fate of all positive integers that enter into the Collatz Conjecture...
Collatz(x) {return x&1 ? x+x>>1+1 : x>>1;}
Dan please do more of these, they are awesome
I think this video merits some clarification:
1. We don't know if the Collatz Conjecture is true, it's just a conjecture.
2. Both methods of visualizing it are actually the same, one is just a different arrangement of the other.
3. 20:45 - "Just take _a minute_ to ponder the fact..." - Slight understatement: Stephen Wolfram has built a whole new kind of science on this idea!
I love this series so much ^_^ it's really peaceful.
And the Collatz Conjecture is one of my favorites!
Thank you! and Thank you for the support!
That is a great observation! It's like Daniel is the Bob Ross of coding!
edit: I just watched the first in this series and saw that UA-camr István Horváth already made the Bob Ross connection..
Where you people got this emoticon..I need one
This will be the last video in this series using the chalkboard, apologies, I already shot this one before I got all the feedback on the first! Get the code and submit your version here! thecodingtrain.com/CodingInTheCabana/002-collatz-conjecture.html
"I think that I've made a major error." Why does this make me happy ? Will he solve the issue ? How much time will he take ? I learned something today.
Your enthusiasm towards math, programming and the beauty of life overall 20:48 is something, that i think, most of the community shares and what makes you such a enjoyable fella to watch, btw love the new series of coding in the cabena😊
For those who wanna have the pattern like the numberphile video add:
If (value%2==0) rotate(0.27-(0.0002*j))
Else rotate(-0.19+(0.00025*j))
Being j the index of value.
wrong
Coding in the 'Cabaña' technically speaking. Ñ (lower case ñ, Spanish: eñe, Phonetic Alphabet: /ˈeɲe/ "énye", About this soundpronunciation (help·info)) is a letter of the modern Latin alphabet, formed by placing a tilde (also referred to as virgulilla in Spanish) on top of an upper- or lowercase N. Gracias por tus super classes maestro :)
Indeed!
@@TheCodingTrain Thank you for keeping inspiring us every day...in the Cabaña ;) Gracias Maestro!
Yassssss! Always great to see videos inspired by Numberphile videos!
Haha. I just got this video in my YT feed today, and have not seen your early work before. This was fun and charming!
Kinda liked the format, but I guess it attracts attention away from the message. The "studio" format is very good. Just the right amount of messy and personal.
Nice work. You have a fun way of almost "telling a coding story about ". Really like it!
Yes episode 2
Love the chill atmosphere of the cabana
This series is the most beautiful thing on the internet
Fantastic! Such a wonderful example of how algorithms can mirror the shape of nature
While adding the "(3n+1)/2" trick from the Patreon Slack channel (at 18:11) will speed up the processing of getting each 'n' down to 1, surely it's not the "same sequence" anymore? (essentially it's skipping out even numbers). This would mean the visualisation has less clockwise rotation, and would be one reason why Dan's looks different to Edmund Harris' original visualisation.
Anyway, loving the chilled out Cabana videos, Dan!! :D
Thanks for this feedback!
yeah exactly, I'm pretty sure just changing that back will fix thr entire image
You inspire so many people and at the same time, you make learning fun! Great content
This is cool ! sometime nature seems so simply encodable it's quit astonishing. I'll try making art with this set of sequences. To me you should make a non linear progressive rotation to deal with the superposition you should even try color gradient. ;)
Such a peaceful place for programming.
I really like the mood of this serie ! Nice mix of low and high tech, and covered subject are really good ! Thank's
I am enjoying these videos so much :) - I saw the numberphile video, but having the perspective of coding it like this is a very nice addition! TY Dan
Algorithms feel less scary and cold now, thanks to you! Great video and idea
Love to see you so relaxed!
TY, I hadn't seen these forms for CC before and for graphics the first thing I think is: Hair this is a way to cheat organic looking hair
now that I know a quick image search gives some really good results of graphing techniques for different visualizations besides the common graphs.
so cool that it is possible to save your code output to a vector image in processing!
Oddly enough if you put your initial number in the top-left of an Excel grid, then each step if odd move down and if even move right, stopping the moment you get to a power of 2 it maps almost perfectly to a parabolic path where the end is the pivot point.
I'm simply unable to ignore and not like these videos immediately
Oooo yeah, faster and more controllable than an Lsystem. To make it grow you can trail particles. So also size of the particle can be set to be part of the game 🎉
men that was a great ideia to code in an diferent inveronment that we mostly see in youtube, thanx a lot
Thanks!
Thank you for the generous support!
Next time do a "Coding in the igloo"
Coding in northern Ontario
I remember when the Numberphile video came out. I visualised it in p5, and was discussing it in my school with my friends. Another friend of mine was playing volleyball nearby and had given me his phone to broadcast the game on Instagram live. I set-up the phone near me and forgot about it and continued my discussion. The next day, my volleyball friend met me and said that many people messaged him and asked him what kind of nerd friends he has.
P.S: A third of my tea evaporated due to boiling while I wrote the comment
Ah, so I assume you then introduced yourself to these people.
Perhaps instead of descending to 1 from every number, you could try to construct the tree recursively starting from 1 instead. For any number, multiplying it by 2 is an option. But when the number is even, you can check if it can be expressed as 3n+1 for an odd n and if yes, you get a branching point.
yep!
I like your cabana. Its so quite and makes you focus on doing.
Hm, other interesting things about this system is that the uneven path can be abstracted to setting it to ceil(1.5*x) because multiplication by three then adding 1 will always result in an even number which will be divided by 2.
Perhaps the issue is that you don't rotate back until you get to the next starting number? I think you should reset the rotation after every move. From what I understood, the tendrils should never be able to do full rotations. They'll all be within the spread -π/6 to π/6
oh! Yes, that makes sense!
Hm, maybe just dampen the accumulative effect of the rotation? Divide the difference between the current and initial rotation each move.
really you can just check if the sequence ever reaches a power of 2 cause if it does then every successive number after it, will divide by 2 until it gets to 1. Im sure there are many other simplifications possible but i get it the point was to get the pretty diagram not efficiency
This problem is rather interesting, it's sort of a 1 step forward two steps backward kind of thing, it is typical for a number to be multiplied by 3 then divided by 4 under the rules given. Any number which ends with a 1 that also has at least two 0s in-between that 1 and the rest of the number will do just that repeatedly until the end 1 reaches the rest of the number. Also, I'm referring to this in binary representation, I almost forgot to mention that.
It seems that this works not only with 3x+1, but also with a polynomial of the form mx+1, where m is an odd number, m∈N ...
Let's take x=1 and substitute m for odd coefficient. numbers:
With m=1, everything is reduced to the cycle 2→1*;
For m=3 everything is clear;
For m=5 we arrive at 4→2→1;
For m=7 we also get 4→2→1
*But with m=1 and x=2 you get 4→2→1
Please do videos on postfx in processing they are really dope and important
Woow this brought me memories! Nowadays I don't have time to code anything anymore. Great video as always
This man is just in peace
Warning, slight "rant":
Man this was frustrating. My optimistic choice of using js + svg to do this and my inability to calculate coordinates properly were fairly frustrating but the worst part is the fact that original author actually used different angles for odd and even "turns".
It should have been obvious if I had just done bit more testing, odd numbers just don't repeat in Collatz sequence and therefore if you use same angle for both turns you just get stuff that goes in circles with slight "scattering effect/fur looking".
Well unless you try to be fancy like I was and calculate x coordinate with trigonometry and make mistake with y calculation getting basically sinusoidal curve with slight scattering from collatz's series...
I love your coding projects so much! Great work!
Yey another episode in the cabana!!
I hope one day I would be able to code like you.
That scratchy board gives me weird flashbacks to a brocken board in my old math class 😞
Next time try coding the chaotic movement of dust particles after step dancing in the cabana . ;) Good video with nice mood!
Episode 2 is fantastic ☺️
Please do every video in Cabana and probably some in the garden too 😍😍
Oh my God! I did it! I'm translating the code to godot and it's amazing!
Friend! Could you make a Coding Challange video where you implement the Bresenham algorithm for drawing a line in pixels between two points? It would be cool!
you are the coolest prof i know.... 🤩🥰 ....
you are my favorite UA-camr!
Looking forward to some winter cabana episodes with a wood fire crackling in the background.
More likely just a warm coat and layers. . need an orioles beanie!
Good old collatz conjecture. I think the second or third coding project I ever did was a program you gave in random numbers and it spat out if they still fit the conjecture (always building on the previous calculations to make the next one's take less time) but since there is no disproving example within the first 2^64 numbers the program was kinda useless xD
Love this, awesome style, makes me happy to learn! :)
i love this series
I am really glad that we have someone like you in youtube, i am wondering if i can challenge you with some coding with matter.js, can this plugin add physics to text and letters ? would it be able to add physics to it ? for example a circle hitting the text and it would explode ? i would really really appreciate it if you can look into it :)
What if you change the definition of the sequence? Instead of 3n+1, do 5n+1, or something. Maybe it won't go to 1. So you could put a limit on the cycles.
Would it look as interesting?
Yes indeed
Great idea!
Oh man, the noise that that pen makes on the board is excruciating. Is it a Guantanamo Bay torture?
I am eagerly waiting for his 1 million subs.
Dan, what places/books/sites would you recommend to find more cool algorithms?
Here's one of my favorites! amzn.to/2Wj9QQh
@@TheCodingTrain Thank you so much! Thank you for doing these videos btw, they make me like math. Also, you're a great teacher!
Thank you for this dan!
N= positive odd number. N changes to (3N+1)/2
(3N+1)/2 could be:
1- (3N+1)/2 = positive odd integer
2- (3N+1)/2 = positive even integer
1- assume (3N+1)/2 = positive odd integer, Since N = positive odd integer, it could be a value for (3N+1)/2
So, (3N+1)/2 = N
3N + 1 = 2N
3N - 2N = -1
N = -1, which contradicts with N = positive odd integer.
So, the assumption (3N+1)/2 = positive odd integer is false.
2- assume (3N+1)/2 = positive even integer, Since N + 1 = positive even integer, it could be a value for (3N+1)/2
So, (3N+1)/2 = N + 1
3N + 1 = 2N + 2
3N - 2N = 2 - 1
N = 1, which does not contradict with N = positive odd integer.
So, the assumption (3N+1)/2 = positive even integer is true, and (3N+1)/2 will change to smaller value (3N+1)/4 < N, getting toward the destination 1.
If N = 1, (3N+1)/4 will equal 1, which is a term within the destination loop 1 → 2 → 1.
So, N = positive odd integer, just changes to (3N+1)/2 = positive even integer, which changes to (3N+1)/4 < N, getting toward the destination 1. So, Collatz conjecture is true.
Eng. Mahmoud Attalla.
WhatsApp: +20 1112669096.
I LOVE that you let your kids display their art in the background. No offence if it is yours. Ha ha. We all start somewhere. That's probably something I would produce also.
Yes, those are my kids' artworks! (Better than what I would produce!)
@@TheCodingTrain Encourage your kids do do more. Tell them your audience loves to see their art. I would especially like to see some type of artwork that they enjoy, not necessarily something they were asked to do at school, if that was the case. Looking forward to more from all of you. I watch your videos all the time. You are a great teacher!
recursive solution for p5.js (just the sequence):
function setup() {
const res = genCollatzSeq(27);
console.log(res.length-1);
console.log(res);
}
function genCollatzSeq(num) {
const seq = [];
function collatz(num) {
seq.push(num);
if (num > 1) {
if (num % 2 === 0) {
return collatz(num / 2);
} else {
return collatz(3*num + 1);
}
}
}
collatz(num);
return seq;
}
What if you tried generating it backwards? The idea being that you start at one, and then do one of two branches each iteration. n * 2, and (n - 1) / 3, but only take that branch if the result is an integer. I just did it on a sheet of paper and it seems like it would work okay, and it might be good for generating a tree structure.
yep!
🎶Coding in the Cabana... Music and passion were always the fashion in the Coding Cabana... 🎶
Is the reason it doesn’t look like Edmund Harris’ visual because you haven’t factored in the branching?
Also, just to add I’m a recent convert to the Coding Train/Cabana and I absolutely love it! Thank you.
What if you set the angle inside the for that draws the lines, something like ANGLE = PI/(6*(j+1))
Loving the plants!
I love processing and exporting my own pdfs
Can't wait to make my own variation of this, will surely do this after i come back from vacation.
Looking forward to it!
@@TheCodingTrain yes 😄 I haven't made my own variations for a while because I haven't got the time to do so. 😄😄 but i will also do the #TeamTrees one and this one too ❤
#TeamTrees
HI!, thanks for all videos!! One thing... The file PDF dont take the diferents stroke() for each line that i want. Anyone know about this?? Thanks!
LOVE your content. Please keep demonstrating projects in Java!
I really want to work on this now :) I'll see if I can find a way to export a p5.js project as PDF!
Hi, is there any way to create a digging algorithm, like, we have a procedural world with biomes, and we can dig any place until the lava core of the world? Not like minecraft, that uses cubes blocks, but like a real world landscape, I really would like to know this algorithm to develop my game.
Wonderful. I'd already seen the Numberphile series about this, and it's fascinating.
One comment: Your optimization that changed 3n+1 to (3n+1)/2 might have screwed things up, as far as trying to match the Numberphile pattern, because now your step count (and branch length) will change by 1 for every odd number in the sequence. That would change the length and shape of the path for every branch.
By the way, I don't know what those little white fuzzy things are floating around in your cabana, but I hope you're not allergic. ;-)
Yes, that is a good point, thanks for the feedback! I think the floating things are just dust particles, the sun was shining directly in!
Make more videos in cabana using processing
Would make a really beautiful photoshop brush - very organic.
I'm a super noob - I've gotten the code to work and been playing with it, but how would I go about getting it to draw out the process? Just putting everything in draw only displays the image as it would be in setup, and then after a while that image again, and then after a while that image again, etc. I get that it's just running it as a loop and only showing the end state, and then layering them. I'm guessing that means the code to show each step of the path getting drawn is a very different approach?
Keep ‘em coming please
Hm. What about reversing process and starting from 0? How/why to decide where to branch? How do corrals do it?
This is quality content
Could we have iterated i backwards ? instead of making the sequence ?
Simply amazing!
Will you ever do a JS framework video? Like react maybe?
I think you should reset the rotation after drawing each step: Rotate(a) -> Draw -> Rotate(-a)
Yes, I should try this!
Where does he stream?
What causes the sharp angle in the middle of the drawing?
Love your videos. I am trying to replicate bubble shooter game in p5. Saw the Minesweeper one and space invaders and tried to incorporate logic from their. Can you
please do bubble shooter game as a coding challenge.
16:44 looks like a heart
Is a FloatList just an ArrayList?
the cabin is perfect for processing , simulating nature in nature ,love it
Which IDE is use in this video?
i love this format. :)