← RoseCode

ROSECODE 532

The number of pandigital number

C_K_Yang · Math ·

In mathematics, a pandigital number is an integer that in a given base B has each digit {0,1,2,3,...,B-1} at least once.

Given two positive integers B and L, let C(B,L) be the number of all the L-digit pandigital numbers in base B. For example, C(3,3)=4, there are only four 3-digit pandigital numbers in base 3, namely (102)3, (120)3, (201)3, and (210)3

Now we define a new function D(B,N)=L=1NC(B,L)

You are given D(5,10)=4865472 and D(123,321)mod1000000007=844902472

Find D(12345678,87654321)mod1000000007

Note: leading zeroes are not allowed.