Offered 2 integers L and R, the job is to discover the count of the sets of a optimum size such that each component in the set is in between L and R (inclusive), and for any 2 components in the set among them is divisible by the other.
Examples:
Input: L = 3, R = 19
Output: 4
Description: There will be 4 possible sets– {3, 6, 12}, {3, 6, 18}, {3, 9, 18}, {4, 8, 16}Input: L = 4, R = 8
Output: 1
Method: This can be resolved with the following concept:
 Let {S_{ 1}, S_{ 2}, S_{ 3}.. S_{ mx}} be a set of optimum sizes pleasing the offered conditions. Let M_{ i} = S_{ i +1}/ S_{ i.}_{ }
 It is instinctive that for S_{ mx} to be the minimum we require to pick S_{ 1} and M_{ i} for all i as low as possible, the minimum worth of S_{ 1} can be L and the minimum worth of M_{ i} can be 2
 Nevertheless, we can pick among the M_{ i} to be 3 so that S_{ mx} will be ( 3/2) times the preliminary worth of S_{ mx} (which must be less than R), if we pick any worth of M_{ i} to be more than 3, the size of the set would not be optimal as there can constantly be a brandnew component S_{ mx +1}= 2 * S_{ mx} such size of the set would end up being mx +1.
Follow the listed below actions to execute the concept:
 Very first compute the worth of mx, i.e the optimum possible size of the set. This can be determined presuming all the worths of M_{ i} are 2, and the worth of S_{ 1} is L, then mx = flooring( log2( r/l)) + 1
 Determine the optimum worth of S_{ 1} such that a set of size mx pleasing the offered conditions is possible. Let’s call it X, We understand 2^{ mx1} * X â¤ R, then X = R/2^{ mx1}
 Determine the optimum worth of S_{ 1} such that a set of size mx pleasing the offered conditions is possible and among the worths of M_{ i} can be 3 rather of 2, let us call it Y We understand that 3 * 2^{ mx2} * Y â¤ R, then Y = R/( 3 * 2^{ mx2})
 We understand L â¤ Y â¤ X â¤ R, a variety of sets with S_{ 1} â¤ Y are ( YL +1) * mx, note that we increased by mx as any of the M_{ i} in these sets can be 3. A variety of sets with S_{ 1}>> Y and S_{ 1 } â¤ X is X– Y.
 Overall sets of optimum size = ( YL +1) * mx + XY.
Below is the application of the above method:
C++

Time Intricacy: O( 1 )
Auxilairy Area: O( 1 )