Answer to the Friday Puzzle….

65

If you are coming to the Edinburgh Festival, I am performing ‘And the goat remained a goat‘, with musicians The Creative Martyrs at 5pm each day in the Voodoo Rooms. There will be amazing magic, creepy music, rare film footage, and several paranormal happenings (photo by Gordon Rutter).

price

So, to the puzzle.  On Friday I set this puzzle…..

Can you create a 10-digit number, where the first digit is how many zeros in the number, the second digit is how many 1s in the number etc. until the tenth digit which is how many 9s in the number.

If you have not tried to solve it, have a go now.  For everyone else, the answer is after the break.

One answer is 6210001000 – did you come up with any others?

I have produced an ebook containing 101 of the previous Friday Puzzles! It is called PUZZLED and is available for the Kindle (UK here and USA here) and on the iBookstore (UK here in the USA here). You can try 101 of the puzzles for free here.

65 comments on “Answer to the Friday Puzzle….

  1. Geodetective says:

    I have used “brute force” programming, and found that this is the only valid answer.

    • Vaibhav Garg says:

      Just as a curiosity, can you share the code that you used for bruteforcing?

    • Kristian says:

      I didn’t code anything, but I assume it would just go from 0000000000 through 9999999999, count the occurences of all digits, and see if they match the number.

    • Geodetective says:

      Vaibhav,

      Sorry, I have it on another computer that I don’t have access too right now. It was quite badly programmed though🙂

      Later I realized that I could have made the program a million times faster.

    • Anonymous says:

      Here’s my code for a brute force solution (in Scala)

      (any improvements let me know!)

      Only finds one number that meets the requirements.

    • jb says:

      Another attempt here, which tries to mimic the manual approach used by other commenters.

      As you can see in the Gist – it gets near the solution and then oscillates back & forth – not quite sure why

    • Geodetective says:

      Fast code:

      #include “stdafx.h”
      #include

      void display(int*arr)
      {
      for (int i(0);i<10;i++)
      std::cout<<arr[i];
      std::cout<<"\n";
      }
      void check(int*arr)
      {
      int checkarr[11];
      for (int i(0);i<10;i++)
      checkarr[i]=0;

      for (int i(0);i<10;i++)
      checkarr[arr[i]]++;

      for (int i(0);i<10;i++)
      if(checkarr[i]!=arr[i])
      return;

      display(arr);
      }

      void next(int turn, int start, int*arr)
      {
      int arr2[10];

      if (turn == 10)
      {
      check(arr);
      return;
      }
      turn++;
      for (int current = start; current<10; current++)
      {
      for (int i(0);i<10;i++)
      arr2[i] = arr[i];
      arr2[current]++;
      next(turn,current,arr2);
      }
      }
      int _tmain(int argc, _TCHAR* argv[])
      {
      int arr[10];
      for (int i(0);i>hold;
      return 0;
      }

    • Geodetective says:

      The html formatting destroys it…

    • Izzy Lee Impressed says:

      @Geodetective
      “include “stdafx.h”
      #include

      void display(int*arr)
      {
      for (int i(0);i<10;i++)
      std::cout<<arr[i];
      std::cout<<"\n";
      }
      void check(int*arr)
      {
      int checkarr[11];
      for (int i(0)"

      GRRRR, you sexy beast you🙂

    • Geodetective says:

      Ok, retry… If you use C++, make sure you include windows.h and iostream…

      void display(int*arr)
      {for (int i(0);i<10;i++)
      std::cout<<arr[i];std::cout<<"\n";}

      void check(int*arr)
      {int checkarr[11];for (int i(0);i<10;i++)checkarr[i]=0;
      for (int i(0);i<10;i++)checkarr[arr[i]]++;
      for (int i(0);i<10;i++)if(checkarr[i]!=arr[i])return;
      display(arr);}

      void next(int turn, int start, int*arr)
      {int arr2[10];if (turn == 10){check(arr);return;}turn++;
      for (int current = start; current<10; current++)
      {for (int i(0);i<10;i++)arr2[i] = arr[i];arr2[current]++;
      next(turn,current,arr2);}}

      int main()
      {int arr[10];for (int i(0);i<10;i++)arr[i]=0;
      next(0,0,arr);
      Sleep(5000);
      return 0;}

  2. Anne Elk says:

    As your resident maths dummy, I’ll pose a familiar question. I know I could have Googled and I know I could have used a program (if I knew how to do programming), but can anyone explain how to solve this puzzle with a brain and a pen and paper? I didn’t even know where to start.

    • jasontimothyjones says:

      you can use subtractive logic, start with the first digit it cant be zero.. so
      9000000000 cant work it would need to be
      8000000010 but that cant work because of the 1…once you get to 6xxxxx it kinda works it self out

    • bigdavesb says:

      Well, this is how I did it:

      I knew there would have to be lots of zeroes, as it wouldn’t be possible to have all digits represented. I started with this:

      9000000000

      That obviously broke the rules, but from there I kept changing it so it followed the rules, and modifying it accordingly. Not very elegant, but it worked. Something like this:
      8000000001
      8100000010
      8210000010
      6210001000

      After, I consulted my mathmatician brother, and he pointed out the obvious: all the digits must sum to 10, as they would represent the total number of digits. This would probably have got me to the answer a bit sooner.

    • Barry Goddard says:

      @Anne Elk

      All you need is an unmediated relationship with reality. What the Hindus call union with Brahma. What the Buddhists call Enlightenment.

      Then you just have to introspect quietly and allow the answer to be drawn toward you.

      Even those of us who have not acheived the full goals of Hinduism and Buddhism can have a deeply intuitive response that allows us to find these answers.

      I wish to be modest. Yet even the more critical elements who post here (such as @simon) have called my skills “almost godlike”.

      If a septic like @simon is moved to use such language then we can know that within his heart he too can intuit such things.

      Reality is truer than equations as equations can be proved false. The discussions last week on Godel and proving that 1=2 show this only too well.

    • Matthias says:

      Hi Anne!
      I did the following. I first wrote down the index number, which stand for the numbers used. Then i filled everything with 0’s. Then i continued step by step by fixing the obvious errors. So I added a 9 in the first index for the used 0’s.
      0 1 2 3 4 5 6 7 8 9 (Index Table)
      0 0 0 0 0 0 0 0 0 0 (First Step)
      9 0 0 0 0 0 0 0 0 0
      9 0 0 0 0 0 0 0 0 1
      8 0 0 0 0 0 0 0 1 0
      8 1 0 0 0 0 0 0 1 0
      8 2 1 0 0 0 0 0 1 0
      6 2 1 0 0 0 0 0 1 0
      6 2 1 0 0 0 1 0 0 0

      Hope this helped.

      Best regards,
      Matthias

    • Anne Elk says:

      @jasontimothyjones @bigdavesb @Matthias
      Thank you for your workings-out. Every day’s a school day. (And thank you in advance to anyone who posts after I’ve posted this.)

      @Barry Goddard
      You wrote: “All you need is an unmediated relationship with reality.”
      I’m sure it’s a well-meant suggestion but unfortunately I only have about twenty minutes on a Friday to solve these puzzles. Your suggestion might take me a bit longer than I’ve got. It’s a nice idea, though…🙂

    • Slange Navarr says:

      @Barry G.
      “All you need is an unmediated relationship with reality.”

      Is that all?

      Perfect comic timing, as ever. Love it.

    • DAve says:

      “Septic?”. Barry G, was that a typo or did you really mean it? Is I were a betting man I would say that it was 22 to 7, the former

    • Barry Goddard says:

      @Anne Elk @Slange Navarr

      The reality of a relationship with reality is that it takes no time at all to establish.

      I admit that I wasted my youth trying the methods of Hinduism and Buddhism. They taught me useful techniques but not the depth needed for breakthrough.

      My most useful training was in studying the stars. The stars are clearly a mysterious part of reality as is the human consciousness/ Thus one can shine light on the other. My success in that endevour is well known.

      Yet all that was just background. To open our minds to reality takes nothing more than a pure openness. It can be done even on a bus.

      Yet do not make the mistake of closing your mind by studying mathematics. Being able to play with symbols is a distraction from what is real/

      My many successes as shown on this very website are evidence indeed of the value of my approach. The attacks from the mathtards shows how threatened they feel even as they produce wrong answers that show 1=2 and other nonsense.

      I hope that I may continue to demonstrate my humble yet effective techniques on this site for many times to come. I know that many of you welcome this even if fear of the attacks from others stay your hand in saying so.

    • Hugh Janus says:

      Barry G, do you have a website or blog devoted to your astrological musings? There are many of us here that would love to know more

    • Starman says:

      @Hugh Janus: Let me google that for you:

      http://bit.ly/1olTUT3

    • Sally Pollard says:

      Good grief. He’s real. He actually thinks like that.

    • Noseache says:

      @Starman. Just be careful though. Just because there is a bloke called Barry Goddard who likes astronomy, it doesn’t follow that it’s the same person who posts as ‘Barry Goddard’ here.

      It might be, of course, but it needn’t be.

    • Roger The Saurus says:

      I see that Barry is still spouting his particularly insidious version of trolling. And he’s quite comfortable bleating about people calling him names while with the same mouth he refers to others as “mathtards”.

    • Hugh Janus says:

      Thank you Starman

      Yikes! He exists!

    • Steve Jones says:

      @Anna Elk

      I did a (sort of) brute force approach by cutting down how many numbers need to be checked so it can be done by hand.

      Note as there are ten digits in the number all the digits in the must add up to 10. This means if you generate all the combinations of the digits 1-9 that can add up to 10, then you can easily generate all the candidate numbers. It sounds horrendous, but there are actually only 41 possible candidates. I simply generated the list of candidates using ordered lists of the digits starting with those including 9, then 8, then 7 and so on. Once you get those, it’s easy to generate a corresponding 10 digit candidate number

      9,1 – yields 7100000001 (fails)
      8,2 – yields 7010000010 (fails)
      8,1,1 – yields 7200000010 (fails)
      7,3 – yields 7001000100 (fails)
      7,2,1 – yields 6110000100 (fails)
      7,1,1,1 – yields 7300000100 (fails)
      6,4 – yields 7000101000 (fails)
      6,3,1 – yields 6101001000 (fails)
      6,2,2 – yields 7020001000 (fails)
      6,2,1,1 – yields 6210001000 works

      So after just 10 of these (generating the candidates from large numbers first) you get to the answer. There are actually only 41 “candidates” using this technique, so it’s possible to check them all by hand. However, it’s a bit error-prone, so using a spreadsheet and functions like “countif” and using columns helps.

      So it’s not definitively the best way of doing it, but it is manageable.

      (Note that in generating the combinations “top” down using the larger digits first, you will have exhausted the possibilities, so when you get to combinations involving, say, 4 you never have to consider those above as you’ve already covered them).

    • Steve Jones says:

      @Starman @noseache

      It’s astrology that Barry Goddard is interested in, not astronomy. In terms of ethos, those two subjects are about as different as you can imagine. Indeed, the Venn diagram of “experts” in both subjects probably shows zero overlap.

    • Noseache says:

      That’s embarrassing. Steve Jones (of all people!) has pointed out a mistake I’ve made. I knew what I meant, but yes, I did write astronomy and not astrology, so fair enough — my error.

    • DAve says:

      @Steve Jones. Typical response from a Capricorn

    • Steve Jones says:

      @DAve

      Oh, you do know how to hurt somebody…

    • DAve says:

      Mere online banter on my part. No offence intended

    • Steve Jones says:

      @DAve

      And I took it oh so seriously. Now don’t I look the fool…

  3. kroketje says:

    I just went down some possibilities…
    9000000000 is missing a 1 at the nines
    8000000010 is missing a 1 at the ones, but that would automatically become two ones,
    so you’ll then have two ones, one two and one number for the zeros.
    ten mines two ones, one two and the zeros is six
    answer is therefor 6210001000

  4. Lynette says:

    By selecting the person themselves, they will know that
    they are making the right connection. While er are Going to a comedy club to hear a comedian tell jokes is an excellent way to spend
    the night on the town with a spouse or group of friends.
    Beginning your path to becoming positive can start with the
    simplest of things.

  5. ian says:

    These are numbers. They have 10 digits.

    0000000000
    0100000000

  6. Anonymous says:

    I misunderstood the question – so that didn’t help much!

  7. Ken Haley says:

    Of course you can always use a quantum computer to solve the problem in a single step. Too bad they haven’t successfully built one yet.

  8. Island Man says:

    Can’t be a number starting with “0” as it the first digit is the number of 0’s in the full number.

  9. Greta says:

    Yes, I came up with 8,000,000,010!

  10. Eddie says:

    I’m in India at the moment though it’s not helping me solve the puzzles without maths.

  11. Steve Jones says:

    Just for a bit of idle amusement, I extended the problem to try and find answers for numbers with between 1 and 10 digits to see if there was a common pattern, or if there there were any with more than one answer. This is what I found

    10 digits – 6210001000
    9 digits – 521001000
    8 digits – 42101000
    7 digits – 3211000
    6 digits – no solutions
    5 digits – 21200
    4 digits – 2020 & 1210
    3 digits – no solutions
    2 digits – no solutions
    1 digit – no solutions

    There’s a clear pattern for the numbers having 7, 8, 9 & 10 digits (as the number of zeroes between the two 1s gradually reduces. When those two 1s “collide”, the system fails. It’s fairly easy to see that the system will persist for any number of digits beyond 10. As an illustration, consider a 16 digit number using standard hexadecimal notation (0-9, A-F). This yields a valid solution of

    C210000000001000

    That is there are C (12) x 0s, 2 x 1s, 1 x 2 and 1 x C (12). It’s fairly easy to see that this pattern will go on forever. Every time you add another digit, the zero digit position increments by one as an extra 0 is inserted between the two 1s. The position 4th from the end will always, therefore, match the number in the number found in the 0 count position. I could probably turn this into a formal proof, but this will do.

    A more difficult problem would be to prove that there’s only one such solution (which I suspect is true, but can’t prove at the moment).

    • Mike Benton says:

      Good work on the extension, Steve. Although, the pattern can only continue for as long as you can create a numerical system (base) such that the left-most position of the answer is occupied by a single character; eg ‘C’ instead of ’12’ in your example.

      You already have to switch out of decimal notation once the answer being sought exceeds 13-digits. The programmer in you chose hexadecimal but this will only get you as far as a 19-digit answer. Sexatrigesimal (base 36) notation, which uses the standard 10 digits plus all of the 26 letters, will permit answers up to and including 39 digits.

      Of course, you can continue adding in more and more unique symbols – lower case letters, letters with accents and diacritics, Viking runes, Wingdings, etc, but I think the practicality of such a system rapidly approaches zero.

    • Steve Jones says:

      The number of symbols is, as you point out, effectively infinite as you can make them arbitrarily complex, so that’s merely an issue of practicability, not theory.

      I’m pretty sure this particular problem will have been done to death by number theorists. I suppose I could go looking for stuff online.

    • Steve Jones says:

      So that’s what they are called. Thanks.

    • Mike Benton says:

      Actually, we’ve been discussing autobiographical numbers. Self-descriptive numbers must have the same number of digits as their base, whereas autobiographical numbers may have fewer.

      In case further clarity is required, 42101000 in base 8 is self-descriptive whereas in base 10 or higher it is merely autobiographical.

    • Steve Jones says:

      It’s a bit of a moot point to be honest. There’s nothing that gives any clue about the base used (save that in base 16 of course). The examples I used could be deemed as the subset of autobiographical numbers that exactly match the self descriptive ones. There’s simply no way of telling the difference.

  12. Lazy T says:

    Quietly opening myself to the universe I know the solution to tomorrow’s Fri-Puz is
    17 fried eggs and 2 rubber bands.

    • Steve Jones says:

      You should know better than to post spoilers like that.

    • Barry Goddard says:

      @Steve Jones

      You seem unaware that @Lazy T has posted prior (ie before) to the puzzle being posted.

      As such it seems most likely that Mr T is attempting a joke. It may not be funny yet your response is completely devoid of humour. Your schoolmarmish waspishness makes you no favours in the otherwise relaxed atmosphere of this blog comment section.

      Loosen up. Lighten up. Enjoy your life. You do not need to be such a pedant as you paint yourself. Feel free to model yourself on my joi de vivre.

    • Steve Jones says:

      Thanks Mr. Goddard for the character reference. However, if you care to look at the timestamp of my response that too appeared long before Richard posted his question and is clearly in a similar light-hearted form.

      I’ve no idea why you choose to intercede on what was clearly jokey response to an amusing posting, but you’ve clearly gone beyond mere delusional idiocy into something approaching the malevolent.

      But as I see (from elsewhere) that you don’t believe in an objective reality, I suppose you can satisfy yourself with your own particular interpretation of time and causality.

    • Slange Navarr says:

      @Barry Goddard. The irony is that Jones attempts to bully people into accepting his higher learning and then gets half of his post wrong anyway, in one way or another. Unless he happens to be about fourteen years of age, this is a disgraceful way for a man to behave, even a wee man.

  13. Eddie says:

    Friday puzzle? – job done.

  14. Html says:

    Does this work?

  15. Html says:

    Hoorah. It did! Thanks, Richard.

  16. Html says:

    One more for luck:

    Here
    We
    Go

  17. Html says:

    Ah, need more practice with that one.

  18. Binu says:

    6120001000

  19. Anonymous says:

    7110000000

  20. Praveen says:

    7110000000

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s