Favorite Array
InterviewTime limit2sMemory limit512 MB
Count length-N arrays with entries from 1 to K where no earlier element is a larger multiple of the next.
- Level
Medium6 of 10
- Topics
- Dynamic programming, Combinatorics, Math
- Solved
- No attempts yet
Problem
Seonggwan likes an array that satisfies all of the following.
- The array has length .
- Every element of the array is an integer between and , inclusive.
- For any two neighboring elements, with first and second, either or holds.
In other words, the only forbidden pair is one where the earlier element is larger than the later element and is divisible by it.
For and , the array is one Seonggwan likes. Its three neighboring pairs satisfy , , and .
Given and , write a program that counts the arrays Seonggwan likes.
Input
The first line contains and , separated by a space. (, )
Output
Print on the first line the number of arrays Seonggwan likes, modulo 1,000,000,007.