MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

After Problem 2319.

An n-digit number is pandigital if it makes use of all the digits 1 to n exactly ONCE.

For example, the 5-digit number 15234, is 1 through 5 pandigital.

Find the number of pandigital numbers in a given interval (between xlower and xupper).

The test suite is simple here, but how to compute this number with BIG interval (pandigital number length > 7) in Cody time?

For example, between 58755 and 99899923?

16 correct solutions
6 incorrect solutions

Last solution submitted on Dec 10, 2014

1 player likes this problem

1 player likes this solution

1 Comment

Jean-Marie SAINTHILLIER
on 15 May 2014

Everything is perfect in this code.

3 Comments

Alfonso Nieto-Castanon
on 15 May 2014

this is not really a general solution, perhaps you could add more complicated cases in the testsuite? for example pandigital_nb(2200,4000)==10, pandigital_nb(250,40000)==98, pandigital_nb(35327,43854637)==23030

Jean-Marie SAINTHILLIER
on 15 May 2014

I hesitated to add tests that I can't solve by myself.

Alfonso Nieto-Castanon
on 15 May 2014

I see, check solution 443089, that should be a general and relatively fast solution

1 Comment