Let's define 'Magical Number' !
A Magical Number P is a decimal number consisting of 2n digits with the properties that
(I) No digit of P is 0 (Zero);
(II) Sum of the digits of P is equal to A and
(III) Product of the digits of P equals B,
whereand n is a natural number.
For example, for P=1236 with A=12 and B=36, Sum of Digits of P=1+2+3+6=12=A and Product of digits of P=1×2×3×6=36=B . Yeah, 1236 is a Magical Number.
You have to find out the number of Magical numbers greater than 1236 and less than 1 Billion.