Problem Statement
定义“稀疏阶乘函数” F(x)= (x-0^2)*(x-1^2)*...*(x-k^2),其中k=sqrt(x-1),
求在[lo, hi]中有多少个正整数 x 满足 F(x) 是 m 的倍数。
数据范围:1 <= lo <= hi <= 10^12, 2 <= m <= 10^6
For an integer n, let F(n) = (n - 0^2) * (n - 1^2) * (n - 2^2) * (n - 3^2) * ... * (n - k^2), where k is the largest integer such that n - k^2 > 0.
You are given three longs lo, hi and divisor.
Compute and return the number of integers n between lo and hi, inclusive, such that F(n) is divisible by divisor.
- F(4) = 4*3 = 12
- F(5) = 5*4*1 = 20
- F(6) = 6*5*2 = 60
- F(7) = 7*6*3 = 126
- F(8) = 8*7*4 = 224
Thus, F(4), F(6), F(7) are divisible by 6 but F(5) and F(8) are not.