A number is called pandigital if it uses all of the digits from 1 to n exactly once, where n is the number of digits in the number. So, for example, the five-digit number 15432 is pandigital, but the five-digit number 11132 is not. Again, the four-digit number 4123 is pandigital, but the four-digit number 8312 is not. Finally, the one-digit number 1 is pandigital, but the one-digit number 3 is not. The next few exercises about these numbers can be found under the "Pandigital" sprite in the starter file. For all of the blocks on this page, you should use higher-order functions in your solution. You cannot use explicit recursion or the yellow and orange loop constructs (such as repeat, repeat until, and for); you can, however, use the built-in list blocks in the Variables tab and the HOF blocks from "import tools." You will find the blocks that you created on the last page useful.
Create the block
that checks if a number satisfies the definition above. The block should, for example,
report true
for:
and false
for:
Using the block you created above, create the block
that lists all the pandigital numbers between the first and second inputs, inclusive. For example,
should report
It might be nice to have our sprite say the list we calculated above (or any list, really). Use HOFs to create the block
that, when given the input
reports the string "1, 12, 21, 123, 132". We can then place this block in a say
block.