Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

The New Coffee Room

  1. TNCR
  2. General Discussion
  3. Puzzle time - flipping the pentagon

Puzzle time - flipping the pentagon

Scheduled Pinned Locked Moved General Discussion
27 Posts 4 Posters 277 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • jon-nycJ Online
    jon-nycJ Online
    jon-nyc
    wrote on last edited by
    #1

    The vertices of a pentagon are labeled with integers, the sum of which is positive. At any time, you may change the sign of a negative label, but then the new value is subtracted from both neighbors' values so as to maintain the same sum.

    For example, if (reading clockwise around the pentagon) the numbers are 1, 2, -2, -3, 3, you could flip the -2 and get 1, 0, 2, -5, 3 or you could flip the -3 and get 1, 2, -5, 3, 0.

    Show that, inevitably, no matter which labels are flipped, the process will terminate after finitely many flips, with all values non-negative.

    Only non-witches get due process.

    • Cotton Mather, Salem Massachusetts, 1692
    1 Reply Last reply
    • HoraceH Offline
      HoraceH Offline
      Horace
      wrote on last edited by Horace
      #2

      If you consider the energy of the system to be the sum of the negative values, you can see that a flip will at best conserve that energy while consolidating it into fewer vertices. For all other cases it will reduce that energy until it is zero, i.e. there are no negative numbers left.

      Education is extremely important.

      1 Reply Last reply
      • jon-nycJ Online
        jon-nycJ Online
        jon-nyc
        wrote on last edited by jon-nyc
        #3

        I immediately made the analogy to entropy.

        FWIW, I was unable to solve this before the solution was sent to me.

        Only non-witches get due process.

        • Cotton Mather, Salem Massachusetts, 1692
        1 Reply Last reply
        • jon-nycJ Online
          jon-nycJ Online
          jon-nyc
          wrote on last edited by jon-nyc
          #4

          By the way, Horace, it isn’t even the case that the amount of negative amplitude never increases. Consider a negative between two zeros. Or between two negative numbers.

          Only non-witches get due process.

          • Cotton Mather, Salem Massachusetts, 1692
          1 Reply Last reply
          • HoraceH Offline
            HoraceH Offline
            Horace
            wrote on last edited by
            #5

            Right. I believe it is the case that the standard deviation inevitably decreases, but the raw negative amplitude sum does not necessarily decrease with every iteration.

            Education is extremely important.

            1 Reply Last reply
            • jon-nycJ Online
              jon-nycJ Online
              jon-nyc
              wrote on last edited by
              #6

              There’s something that invariably decreases, but I was unable to find and specify it in the time I put in.

              Only non-witches get due process.

              • Cotton Mather, Salem Massachusetts, 1692
              1 Reply Last reply
              • HoraceH Offline
                HoraceH Offline
                Horace
                wrote on last edited by
                #7

                sum error from the mean?

                Education is extremely important.

                1 Reply Last reply
                • jon-nycJ Online
                  jon-nycJ Online
                  jon-nyc
                  wrote on last edited by
                  #8

                  That’s one of the first things I tried

                  Only non-witches get due process.

                  • Cotton Mather, Salem Massachusetts, 1692
                  1 Reply Last reply
                  • jon-nycJ Online
                    jon-nycJ Online
                    jon-nyc
                    wrote on last edited by
                    #9

                    Frustrating how many metrics almost always decreased.

                    (I had a python script that would generate the numbers randomly and iterate the steps, displaying each successive set and whatever metric I tried.)

                    Only non-witches get due process.

                    • Cotton Mather, Salem Massachusetts, 1692
                    1 Reply Last reply
                    • KlausK Offline
                      KlausK Offline
                      Klaus
                      wrote on last edited by
                      #10

                      Don’t post the solution yet.

                      1 Reply Last reply
                      • KlausK Offline
                        KlausK Offline
                        Klaus
                        wrote on last edited by
                        #11

                        Reminds me of cellular automata, famously explored by Stephen Wolfram.

                        At first I missed the "sum is positive" condition and was confused because when the sum isn't positive, the process doesn't terminate.

                        In fact, from what I can see, the sum of all numbers always stays the same, so of course if the sum is negative, at least one number must be negative.

                        My first idea would be to show that there is a number n, such that after n steps the number of negative labels has decreased by at least 1.

                        I also have the vague suspicion that the problem has some relation to Euclid's algorithm for greatest common divisor.

                        No time now, but I'll revisit the problem tomorrow.

                        1 Reply Last reply
                        • jon-nycJ Online
                          jon-nycJ Online
                          jon-nyc
                          wrote on last edited by
                          #12

                          Klaus - I intimated earlier the following hint:

                          Try to find some measure of progress; that is, some value that you can compute from the five numbers which either always goes up or always goes down, and won't stop moving until all the numbers are non-negative.

                          Only non-witches get due process.

                          • Cotton Mather, Salem Massachusetts, 1692
                          1 Reply Last reply
                          • KlausK Offline
                            KlausK Offline
                            Klaus
                            wrote on last edited by Klaus
                            #13

                            Yes, I saw that, but sometimes it’s easier to combine multiple small steps into a big step and show progress with regard to a decreasing well founded order for the big steps.

                            But I think I have an idea now.

                            :::
                            Consider the Infinite sequence of partial sums as you Walk around the Pentagon (just keep walking indefinitely).

                            That sequence increases after at most 5 steps because the sum of the numbers is positive.

                            If all numbers are positive, it would be a sorted sequence.

                            I believe every flip makes this sequence “more sorted”, I.e. it decreases the number of sorting errors.

                            I’ll try to work out the details tomorrow but I’m positive this will work.
                            :::

                            1 Reply Last reply
                            • HoraceH Offline
                              HoraceH Offline
                              Horace
                              wrote on last edited by Horace
                              #14

                              (sum of positive values) - (abs(sum of negative values)) will go up or remain constant. If constant, then the number of negative values is reduced. If the number of negative values goes up, it means that the metric goes up.

                              Edit: This should be the difference of absolute values rather than their ratio.

                              Education is extremely important.

                              1 Reply Last reply
                              • jon-nycJ Online
                                jon-nycJ Online
                                jon-nyc
                                wrote on last edited by
                                #15

                                That’s just equal to the sum of the 5 numbers which remains constant by definition.

                                Only non-witches get due process.

                                • Cotton Mather, Salem Massachusetts, 1692
                                1 Reply Last reply
                                • HoraceH Offline
                                  HoraceH Offline
                                  Horace
                                  wrote on last edited by
                                  #16

                                  Yeah, it doesn't work. Neither does ratio of the two sums.

                                  Education is extremely important.

                                  1 Reply Last reply
                                  • KlausK Offline
                                    KlausK Offline
                                    Klaus
                                    wrote on last edited by Klaus
                                    #17

                                    Got it.

                                    :::
                                    Let l-0 to l-4 be the label values.

                                    The partial sums are:

                                    P-0 = 0
                                    P-i = P-(i-1) + l-(i modulo 5)

                                    Obviously, for every i, P-(i+5) = P-i + s, where s is the sum of l-0 to l-4. So the sequence of P-i is
                                    roughly sorted, but there are sorting errors in between.

                                    More precisely, let e-i be the number of sorting errors at i, defined as follows:

                                    e-i = the number of j > i with P-j < P-i.

                                    e-i is finite because the sum of labels is positive.

                                    Now consider the sum of errors E = e-0 + ... + e-4.

                                    Every flip decreases E by one, hence we are done after E steps.

                                    Example with the "critical case" of a flip turning two positive numbers negative.

                                    168f936e-0a21-43b6-abd9-bb17422b9d64-image.png

                                    The error sum in the beginning is 5 and indeed we are done after 5 flips. We see how the error values 4 and 0 are swapped by the flip, but after the flip the 4 is decreased by one to 3. All other errors stay the same.

                                    So my method also gives you the number of required flips. And it generalizes easily to more than 5 labels.

                                    :::

                                    1 Reply Last reply
                                    • jon-nycJ Online
                                      jon-nycJ Online
                                      jon-nyc
                                      wrote on last edited by
                                      #18

                                      Wait a minute.... try your theory on this set:

                                      [3,-6,-1,-2,11] and flip the -6.

                                      I think you'll find that the sum of the errors stays the same.

                                      Only non-witches get due process.

                                      • Cotton Mather, Salem Massachusetts, 1692
                                      1 Reply Last reply
                                      • KlausK Offline
                                        KlausK Offline
                                        Klaus
                                        wrote on last edited by Klaus
                                        #19

                                        No, it works fine on your example.

                                        The required number of flips decreases from 13 to 12 after flipping the -6.

                                        cc5f3f46-a024-4234-8b56-abbda5563c64-image.png

                                        Try it out and you'll see that you'll indeed need 13 flips for the example, which is exactly the sum of sorting errors predicted by my method.

                                        In the general case, if you flip l-i, then the new e-i is the old e-(i+1) and the new e-(i+1) is the old e-i minus one: all other e-j stay the same. Hence the sum of e-0 to e-4 decreases by 1 with each flip.

                                        1 Reply Last reply
                                        • LuFins DadL Offline
                                          LuFins DadL Offline
                                          LuFins Dad
                                          wrote on last edited by
                                          #20

                                          Never flipped the Pentagon, but I’ve flipped off Capitol Hill.

                                          The Brad

                                          1 Reply Last reply
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups