Square-Free Pairs
InterviewTime limit1sMemory limit1024 MB
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 is called square-free if there is no integer such that is divisible by , that is, there is no integer with .
You are given integers and . Count the pairs of integers with such that , , and their product are all square-free.
Input
The input consists of two lines. The first line contains the integer , and the second line contains the integer (, ).
Output
Print one integer, the number of pairs that satisfy the conditions.
Hint
The pairs , and , qualify. The number cannot be part of any pair, since . The pair , does not qualify, since .