Shil and weird equation (Optional)
Practice
3.9 (134 votes)
Medium
Problem
37% Success 75 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Shil came across a weird equation and he wants to find out total number of solutions of this equation.The weird equation is :
x1+ x2 + x3 ... xN = D .
Find total number of solutions of this equation such that each xi are non-negative and gcd of all the xi is one.Here gcd stands for greatest common divisor.
Assume that gcd(0,y) = y for any y.

Input:
Only line of input consists of two integers N and D .

Output:
Output total number of solutions modulus 109+7

Constraint:
1 ≤ N ≤ 104
1 ≤ D ≤ 104

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:50
18 votes
Tags:
Dynamic ProgrammingMedium-Hard
Points:10
83 votes
Tags:
Basic ProgrammingBasics of ImplementationEasyImplementation
Points:20
12 votes
Tags:
ApprovedBasic ProgrammingBrute-force searchEasyGreedy AlgorithmsOpenSorting