[Solution] Ela’s Fitness and the Luxury Number solution codeforces

Ela’s Fitness and the Luxury Number solution codeforces – While working at DTL, Ela is very aware of her physical and mental health. She started to practice various sports, such as Archery, Yoga, and Football.

Table of Contents

[Solution] Ela’s Fitness and the Luxury Number solution codeforces

Since she started engaging in sports activities, Ela switches to trying a new sport on days she considers being “Luxury” days. She counts the days since she started these activities, in which the day she starts is numbered as day 11. A “Luxury” day is the day in which the number of this day is a luxurious number.

An integer 𝑥x is called a luxurious number if it is divisible by 𝑥‾‾√⌊x⌋.

Here 𝑟⌊r⌋ denotes the “floor” of a real number 𝑟r. In other words, it’s the largest integer not greater than 𝑟r.

For example: 885656100100 are luxurious numbers, since 88 is divisible by 8‾√=2.8284=2⌊8⌋=⌊2.8284⌋=25656 is divisible 56‾‾‾√=7.4833=7⌊56⌋=⌊7.4833⌋=7, and 100100 is divisible by 100‾‾‾‾√=10=10⌊100⌋=⌊10⌋=10, respectively. On the other hand 554040 are not, since 55 are not divisible by 5‾√=2.2361=2⌊5⌋=⌊2.2361⌋=2, and 4040 are not divisible by 40‾‾‾√=6.3246=6⌊40⌋=⌊6.3246⌋=6.

Being a friend of Ela, you want to engage in these fitness activities with her to keep her and yourself accompanied (and have fun together, of course). Between day 𝑙l and day 𝑟r, you want to know how many times she changes the activities.

[Solution] Ela’s Fitness and the Luxury Number solution codeforces

Each test contains multiple test cases. The first line has the number of test cases 𝑡t (1𝑡10 0001≤t≤10 000). The description of the test cases follows.

The only line of each test case contains two integers 𝑙l and 𝑟r (1𝑙𝑟10181≤l≤r≤1018) — the intervals at which you want to know how many times Ela changes her sports.

Output

For each test case, output an integer that denotes the answer.

Example

input

Copy
5
8 19
8 20
119 121
1 100000000000000000
1234567891011 1000000000000000000

output

[Solution] Ela’s Fitness and the Luxury Number solution codeforces

5
6
2
948683296
2996666667
Note

In the first test case, 55 luxury numbers in range [8,19][8,19] are: 8,9,12,15,168,9,12,15,16.

For Solution

“Click Here”

Leave a Comment