{"id":6085,"date":"2023-11-01T00:01:54","date_gmt":"2023-11-01T07:01:54","guid":{"rendered":"https:\/\/c-for-dummies.com\/blog\/?p=6085"},"modified":"2023-11-08T18:10:37","modified_gmt":"2023-11-09T02:10:37","slug":"numbers-with-unique-digits","status":"publish","type":"post","link":"https:\/\/c-for-dummies.com\/blog\/?p=6085","title":{"rendered":"Numbers with Unique Digits"},"content":{"rendered":"<h2>Difficulty: &#9733; &#9733; &#9733; &#9734;<\/h2>\n<p>I&#8217;m sure some eccentric term exists to describe a number where no digits repeat. Whether this concept has any mathematical relevance remains uncertain. But it&#8217;s the type of problem you can easily solve by writing a computer program.<br \/>\n<!--more--><br \/>\nUnique digit values would be numbers such as 456 or 1089637. None of the digits repeat. The value 1066, however, has repeating digits (two sixes), so it doesn&#8217;t count.<\/p>\n<p>Obviously, these unique digit numbers can be only so large. Values ten digits wide must have repeating digits. In fact, I would guess that 9,876,543,210 is the highest unique digit value possible in base 10.<\/p>\n<p>For this month&#8217;s Exercise, your task is to write code that outputs all values with unique digits in the range of zero through 10,000,000,000 (ten billion). Output all the unique values along with a tally of how many the program found. Yes, with all this output, the program takes several minutes to run. In fact, you may see it pause as values are scanned.<\/p>\n<p>Here&#8217;s the last few lines from my solution:<\/p>\n<p><code>9876543012<br \/>\n9876543021<br \/>\n9876543102<br \/>\n9876543120<br \/>\n9876543201<br \/>\n9876543210<br \/>\n8877691 unique values<\/code><\/p>\n<p>This challenge earns three stars because multiple methods exist to scan the digits. I know which one I use, but I&#8217;m certain other methods are available. Searching this topic on the Interwebs shows similar challenges in other programming languages. Don&#8217;t cheat!<\/p>\n<p>Try this challenge on your own. I&#8217;m eager to see what you come up with. You can compare your solution with <a href=\"https:\/\/c-for-dummies.com\/blog\/?p=6093\">mine<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Scan a range of values to report those numbers lacking any repeating digits. <a href=\"https:\/\/c-for-dummies.com\/blog\/?p=6085\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-6085","post","type-post","status-publish","format-standard","hentry","category-exercise"],"_links":{"self":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6085","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6085"}],"version-history":[{"count":5,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6085\/revisions"}],"predecessor-version":[{"id":6110,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6085\/revisions\/6110"}],"wp:attachment":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6085"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6085"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6085"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}