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 - the Fibonacci numbers

Puzzle time - the Fibonacci numbers

Scheduled Pinned Locked Moved General Discussion
31 Posts 4 Posters 310 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 jon-nyc

    What language is that?

    KlausK Offline
    KlausK Offline
    Klaus
    wrote on last edited by Klaus
    #16

    @jon-nyc said in Puzzle time - the Fibonacci numbers:

    What language is that?

    Haskell.

    I bet if you do the same thing in your favorite language you need at least twice as much code, and the code will be less extensible. (throws gauntlet)

    1 Reply Last reply
    • jon-nycJ Offline
      jon-nycJ Offline
      jon-nyc
      wrote on last edited by
      #17

      I use 8086 assembler for such tasks.

      Only non-witches get due process.

      • Cotton Mather, Salem Massachusetts, 1692
      1 Reply Last reply
      • Doctor PhibesD Offline
        Doctor PhibesD Offline
        Doctor Phibes
        wrote on last edited by
        #18

        Are you two about to have a 'my dick is smaller' contest?

        I was only joking

        KlausK 1 Reply Last reply
        • Doctor PhibesD Doctor Phibes

          Are you two about to have a 'my dick is smaller' contest?

          KlausK Offline
          KlausK Offline
          Klaus
          wrote on last edited by
          #19

          @Doctor-Phibes Did you know that dick sizes have a Fibonacci distribution? It's a distribution with a very long tail...

          <insert @George-K rimshot image macro here>

          1 Reply Last reply
          • jon-nycJ jon-nyc

            Interesting observation:

            Cycle lengths 2^n = 3*2^(n-1) at least within the first 100. Does that continue?

            jon-nycJ Offline
            jon-nycJ Offline
            jon-nyc
            wrote on last edited by
            #20

            @jon-nyc said in Puzzle time - the Fibonacci numbers:

            Interesting observation:

            Cycle lengths 2^n = 3*2^(n-1) at least within the first 100. Does that continue?

            bump for Klaus and his little 4 line program.

            Only non-witches get due process.

            • Cotton Mather, Salem Massachusetts, 1692
            KlausK 1 Reply Last reply
            • jon-nycJ jon-nyc

              @jon-nyc said in Puzzle time - the Fibonacci numbers:

              Interesting observation:

              Cycle lengths 2^n = 3*2^(n-1) at least within the first 100. Does that continue?

              bump for Klaus and his little 4 line program.

              KlausK Offline
              KlausK Offline
              Klaus
              wrote on last edited by Klaus
              #21

              @jon-nyc said in Puzzle time - the Fibonacci numbers:

              @jon-nyc said in Puzzle time - the Fibonacci numbers:

              Interesting observation:

              Cycle lengths 2^n = 3*2^(n-1) at least within the first 100. Does that continue?

              bump for Klaus and his little 4 line program.

              Can you explain? You mean that the cycle length of Fib mod (2^n) is the same as Fib mod (3*2^(n-1))? That doesn't seem to be true.

              I uploaded the first 10,000 cycle lengths here, if you want to check this yourself.
              https://www.heypasteit.com/clip/0IV18W

              1 Reply Last reply
              • jon-nycJ Offline
                jon-nycJ Offline
                jon-nyc
                wrote on last edited by jon-nyc
                #22

                No, the cycle length of Fib mod (2^n) = 3*2^(n-1))

                Check Fmod2, Fmod4, Fmod8, Fmod16 etc for their cycle lengths. You’ll get 3,6,12,24,48 etc. I’m wondering if it holds. I think it will.

                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
                  #23

                  Here's a list of pairs where the first number shows the "n" (but only for powers of 2) and the second one the associated cycle length. Maybe I missunderstood something but your conjecture doesn't seem to hold.

                  [(2,6),(4,24),(8,60),(16,24),(32,36),(64,120),(128,420),(256,264),(512,516),(1024,72),(2048,600),(4096,1368),(8192,720)]
                  
                  1 Reply Last reply
                  • jon-nycJ Offline
                    jon-nycJ Offline
                    jon-nyc
                    wrote on last edited by jon-nyc
                    #24

                    But your original list is this one:

                    (left side numbering mine, right side list yours)

                    3e9774ed-e059-4cd4-956f-c8646a08d27b-image.png

                    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
                      #25

                      Ah, looks like an "off by two" error somewhere. Hmm....

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

                        Turned out to be two "off by 1" errors that have to do with indices starting at 0 and not 1.

                        What about this result?

                        [(2,3),(4,6),(8,12),(16,24),(32,48),(64,96),(128,192),(256,384),(512,768),(1024,1536),(2048,3072),(4096,6144),(8192,12288)]
                        
                        1 Reply Last reply
                        • KlausK Offline
                          KlausK Offline
                          Klaus
                          wrote on last edited by Klaus
                          #27

                          It looks like linear relations between the cycle length happen quite frequently. This is a scatter plot of the cycle lengths I computed above (haven't used R in a while - fun for plotting data!). Observe all the dotted lines. The points you identified are on one of those lines. Also interesting to see a few outliers.

                          440d6f5b-c0a6-4d2d-b301-7d3d66c1fafd-image.png

                          I have marked the points you are interested in in red. You see that there are way more points on that line.

                          1 Reply Last reply
                          • jon-nycJ Offline
                            jon-nycJ Offline
                            jon-nyc
                            wrote on last edited by
                            #28

                            Interesting.

                            So it turns out Fibonacci cycle lengths a thing people study. They’re called Pisano numbers and understanding them is really about understanding Pisano numbers for prime powers.

                            A neat property is that if n and m are coprime then period(mn) is least common multiple of period(n) and period(m).

                            Only non-witches get due process.

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

                              Wait a minute, is that really your graph up there? This is from Wiki

                              396851CA-71EE-4E8B-AB14-42964B4121AC.png

                              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
                                #30

                                Yes, it's my graph. I haven't seen the WIki graph yet, but it shows the same data, so of course it's similar. It's an interesting coincidence that they also cut off at 10,000.

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

                                  Just for fun, here's the continuation of the dataset for cycle lengths up to 20000.

                                  1549ea7c-ea85-4eca-aea0-3b73c980f9aa-image.png

                                  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