Problem 2721. Pandigital Factors (Based on Euler 491)

A Pandigital Number is a number containing all of the digits from 0-9 inclusive, with the added stipulation that it does not have a leading zero. Lower level pandigital numbers just contain the digits 0-X, where X is less than 9.

Write a MATLAB script that takes as input the number X, and another integer Y. Determine how many pandigital numbers containing the digits 0-X are evenly divisible by Y. For example, there are thirteen pandigital numbers containing 0-4 that are evenly divisible by 7:

       43120
       42301
       41230
       32410
       31402
       31024
       30142
       23401
       24031
       20314
       14203
       10234
       10423

The number 03421 does not count. Even though it contains all of the digits 0-4, it has a leading zero. Therefore, the output of pandigit_factors(4,7) would be 13. You do not need to output all of the numbers themselves, just how many of them there are. Good luck!

Solution Stats

63.24% Correct | 36.76% Incorrect
Last Solution submitted on Nov 09, 2022

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers34

Suggested Problems

More from this Author80

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!