Under construction

Still being built. Things may change

Square-Free Pairs

Interview

Time limit1sMemory limit1024 MB

Summary
Count pairs a < b in the range [l, r] where a, b, and their product ab are all square-free, with r - l at most 1000.
Level

Medium4 of 10

Topics
Number theory, Math, Brute force
Solved
No attempts yet

Problem

A integer xx is called square-free if there is no integer y>1y > 1 such that xx is divisible by y2y^2, that is, there is no integer zz with x=y2zx = y^2z.

You are given integers ll and rr. Count the pairs of integers (a,b)(a, b) with l≤a<b≤rl \le a < b \le r such that aa, bb, and their product abab are all square-free.

Input

The input consists of two lines. The first line contains the integer ll, and the second line contains the integer rr (1≤l<r≤1091 \le l < r \le 10^9, r−l≤1000r - l \le 1000).

Output

Print one integer, the number of pairs that satisfy the conditions.

Hint

The pairs a=3a = 3, b=5b = 5 and a=5a = 5, b=6b = 6 qualify. The number 44 cannot be part of any pair, since 4=22⋅14 = 2^2\cdot 1. The pair a=3a = 3, b=6b = 6 does not qualify, since ab=3⋅6=18=32⋅2ab = 3\cdot 6 = 18 = 3^2\cdot 2.

Examples1

  1. Example 1

    Input
    3
    6
    
    Expected output
    2