Shop OBEX P1 Docs P2 Docs Learn Events
The Collatz Conjecture Is a Simple Problem That Mathematicians Can't Solve - Page 4 — Parallax Forums

The Collatz Conjecture Is a Simple Problem That Mathematicians Can't Solve

12467

Comments

  • Heater.Heater. Posts: 21,230
    mindrobots,
    Heater.,

    Here's your big Collatz with a side of PyPy:...
    We have something to discuss here. Your PyPy result is different from mine.

    My version prints:
    Steps 473206
    
    Your PyPy prints:
    Steps 473522
    
    Who is right?
  • Heater. wrote: »
    I think Martin_H wins the prize for the most obfuscated Collatz program so far.

    Is that a program or is the baud rate set wrong on the serial interface?

    :)

    I'm honored. If my program is indistinguishable from line noise then that's a win!

  • kwinnkwinn Posts: 8,697
    Has anyone produced an x/y plot of the starting value vs number of steps?
  • MikeDYurMikeDYur Posts: 2,176
    edited 2016-08-16 13:21
    @tomcrawford
    Tom,
    I'm afraid to say the LCD threw me, I have the Parallax 4x20 (Scott Edwards) with backpack. Your code looks like it has two data lines at 19200 baud. This one is only capable of 9600, the only thing I can think of is yours is without the backpack. Can I convert the initialization line and not effect the overall spin. If the speed is critical than this won't do it.

    Mike

    EDIT: I can see that calls to print to LCD are handled different, I may be able to do this on my own, if you say it can be done.

    EDIT2: I havent used this LCD in quite awhile, I see now that most of my spin code is set for 19200, I was looking at docs for this module, that specify 9600 max, I don't remember why there is a difference. I may get it yet.

    EDIT3: I see, it's a "FullDuplexSerial" thing, sorry I wasted your time. ;)
  • Heater. wrote: »
    mindrobots,
    Heater.,

    Here's your big Collatz with a side of PyPy:...
    We have something to discuss here. Your PyPy result is different from mine.

    My version prints:
    Steps 473206
    
    Your PyPy prints:
    Steps 473522
    
    Who is right?


    I noticed the difference and attributed it to starting with different numbers coming out of the random number generator. You used Python 2.7 and I used PyPy3 - I wasn't expecting to see the same 2000 digit numbers to start with.

    More investigation....
  • Heater.Heater. Posts: 21,230
    mindrobots,

    Ah, sorry, I forgot about the randint thing. That probably accounts for the difference.

    Makes timing comparisons useless though.


  • kwinn wrote: »
    Has anyone produced an x/y plot of the starting value vs number of steps?

    There are various visualizations and a fractal image here:
    https://en.wikipedia.org/wiki/Collatz_conjecture
  • I can generate a random number spit it out from one and then suck it back into the other (probably).

    It's end of day here...that kind of coding will take a beer to visualize.
  • PyPy did a BILLION! without blowing up!
    [code]
    [rapost@c3po python]$ time pypy3 collatz.py
    max 670617279 steps 986

    real 55m13.030s
    user 55m8.131s
    sys 0m3.360s
    [code]
  • User NameUser Name Posts: 1,451
    edited 2016-08-15 21:58
    I'm not sure why people keep saying even numbers "don't increase" ????

    I didn't say that even numbers don't increase. All I'm saying is that when searching for a higher value of imax (in Ariba's code) than the algorithm has previously found, you can discount even numbers because those numbers, divided by 2, have already been screened. I.e. they are guaranteed not to disprove the Conjecture.

    Edit: Just to be clear... If no other number between x and 2x has a higher imax, then 2x will raise imax by the trivial amount of 1. But that's the most it can ever do.

  • Heater.Heater. Posts: 21,230
    Ron,

    Yeah, the fact that this stupid little procedure with integer numbers produces things that look like the Mandlebrot set, which works with complex numbers, is pretty weird.

  • Heater.Heater. Posts: 21,230
    User name,
    ...you can discount even numbers because those numbers, divided by 2, have already been screened.
    Are you sure that is true?
  • Heater. wrote: »
    User name,
    ...you can discount even numbers because those numbers, divided by 2, have already been screened.
    Are you sure that is true?

    I'm positive it's true!

  • Heater.Heater. Posts: 21,230
    Wait a minute...

    As far as we know, unless the conjecture is wrong, any given starting number will run around, even and odd, and eventually arrive at one.

    In doing so it will hit a "path" some other lesser starting number has already taken to one.

    But that is the whole point of the conjecture, so far unproved. Maybe there is a number out there whose "path" never arrives at one. That is to say it never connects to a lower numbers path that went to one. It just cycles around a big lot of odd and even numbers, forever.

  • tomcrawfordtomcrawford Posts: 1,126
    edited 2016-08-15 22:45
    MikeDYur wrote: »
    @tomcrawford
    Tom,
    Your code looks like it has two data lines at 19200 baud.

    Mike

    EDIT: I can see that calls to print to LCD are handled different, I may be able to do this on my own, if you say it can be done.

    EDIT2: I havent used this LCD in quite awhile, I see now that most of my spin code is set for 19200, I was looking at docs for this module, that specify 9600 max, I don't remember why there is a difference. I may get it yet.

    Full Duplex Serial wants a transmit and a receive pin. I specified 16 as a receive pin only because I had to say something; I don't use it.

    It can be done. Don't worry about the formatting to begin with; just get stuff on the screen.

    Edit: The code is definitely write for a Parallax Serial LCD p/n 27979.
  • But once the number is devided by two, than that number has alread been proven to reduce to one.
  • Heater.Heater. Posts: 21,230
    edited 2016-08-15 22:53
    MikeDYur
    But once the number is devided by two, than that number has alread been proven to reduce to one.
    Only if dividing by 2 hits a number that has already been shown to reduce to one.

    How can you be sure that always happens?

    If it were so simple it would not be a "conjecture".

    If it we so simple Paul Erdős would not have said "Mathematics may not be ready for such problems."
  • Heater, what you guys have done with this is no less than amazing, but isn't it small potatoes compared to being run on a super computer somewhere, hasn't anyone done that?
  • Heater.Heater. Posts: 21,230
    MikeDYur ,

    Yes of course they have.

    I think you are missing a point here.

    With a Propeller you can check a range of numbers and verify that the sequence always terminates at 1.

    With a PC you can check a much bigger range of numbers and verify that the sequence always terminates at 1.

    With a "super computer" you can check a much, much, bigger range of numbers and verify that the sequence always terminates at 1.

    However, no matter how big your computer, no matter what the biggest numbers you test, you can never say that there is not some number out there for which the sequence does not terminate at 1.

    There is a long way between the biggest numbers our computers can hold and infinity.

    That is why it is a conjecture after all.

  • Heater. wrote: »
    With a Propeller you can check a range of numbers and verify that the sequence always terminates at 1.

    Yup. And since the range of numbers I'm using starts at three and hits every odd number between that and at least 100,000,000,001, I can be certain I'm missing nothing important by not looking at the even numbers. Dividing any even number in that range repeatedly by two will ultimately do one of two things: 1) arrive at 1, or 2) arrive at an odd number that I have tested. It's truly axiomatic. No big mystery here. :)

  • I get it.

    It can not be disproven by are capabilities now. But future capabilities possibly could.
    I just can't wrap my head around that, once that magic number is processed, it opens up a new bunch of magic numbers, that we should have been able to process now.
  • Heater.Heater. Posts: 21,230
    edited 2016-08-16 09:16
    MikeDYur,
    It can not be disproven by are capabilities now. But future capabilities possibly could.
    That is not so clear.

    What if the magic number that disproves the thing is really, really big ?

    I mean big enough that it would take every atom in the universe to represent it.

    Or perhaps you have run out of atoms in the universe to build such a big computer?

    What then?

    You still cannot be sure there is not a number out there, even bigger, for which the sequence does not end in 1.

    No, what we want is a serious logical proof that there cannot be such number, by some other devious means.
  • Heater.Heater. Posts: 21,230
    User Name,

    OK, sounds convincing.

    Does not help us resolve the conjecture I guess.
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2016-08-16 00:39
    User Name wrote: »
    ...
    Dividing any even number in that range repeatedly by two will ultimately do one of two things: 1) arrive at 1, or 2) arrive at an odd number that I have tested.

    I finally see what you've been saying about only needing to check the odd numbers. The way you worded the above statement clears it up!

  • Thank you for the help in this Heater, but haven't we made laws with less proof. Mathematicians just want the suspense factor.
  • Heater.Heater. Posts: 21,230
    edited 2016-08-16 10:01
    MikeDYur,
    ...haven't we made laws with less proof.
    I don't think so.

    Mathematicians do not make laws, they discover them. If they can.

    What they do is make some essential definitions. Like what is a number? And what operations can we perform on those numbers we have defined?

    Even this is not so simple. Is a number just the integers, 1, 2, 3... as they used to be back in time? Do I include zero as a number (The Romans did not)? What about negative numbers? What about infinity? What about fractions and irrational numbers. That's before we start thinking about complex numbers, vectors, quaternions etc.

    And what about those operations? What does it mean to add, subtract, multiply, divide? Is A * B the same as B * A? (Not always the case).

    Having got all those definitions sorted out we can then start applying the operations (+, - etc) to the objects (numbers, etc) and see what we can do. Where does it lead?

    But, being imaginative humans we can also start to speculate about where this set of rules and objects might lead. I might say "I think 9823479287 * 879277442 = 64102910496109823". True or false? Well, given the rules you can easily check.

    Except, some things we speculate, like the Collatz Conjecture, are not so simple to demonstrate as true or false.

    I like to think of all this by analogy with a game like chess. In chess we define the board and the pieces. We define the rules about how they can move. We define what it means to win. And so on. Given those rules we start to play and see what happens. I might speculate that the shortest possible chess game is 10 moves. That would be a conjecture. Perhaps you can demonstrate if that is true or not.

    Of course, we can always tweak our basic definitions of the objects and the rules that apply. Play a different game. Then see what happens. And end up with interesting results like 1 + 2 + 3 + 4 ... = -1/12

    Edit: The shortest possible chess game is only 2 moves.
  • MikeDYurMikeDYur Posts: 2,176
    edited 2016-08-16 12:39
    A very down to earth explanation Heater, and I'm not ashamed to say I needed that, one thing though, couldn't this just be considered a trick with numbers. If it were just simply multiplication and division, that would be keeping the original number pure. But the moment we add a 1, we have manipulated that number to suit our needs. Take the number 100 through the grinder, you add a 1, 7 times in the process. To me you have changed the original number to get the desired result.

    JMO

    MikeY
  • Heater.Heater. Posts: 21,230
    edited 2016-08-16 14:33
    What do you mean by "trick"?

    I tend to think of a "trick" in maths as someone demonstrating something is true when it should be false. Like proving that 1 = 2. Usually by hiding a mis-step in some convoluted procedure.

    Or a "trick" is someone getting a true result in some clever way that you had never dreamed of. Like the way Newton manages to divide zero by zero in his differential calculus and get a correct result for the slope of a curve at a given point. First time I saw that I as a teenager I was almost shouting "Whoa! You can't do that!".

    Then what do you mean by "pure". Numbers can be "odd" or "even" or "ïnteger" or "irrational" or "prime" and all manner of other things. What is a "pure" number?

    How is it that adding 1 destroys this "pureness" when dividing by 2 or any other operation does not?

    What you seem to be saying is that something does not feel right about this. Something does not sit right in your mind. That's OK. Listening to mathematicians speak one gets the idea that this feeling of "rightness" drives a lot of what they do. They are not just sitting there all day trying all possible operations on numbers, equations and so on at random. There is something very emotional about it.

    Let's make that chess analogy again. Take an empty chess board. Let's number the squares from 1 to 64. Start at 1 in the bottom left, go up to 8 on the bottom right. Then 2 to 16 on the next row and so on. As we see all odd numbers are black. All even numbers are white.

    Now put a bishop on it in some square of your choice.

    The fact that is a bishop dictates the moves it can make.

    Now I ask, can that bishop be moved from where it is to square number 1?

    Soon you notice that all the allowed bishop moves keep it on the same color squares. Square number 1 is black. So if the bishop starts on a white square it can never be moved to square 1. Obvious right? We have a kind of proof there.

    Now let's do the same again with a knight. Hmm, a knight always moves to a square of a different color, so I guess it can get to square 1. But it's moves are bit complicated...Not so obvious. We could try it of course. But can we construct a proof that it can always get to one or not?

    Collatz is a bit like this chess procedure. Hoping from black to white, odd to even. The "tricky" part about Collatz is that it's like changing the chess piece from a bishop to a night, i.e. changing the rules that apply, as you go along. And then the extra twist is that there is a kind of "meta" rule that dictates when you change from a bishop to a knight depending on where you are.
  • Heater. wrote: »
    What do you mean by "trick"?

    Then what do you mean by "pure".

    How is it that adding 1 destroys this "pureness" when dividing by 2 or any other operation does not?

    What you seem to be saying is that something does not feel right about this. Something does not sit right in your mind. That's OK.


    What I meant by trick is, an allusion, what you see is specifically manipulated to appear as something else. Though the three steps involved here, divide or multiply and add are magic in its simplicity to achieve the final number 1.

    As far as pure, I meant let's say, you have the number 12 which can be devided by 2 to reach an answer of 1. But if you take the number 11 and try to do the same thing, you cannot. But by adding 1 to the 11, then it works. It just seems like your changing the original number to fit the mold.

    You summed it up in the last line I quoted you, it didn't sit well, but your explanation's have helped greatly.

    I watched a PBS documentary a couple maybe three times on: String Theory, towards the end of the show it all clicked in my mind. Watching it again I had the same reaction, to explain it or even summarize the theory now would be impossible for me. I quess it's all about thinking outside of the box, Thank for your time in helping me do that.

    MikeY
  • Heater.Heater. Posts: 21,230
    Wow, if you managed to understand any string theory for even a second that is quite something.

    I studied quantum mechanics in uni. It was incredibly hard for me to get my head around it. Mostly all forgotten soon after graduating.

Sign In or Register to comment.