Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • 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
Code Project
  1. Home
  2. The Lounge
  3. TWCP OTD (The Who Cares Puzzle Of The Day) - 24th of January, 2017

TWCP OTD (The Who Cares Puzzle Of The Day) - 24th of January, 2017

Scheduled Pinned Locked Moved The Lounge
csshelpquestion
48 Posts 21 Posters 0 Views 1 Watching
  • 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.
  • Kornfeld Eliyahu PeterK Offline
    Kornfeld Eliyahu PeterK Offline
    Kornfeld Eliyahu Peter
    wrote on last edited by
    #1

    THE MOST AND LESS FREQUENT DIGITS IN THE NUMBERS FROM 1 TO 1000 It is not about writing code - but it is possible - but some nice logical explanation... So which is the most frequent digit in the list of numbers form 1 to 1000? And the less frequent? Why? And even Google is our friend - it would be nice to not to tell him about it...

    Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

    "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

    D J M M D 22 Replies Last reply
    0
    • Kornfeld Eliyahu PeterK Kornfeld Eliyahu Peter

      THE MOST AND LESS FREQUENT DIGITS IN THE NUMBERS FROM 1 TO 1000 It is not about writing code - but it is possible - but some nice logical explanation... So which is the most frequent digit in the list of numbers form 1 to 1000? And the less frequent? Why? And even Google is our friend - it would be nice to not to tell him about it...

      Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

      D Offline
      D Offline
      dbrenth
      wrote on last edited by
      #2

      OK, I'll be the first in. 1 is the most only because you are going from 1 to 1000. If it was 1 to 999 or 2 to 1000, there would be the same number of 1's as all other non-zero numbers. 0 is the least because numbers do not start with a 0. (except 0 which is not included).

      Brent

      Kornfeld Eliyahu PeterK U 2 Replies Last reply
      0
      • Kornfeld Eliyahu PeterK Kornfeld Eliyahu Peter

        THE MOST AND LESS FREQUENT DIGITS IN THE NUMBERS FROM 1 TO 1000 It is not about writing code - but it is possible - but some nice logical explanation... So which is the most frequent digit in the list of numbers form 1 to 1000? And the less frequent? Why? And even Google is our friend - it would be nice to not to tell him about it...

        Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

        J Offline
        J Offline
        Jochen Arndt
        wrote on last edited by
        #3

        Without thinking much: The less is obviously the zero. The most probably the one because 1000 is the only 4-digit number.

        Kornfeld Eliyahu PeterK 1 Reply Last reply
        0
        • D dbrenth

          OK, I'll be the first in. 1 is the most only because you are going from 1 to 1000. If it was 1 to 999 or 2 to 1000, there would be the same number of 1's as all other non-zero numbers. 0 is the least because numbers do not start with a 0. (except 0 which is not included).

          Brent

          Kornfeld Eliyahu PeterK Offline
          Kornfeld Eliyahu PeterK Offline
          Kornfeld Eliyahu Peter
          wrote on last edited by
          #4

          dbrenth wrote:

          1 is the most only because you are going from 1 to 1000

          That does not convince me... That's a sloppy reasoning at the best...

          dbrenth wrote:

          0 is the least because numbers do not start with a 0.

          But 1000 brings in three zeroes...

          Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

          "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

          D 1 Reply Last reply
          0
          • J Jochen Arndt

            Without thinking much: The less is obviously the zero. The most probably the one because 1000 is the only 4-digit number.

            Kornfeld Eliyahu PeterK Offline
            Kornfeld Eliyahu PeterK Offline
            Kornfeld Eliyahu Peter
            wrote on last edited by
            #5

            Jochen Arndt wrote:

            The less is obviously the zero.

            I see nothing obvious there... You may say, that the line does not start with zero so it is at least one appearance behind, but 1000 adds three more zeroes!

            Jochen Arndt wrote:

            The most probably the one because 1000 is the only 4-digit number.

            OK. But that implies, that no other number had an advantage before than... Why is that?

            Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

            "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

            J 1 Reply Last reply
            0
            • Kornfeld Eliyahu PeterK Kornfeld Eliyahu Peter

              THE MOST AND LESS FREQUENT DIGITS IN THE NUMBERS FROM 1 TO 1000 It is not about writing code - but it is possible - but some nice logical explanation... So which is the most frequent digit in the list of numbers form 1 to 1000? And the less frequent? Why? And even Google is our friend - it would be nice to not to tell him about it...

              Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

              M Offline
              M Offline
              Marc Clifton
              wrote on last edited by
              #6

              Well, you've got 1-9, where all digits except 0 appear once. Then you've got 10-19, where 1 occurs 11 times, every other digit, including 0 now, once. Then you've got 20-29, where 2 occurs 11 times, etc. by 90-99, we have all digits in count except 0 which lags by 10 (every digit occurs twice in each set of 10 except 0 which occurs once, so you've got 10 sets, so 0 lags by 10. (every other digit in the set x0-x9 occurs 11 times). 100 - 109 - Now 0 makes up for a lost digit, but loses out again in the 1n0-1n9 (where 10 > n > 0) Ultimately, at 1000, 0 should still be the least frequent digit, and 1 gets a head start on everyone else. I think I thought that through properly, but my brain is still fried mapping XML to bizarre property fields in strange class relationships that someone else wrote and where all the rules are embedded in the business logic for creating said entity containers. :sigh: Marc

              V.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

              Kornfeld Eliyahu PeterK U 2 Replies Last reply
              0
              • Kornfeld Eliyahu PeterK Kornfeld Eliyahu Peter

                THE MOST AND LESS FREQUENT DIGITS IN THE NUMBERS FROM 1 TO 1000 It is not about writing code - but it is possible - but some nice logical explanation... So which is the most frequent digit in the list of numbers form 1 to 1000? And the less frequent? Why? And even Google is our friend - it would be nice to not to tell him about it...

                Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

                M Offline
                M Offline
                Mark_Wallace
                wrote on last edited by
                #7

                We need a bit of context, here. 0. Strictly normal daily usage, 1 is the first number (and is also a article, grammatically), so it will come into most use. 1. In a supermarket, 99, because they treat their customers like ****ing idiots. 2. In a nursery school: 3, 4, or 5. 3. In a brothel, somewhere between 68 and 70 (non-inclusive). 4. Etc. Whatever "answer" you give as being absolute will have some context, but will be wrong in all the others.

                I wanna be a eunuchs developer! Pass me a bread knife!

                Kornfeld Eliyahu PeterK 1 Reply Last reply
                0
                • M Marc Clifton

                  Well, you've got 1-9, where all digits except 0 appear once. Then you've got 10-19, where 1 occurs 11 times, every other digit, including 0 now, once. Then you've got 20-29, where 2 occurs 11 times, etc. by 90-99, we have all digits in count except 0 which lags by 10 (every digit occurs twice in each set of 10 except 0 which occurs once, so you've got 10 sets, so 0 lags by 10. (every other digit in the set x0-x9 occurs 11 times). 100 - 109 - Now 0 makes up for a lost digit, but loses out again in the 1n0-1n9 (where 10 > n > 0) Ultimately, at 1000, 0 should still be the least frequent digit, and 1 gets a head start on everyone else. I think I thought that through properly, but my brain is still fried mapping XML to bizarre property fields in strange class relationships that someone else wrote and where all the rules are embedded in the business logic for creating said entity containers. :sigh: Marc

                  V.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                  Kornfeld Eliyahu PeterK Offline
                  Kornfeld Eliyahu PeterK Offline
                  Kornfeld Eliyahu Peter
                  wrote on last edited by
                  #8

                  Not bad for an old chap Marc... The only thing is that 0 is behind by 11 in the 1-99 range, so the three zeroes of 1000 can't help it out...

                  Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

                  "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

                  1 Reply Last reply
                  0
                  • Kornfeld Eliyahu PeterK Kornfeld Eliyahu Peter

                    dbrenth wrote:

                    1 is the most only because you are going from 1 to 1000

                    That does not convince me... That's a sloppy reasoning at the best...

                    dbrenth wrote:

                    0 is the least because numbers do not start with a 0.

                    But 1000 brings in three zeroes...

                    Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

                    D Offline
                    D Offline
                    dbrenth
                    wrote on last edited by
                    #9

                    For the most, The problem actually scales down to what is the most frequent digit between 1 and 10. There are 2 ones. It is the same idea for 1 to 1 X 10^n. You wouldn't notice the least until you get to 11 to 20. In this case, 1 shoots out ahead because it leads half of the digits. in 21 to 30, 2 catches up to 1. But there is no equivalent section of numbers for 0. In 1 to 100 there are only 11 0's, which puts it far behind the other numbers and it never catches up.

                    Brent

                    Kornfeld Eliyahu PeterK 1 Reply Last reply
                    0
                    • M Mark_Wallace

                      We need a bit of context, here. 0. Strictly normal daily usage, 1 is the first number (and is also a article, grammatically), so it will come into most use. 1. In a supermarket, 99, because they treat their customers like ****ing idiots. 2. In a nursery school: 3, 4, or 5. 3. In a brothel, somewhere between 68 and 70 (non-inclusive). 4. Etc. Whatever "answer" you give as being absolute will have some context, but will be wrong in all the others.

                      I wanna be a eunuchs developer! Pass me a bread knife!

                      Kornfeld Eliyahu PeterK Offline
                      Kornfeld Eliyahu PeterK Offline
                      Kornfeld Eliyahu Peter
                      wrote on last edited by
                      #10

                      What about the numerical context?

                      Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

                      "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

                      M 1 Reply Last reply
                      0
                      • Kornfeld Eliyahu PeterK Kornfeld Eliyahu Peter

                        What about the numerical context?

                        Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

                        M Offline
                        M Offline
                        Mark_Wallace
                        wrote on last edited by
                        #11

                        42

                        I wanna be a eunuchs developer! Pass me a bread knife!

                        Kornfeld Eliyahu PeterK 1 Reply Last reply
                        0
                        • D dbrenth

                          For the most, The problem actually scales down to what is the most frequent digit between 1 and 10. There are 2 ones. It is the same idea for 1 to 1 X 10^n. You wouldn't notice the least until you get to 11 to 20. In this case, 1 shoots out ahead because it leads half of the digits. in 21 to 30, 2 catches up to 1. But there is no equivalent section of numbers for 0. In 1 to 100 there are only 11 0's, which puts it far behind the other numbers and it never catches up.

                          Brent

                          Kornfeld Eliyahu PeterK Offline
                          Kornfeld Eliyahu PeterK Offline
                          Kornfeld Eliyahu Peter
                          wrote on last edited by
                          #12

                          Now, that's much better!!! :thumbsup:

                          Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

                          "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

                          1 Reply Last reply
                          0
                          • M Mark_Wallace

                            42

                            I wanna be a eunuchs developer! Pass me a bread knife!

                            Kornfeld Eliyahu PeterK Offline
                            Kornfeld Eliyahu PeterK Offline
                            Kornfeld Eliyahu Peter
                            wrote on last edited by
                            #13

                            You won the big prize today!!!

                            Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

                            "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

                            1 Reply Last reply
                            0
                            • Kornfeld Eliyahu PeterK Kornfeld Eliyahu Peter

                              Jochen Arndt wrote:

                              The less is obviously the zero.

                              I see nothing obvious there... You may say, that the line does not start with zero so it is at least one appearance behind, but 1000 adds three more zeroes!

                              Jochen Arndt wrote:

                              The most probably the one because 1000 is the only 4-digit number.

                              OK. But that implies, that no other number had an advantage before than... Why is that?

                              Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

                              J Offline
                              J Offline
                              Jochen Arndt
                              wrote on last edited by
                              #14

                              You did not wrote "list of numbers form 0001 to 1000". So it is obvious that the zero occurs less often than other digits. 1-9: Each digit except zero occurrs once 10-99: Each digit except zero occurs 10 times (10's place) plus 9 times (1's place); zero 9 times >= 100: Zero is now present at the 10's place like the other digits but not at the 100's place.

                              Kornfeld Eliyahu PeterK 1 Reply Last reply
                              0
                              • Kornfeld Eliyahu PeterK Kornfeld Eliyahu Peter

                                THE MOST AND LESS FREQUENT DIGITS IN THE NUMBERS FROM 1 TO 1000 It is not about writing code - but it is possible - but some nice logical explanation... So which is the most frequent digit in the list of numbers form 1 to 1000? And the less frequent? Why? And even Google is our friend - it would be nice to not to tell him about it...

                                Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

                                D Offline
                                D Offline
                                Duncan Edwards Jones
                                wrote on last edited by
                                #15

                                There's a touch of Benfield's Benford's Law about this...

                                Kornfeld Eliyahu PeterK 1 Reply Last reply
                                0
                                • J Jochen Arndt

                                  You did not wrote "list of numbers form 0001 to 1000". So it is obvious that the zero occurs less often than other digits. 1-9: Each digit except zero occurrs once 10-99: Each digit except zero occurs 10 times (10's place) plus 9 times (1's place); zero 9 times >= 100: Zero is now present at the 10's place like the other digits but not at the 100's place.

                                  Kornfeld Eliyahu PeterK Offline
                                  Kornfeld Eliyahu PeterK Offline
                                  Kornfeld Eliyahu Peter
                                  wrote on last edited by
                                  #16

                                  Much better - it is like the second version of some code... more robust and trustworthy... :thumbsup:

                                  Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

                                  "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

                                  1 Reply Last reply
                                  0
                                  • D Duncan Edwards Jones

                                    There's a touch of Benfield's Benford's Law about this...

                                    Kornfeld Eliyahu PeterK Offline
                                    Kornfeld Eliyahu PeterK Offline
                                    Kornfeld Eliyahu Peter
                                    wrote on last edited by
                                    #17

                                    Benford's law is more about observation of probability in naturally occurring number lists and it is much more a phenomenon... I tried to keep it more terrestrial...

                                    Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

                                    "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

                                    1 Reply Last reply
                                    0
                                    • Kornfeld Eliyahu PeterK Kornfeld Eliyahu Peter

                                      THE MOST AND LESS FREQUENT DIGITS IN THE NUMBERS FROM 1 TO 1000 It is not about writing code - but it is possible - but some nice logical explanation... So which is the most frequent digit in the list of numbers form 1 to 1000? And the less frequent? Why? And even Google is our friend - it would be nice to not to tell him about it...

                                      Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

                                      R Offline
                                      R Offline
                                      realJSOP
                                      wrote on last edited by
                                      #18

                                      Real programmers start counting with 0, and logically speaking, a list of 1000 numbers would only go to 999. Using my logic: Most instances = 1 through 9 (all tied) Least instances = 0 If you did it wrong (as stated by the original message), 1 would be first (by just one instance), and 0 would still be the least used. Actual results: 1-1000 0 = 300 1 = 300 2 = 300 3 = 300 4 = 300 5 = 300 6 = 300 7 = 300 8 = 300 9 = 189 0-999 0 = 190 1 = 300 2 = 300 3 = 300 4 = 300 5 = 300 6 = 300 7 = 300 8 = 300 9 = 297

                                      ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                                      -----
                                      You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                                      -----
                                      When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                                      Kornfeld Eliyahu PeterK M 2 Replies Last reply
                                      0
                                      • R realJSOP

                                        Real programmers start counting with 0, and logically speaking, a list of 1000 numbers would only go to 999. Using my logic: Most instances = 1 through 9 (all tied) Least instances = 0 If you did it wrong (as stated by the original message), 1 would be first (by just one instance), and 0 would still be the least used. Actual results: 1-1000 0 = 300 1 = 300 2 = 300 3 = 300 4 = 300 5 = 300 6 = 300 7 = 300 8 = 300 9 = 189 0-999 0 = 190 1 = 300 2 = 300 3 = 300 4 = 300 5 = 300 6 = 300 7 = 300 8 = 300 9 = 297

                                        ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                                        -----
                                        You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                                        -----
                                        When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                                        Kornfeld Eliyahu PeterK Offline
                                        Kornfeld Eliyahu PeterK Offline
                                        Kornfeld Eliyahu Peter
                                        wrote on last edited by
                                        #19

                                        John Simmons / outlaw programmer wrote:

                                        Real programmers start counting with 0

                                        And outlaw programmers keep their logic as secret... :-D

                                        Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

                                        "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

                                        R 1 Reply Last reply
                                        0
                                        • Kornfeld Eliyahu PeterK Kornfeld Eliyahu Peter

                                          THE MOST AND LESS FREQUENT DIGITS IN THE NUMBERS FROM 1 TO 1000 It is not about writing code - but it is possible - but some nice logical explanation... So which is the most frequent digit in the list of numbers form 1 to 1000? And the less frequent? Why? And even Google is our friend - it would be nice to not to tell him about it...

                                          Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

                                          OriginalGriffO Offline
                                          OriginalGriffO Offline
                                          OriginalGriff
                                          wrote on last edited by
                                          #20

                                          Kornfeld Eliyahu Peter wrote:

                                          which is the most frequent digit in the list of numbers form 1 to 1000?

                                          Assuming that those are spelling errors:

                                          2 it the least frequent, with only one instance.
                                          0 is the most frequent, with three instances.
                                          Poor old 1 has only two instances in the collection {1, 2, 1000}

                                          Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

                                          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                                          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                                          Kornfeld Eliyahu PeterK 1 Reply Last reply
                                          0
                                          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
                                          • World
                                          • Users
                                          • Groups