I didn’t understand the question and given test case eg when input is
3
1 1 1
N will be 235=30
product of divisor of 30 is
123561015*30=810,000
now we need to find number of divisors of 810000 , is it correct?
can you give some hint or method ?
Thank You.
💡 Playing With Divisors Is Fun
Yeah you are right you need to find the number of factors of 810000
which is 125
. As the number of factors may be large for many numbers you’ll need to mod
it by 10^9 + 7
.
Hint :
- Make the number
P
using numberN
in form of an array. - Use PnC to find number of divisors of
P
.
Example :
- Say
N = 30
2 3 5
1 1 1
- Now
P = 1 * 2 * ....... * 30 = 810000
You need to understand that divisors ofN
are combinations of2, 3 & 5
.
To make the array ofP
. You need to count the number of times2, 3 & 5
will be picked in the divisors ofN
.
As all the numbers are there only1
time. there are8
combinations of2, 3 & 5
(000 001 010 011 100 101 110 111)
where0
means not picked and1
means picked. We can see there are8
divisors of30
.
Using this we can make the array forP
.
P = 810000
2 3 5
4 4 4
Now finding the number of divisors ofP
is easy.
000 001 002 003 004 010 011 012 013 014 ........... 442 443 444
these will be all the divisors ofP
wherexyz
means picking x of2
,y
of3
andz
of5
.
You can clearly see this is just abase 5
counting with3
bits. so there will be5^3
numbers b/w000 .... 444
which is125
.
I hope this helps you.
I am only considering 2 3 5 because 810000 is a number made by multiples of divisors of a number which has factor as 2^1 3^1 and 5^1. There are no other prime factors of 810000. They wouldn’t exist as 810000 is a number made by multiplying numbers containing 2, 3 and 5. And no other prime number can be made by multiplication of other two prime numbers as that is against the defination of prime numbers.
So 810000 will also have these prime factors with higher powers 2^x 3^y and 5^z
and I have told you the way to find out xyz
in the post. They all came out to be 4
i.e. x = y = z = 4
. and then we find out number of possible divisors of 810000
by using PnC.
As now you know you have four 2s, four 3s and four 5s
. So I know I can pick zero of 2s ....upto.... four of 2s
. Similarly for 3s
and 5s
. So that is basically going from 000........to..........444
that means 2^0 * 3 ^0 * 5^0 .........to......... 2^4 * 3 ^4 * 5^4
i.e. 1......to.....810000
which mean b/w these we count all the divisors of 810000
.
So using PnC we know we have 5 choices (0 - 4) and 3 places (2, 3 and 5)
. So all possible divisors will be 5^3 (5 * 5 * 5 all the possible choices)
which is 125
.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.