← RoseCode

ROSECODE 533

The sum 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 S(B,L) denote the sum of all the L-digit pandigital numbers in base B. For example, S(3,3)=66, the sum of four 3-digit pandigital numbers in base 3 is 66 since (102)3+(120)3+(201)3+(210)3=(2110)3=(66)10

Now we define a new function H(B,N)=L=1NS(B,L)

You are given H(5,10)=24678960400080 and H(123,321)mod1000000007=372652728

Find H(12345678,87654321)mod1000000007

Note: leading zeroes are not allowed.