F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Dertouzos

Time Limit: 7000/3500 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 4954    Accepted Submission(s): 1428


Problem Description
A positive proper divisor is a positive divisor of a number $n$, excluding $n$ itself. For example, 1, 2, and 3 are positive proper divisors of 6, but 6 itself is not.

Peter has two positive integers $n$ and $d$. He would like to know the number of integers below $n$ whose maximum positive proper divisor is $d$.
 

Input
There are multiple test cases. The first line of input contains an integer $T$ $(1 \le T \le 10^6)$, indicating the number of test cases. For each test case:

The first line contains two integers $n$ and $d$ $(2 \le n, d \le 10^9)$.
 

Output
For each test case, output an integer denoting the answer.
 

Sample Input
9 10 2 10 3 10 4 10 5 10 6 10 7 10 8 10 9 100 13
 

Sample Output
1 2 1 0 0 0 0 0 4
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-18 21:49:57, Gzip enabled