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 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.

    T Offline
    T Offline
    TheGreatAndPowerfulOz
    wrote on last edited by
    #29

    0 is the least used 1 is the most used

    #SupportHeForShe Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun

    1 Reply Last reply
    0
    • M Munchies_Matt

      1

      T Offline
      T Offline
      TheGreatAndPowerfulOz
      wrote on last edited by
      #30

      0

      #SupportHeForShe Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun

      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.

        I Offline
        I Offline
        imzhangqin
        wrote on last edited by
        #31

        000 001 ... 009 010 011 ... 019 ... 990 001 ... 999 so, from 000 ~ 999, all digit are equal. But, remove leading '0', '0' is least frequent. Adding 1000, so, 1 is most frequent.

        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.

          I Offline
          I Offline
          imzhangqin
          wrote on last edited by
          #32

          000 001 ... 009 010 011 ... 019 ... 990 001 ... 999 so, from 000 ~ 999, all digit are equal. But, remove leading '0', '0' is least frequent. Adding 1000, so, 1 is most frequent.

          1 Reply Last reply
          0
          • Mike HankeyM Mike Hankey

            13 being the less frequent because I don;t like it and my girlfriend says it makes her butt look big.

            New version: WinHeist Version 2.2.2 Beta
            I told my psychiatrist that I was hearing voices in my head. He said you don't have a psychiatrist!

            P Offline
            P Offline
            PIEBALDconsult
            wrote on last edited by
            #33

            If not that, then what?

            Mike HankeyM 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.

              P Offline
              P Offline
              PIEBALDconsult
              wrote on last edited by
              #34

              1
              10
              11
              100
              101
              110
              111
              1000

              0 == 8 1 == 13

              1 Reply Last reply
              0
              • P PIEBALDconsult

                If not that, then what?

                Mike HankeyM Offline
                Mike HankeyM Offline
                Mike Hankey
                wrote on last edited by
                #35

                11s Ok but 12 is better. Oh you mean her butt...that's a touchy subject! :)

                New version: WinHeist Version 2.2.2 Beta
                I told my psychiatrist that I was hearing voices in my head. He said you don't have a psychiatrist!

                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

                  U Offline
                  U Offline
                  User 12831244
                  wrote on last edited by
                  #36

                  Yep, same thinking I had. Looks solid to me :-)

                  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.

                    U Offline
                    U Offline
                    User 12831244
                    wrote on last edited by
                    #37

                    Consider these by the length of the number we have 4 groups. 1-9 10-99 100-999 1000-1000 In the first three groups we only need to consider the first digit, the remaining digits will have an identical number of every digit 0-9, as they cover the complete range. In the final group there is only one number, so it is trivial. Group 1 adds 1 of 1-9. Group 2 adds 10 of 1-9. Group 3 adds 100 of 1-9. Group 4 adds 1 of 1 and 3 of 0. This makes 1 the most common (by 1) and 0 the least common.

                    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.

                      U Offline
                      U Offline
                      User 12831244
                      wrote on last edited by
                      #38

                      Ooh, I worked this out the easy way: count them... 14 1s and 9 0s. Easy!

                      Kornfeld Eliyahu PeterK 1 Reply Last reply
                      0
                      • U User 12831244

                        Consider these by the length of the number we have 4 groups. 1-9 10-99 100-999 1000-1000 In the first three groups we only need to consider the first digit, the remaining digits will have an identical number of every digit 0-9, as they cover the complete range. In the final group there is only one number, so it is trivial. Group 1 adds 1 of 1-9. Group 2 adds 10 of 1-9. Group 3 adds 100 of 1-9. Group 4 adds 1 of 1 and 3 of 0. This makes 1 the most common (by 1) and 0 the least common.

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

                        Is fascinating how one can get the right answer even from the wrong reasoning...

                        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
                        • U User 12831244

                          Ooh, I worked this out the easy way: count them... 14 1s and 9 0s. Easy!

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

                          In the range of 1-99 there are 20 1s alone!!!

                          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

                          U 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.

                            C Offline
                            C Offline
                            Chris C B
                            wrote on last edited by
                            #41

                            Looks to me that everybody is wrong. There are clearly more zeros than ones. Each byte is packed with leading zeros. The ones are big-time losers. QED. :laugh:

                            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.

                              K Offline
                              K Offline
                              kalberts
                              wrote on last edited by
                              #42

                              Then go on to the next one: To enter our office area, you must tap the correct four digit code on the keypad by the door. For some strange reason, the checking is implemented as pipeline: The last four digits typed must be the correct ones. So, if the correct code is 2345 and you start typing 1234 the door won't open. Then you add the 5, and the door opens. In other words: You have tested two 4-digit keystrokes by 5 keypresses. Problem 1: What is the minimal number of keypresses required to go through all 10000 possible coded? Problem 2: Describe the algorithm for generating the order of keypresses Problem 3: Prove that this is the minimal number of keypresses Problem 4: The average number of codes you have to try to find the right one is 5000. How many keypresses have you made before having tried 5000 codes? Does it depend on the order of these keypresses? (Note: I do not have the answers)

                              1 Reply Last reply
                              0
                              • C Chris C B

                                Looks to me that everybody is wrong. There are clearly more zeros than ones. Each byte is packed with leading zeros. The ones are big-time losers. QED. :laugh:

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

                                I would like to see how it goes on base 2... ;)

                                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

                                C 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.

                                  G Offline
                                  G Offline
                                  gervacleto
                                  wrote on last edited by
                                  #44

                                  The easy way: I made a program and the result is: 0: 192 times 1: 301 times 2...9: 300 times. So, everyone is right :)

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

                                    I would like to see how it goes on base 2... ;)

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

                                    C Offline
                                    C Offline
                                    Chris C B
                                    wrote on last edited by
                                    #45

                                    I was actually thinking about posting the entire binary sequence so people could count for themselves, but Excel only goes up to 511 in DEC2BIN. :-\

                                    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

                                      U Offline
                                      U Offline
                                      User 11671086
                                      wrote on last edited by
                                      #46

                                      I agree with Brent. Take all arrangements of 3-digit numbers(1000 arrangements). All digits are equally represented. Remove any leading zeroes ('0' or '00') from the list. Remove '000' from the list. We have fewer zeroes now but all other numbers are equally represented. Adding '1000' at the end will not make up the deficit. So fewer zeroes but 1 has the greatest score because of '1000' David

                                      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
                                        RussTheMan
                                        wrote on last edited by
                                        #47

                                        Interesting one . . It's about two things - the Interval of integers under consideration and the fact that poor zero never gets to be the first (most significant) digit. For a range of 1 to 10^n, lucky "1" gets representation in both the first AND last, so has a count of one more than all the rest other than zero. Zero never starts an integer, so looses out greatly but does indeed benefit slightly from (n-1) representations in the last number in the series. I don't think I have ever actually replied to anything on CP - many thanks for interesting me so much as to prompt me to do so this time! Russ

                                        A few are great. I am small. Together we are the Universe.

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

                                          In the range of 1-99 there are 20 1s alone!!!

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

                                          U Offline
                                          U Offline
                                          User 12831244
                                          wrote on last edited by
                                          #48

                                          Not in binary ;-)

                                          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