P20515 [HackerEarth] As we all know cultural fest of IIT-Delhi is one of the biggest youth festival of north india and this year too it was very special as there was live performance
普及
题目描述

As we all know cultural fest of IIT-Delhi is one of the biggest youth festival of north india and this year too it was very special as there was live performance
by Arjit Singh.Now as he is very famous star in india so there was a estimation of huge crowd and campus of IIT-Delhi may fail to handle such a crowd.
So,fest-management team of IIT-Delhi devised a solution by introducing tickets system.But this method failed due to huge demand of tickets suppose there were
n tickets(numbered 1 to n) that were sold out to watch Arjit Singh.So,in order to avoid mis-management due to huge crowd they re-invented a method that they will allow people to enter the arena in pairs.A pair will be selected such as the prime factorizaion of ticket number x and ticket number y has some fators in common
and the product of common factor of x and y be M.Now a single ticket number x can be selected in multiple pair.They are interested in only knowing number of
possible pair of enter the arena.They ask for you help as they are very busy in managing other activities of fest.

Your are given a number N denoting number of tickets sold out with each ticket having a distinct number from 1 to n.They also gives you an integer M denoting the product of common factors of any two ticket numbers and ask for how many pairs have such property.

NOTE:-A particular ticket can be selected in multiple pairs.A number can be selected with him also so (x,x) is a valid pair.
A pair (x,y) is formed iff and only if x ≥ y.

Input Format:-

First line will contain an integer t denoting the number of test cases.
Each of next t lines contains two space integers N and M having usual meaning as described in question.

Output Format:-

For each test case output a single integer denoting the number of possible pair with common factor product as M.

**Constraints:-
1<t ≤ 100

1 ≤ N,M ≤ 1000000**

SAMPLE INPUT
3
10 2
40 4
20 3

SAMPLE OUTPUT
10
32
12

Explanation

Test Case#1:-

ticket are numbered as 1,2,3,4,5,6,7,8,9,10 and we asked to give number of pair with product of common factors as 2.The number of pairs are 10 since there are pairs which are

(2,2),(2,4),(2,6),(2,8),(2,10),(4,6),(4,10),(6,8),(6,10),(8,10)

输入格式

见题面

输出格式

见题面

样例输入
71 100000 3 999999 9933 999996 10000 999991 9976 999992 9942 999998 9936 999995 9955 999999 9973 999999 9909 999995 9958 999993 9964 999999 9996 999998 9947 999998 9918 999999 9984 999992 9905 999993 9974 999999 9962 999991 9988 999993 9901 999995 9906 999997 9989 999998 9967 999997 9936 999999 9989 999997 9932 999993 9956 999998 9943 999993 9941 999997 9959 999991 9922 999994 9965 1000000 9958 999992 9994 1000000 9958 999996 9952 999994 9995 1000000 9971 1000000 9950 999994 9999 999997 9952 999991 9977 999996 9946 999994 9960 999994 9924 999999 9992 999996 9961 999994 9977 999993 9962 999992 9918 999991 9959 999997 9985 999991 9942 999996 9970 999993 9994 999997 9914 999999 9955 999996 9928 1000000 9971 999993 9927 999993 9988 999994 9910 999999 9964 999995 9933 999995 9926 999999 9948 1000000 9950 999999 9976 999994 9970 999993 9909 999993 9963
样例输出
759924264 28 32 28 28 32 32 32 32 32 32