finding-numbers

Alice has just learnt multiplying two integers. He wants to multiply two integers X and Y to form a number Z. To make the problem interesting he will choose X in the range [1,M] and Y in the range [1,N]. Help him to find the number of ways in which he can do this.

Input
First line of the input is the number of test cases T. It is followed by T lines. Each line has three space separated integers, the numbers Z, M and N.

Output 
For each test case output a single integer, the number of ways.

Constraints
1 ≤ T ≤ 50 
1 ≤ Z ≤ 10^12
1 ≤ M ≤ 10^12
1 ≤ N ≤ 10^12

SAMPLE INPUT
4
4 7 9
5 2 10
5 5 6
2 8 1

SAMPLE OUTPUT
3
1
2
1

Source: hackerearth | Difficulty: MEDIUM


Solutions:
for p in range(int(input())):
	z,m,n=list(map(int,input().split()))
	l=[]
	for i in range(1,int(z**.5)+1):
		if z%i==0:
			if(i!=z/i):
				l.append(i)
				l.append(z/i)
			else:
				l.append(i)
	if m<n:
		min1=m
		max1=n
	else:
		min1=n
		max1=m
	count=0
	for i in l:
		if i<=min1:
			if (z/i) <=max1:
				count=count+1
	print(count)


import math
t=int(input())
if t>=1 and t<=50:
	while t>0:
		(z,m,n)=input().split()
		z=int(z)
		m=int(m)
		n=int(n)
		count=0
		fact={}
		z_sqrt = int(math.sqrt(z))+1
		#print z_sqrt
		for i in range(1,z_sqrt):
			#print i
			if z%i == 0:
				fact[i] = z // i
		#print fact
		for i in fact:
			if i<=m and fact[i]<=n:
				count+=1
			if i<=n and fact[i]<=m and i!=fact[i]:
				count+=1
		print(count)
		t-=1


import sys
import math

def countpairs(factors, z, m, n, x):
	if len(factors) == 0:
		if (z/x <= n):
			#print(x, z/x)
			return 1
		else:
			return 0
	factor, count = factors.pop()

	num = 0
	for i in range(count + 1):
		if x <= m:
			#print('countpairs', factors, z, m, n, x)
			num += countpairs(factors, z, m, n, x)
		else:
			break
		x = x * factor

	factors.append((factor, count))
	return num

n = int(sys.stdin.readline())
for _ in range(n):
	z, m, n = [int(x) for x in sys.stdin.readline().split()]

	res = 0

	lim = min(int(math.sqrt(z)), max(m, n))
	z1 = z 
	factors = []
	i = 2
	while(i <= lim and z > 1):
		count = 0
		while z % i == 0:
			count += 1
			z = int(z/i)
		if count:
			factors.append((i, count))
		if i == 2:
			  i += 1
		else:
			  i += 2
	if z > 1:
		factors.append((z, 1))
	#print(factors)
	#print('countpairs', factors, z1, m, n, 1)
	res += countpairs(factors, z1, m, n, 1)
	print(res)
	
		  


import math
t=eval(input())
while t>0:
	z,m,n=list(map(int,input().split()))
	y=int(math.sqrt(z))
	cnt=0
	for i in range(1,y+1):
		if z%i==0:
			x=z/i
			if x<=m and x<=n and x!=i:
				cnt+=2
			elif x<=m and x<=n and x==i:
				cnt+=1
			if x<=m and x>n:
				cnt+=1
			elif x>m and x<=n:
				cnt+=1
	print(cnt)
	t-=1

			
			


tc = int(input())
for test in range(tc):
	res =0
	z,m,n = [ int(x) for x in input().split() ]
	for elem1 in range(1,int(z**0.5)+1):
		#print "elem 1 --->",elem1
		if z%elem1 == 0:
			if elem1 == z/elem1 and ((1<= elem1 <= m and 1<= z/elem1 <= n) or ( 1<= elem1 <= n and 1<= z/elem1 <= m)):
				#print "Same"
				res = res +1 
			else:
				if 1<= elem1 <= m and 1<= z/elem1 <= n:
					#print "Check 1"
					res = res +1
				if 1<= elem1 <= n and 1<= z/elem1 <= m:
					#print "Check 2"
					res = res +1
	print(res)