TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description

A pair of integers (a,b) is co-prime when the greatest common divisor of a and b is 1.

Let f(x, y) denote the number of co-prime integer pairs (a, b) in the range 1<=a<=x, 1<=b<=y.

Given x and y, please calculate f(x, y).

Input Format

The input file contains several test cases, each one of them in a separate line. Each test case is two integers x, y (1 <= x, y <= 1,000,000)

There will be at most 100 test cases.

Output Format

For each test case, print f(x, y).

Sample Input 1

3 4
4 5
10 10

Sample Output 1

9
15
63

Hints

Problem Source

Migrated from old NTUJ.

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 10000 65536 200