Grand Prix of Array Count
Time limit1sMemory limit2048 MB
Count arrays of length n with values from 1 to k where a[(i+j)/2] equals gcd(a[i], a[j]) for every pair with i+j even, modulo 1e9+7.
- Level
Hard9 of 10
- Topics
- Math, Number theory, Combinatorics
- Solved
- No attempts yet
Problem
An array of length is called funny if, for every pair of indices where , the following condition holds: if is an even number, then . For example, the array is funny.
You are given two positive integers and . Find the number of funny arrays of length whose elements are integers between and . Since this number can be very large, print it modulo .
Input
The only line contains two integers and (, ).
Output
Print a single number: the answer to the problem modulo .
Hint
In the first sample, there are funny arrays: , , , .