import sys
input = sys.stdin.readline

class Factorization():
    def __init__(self, N):
        self.L = list(range(N + 1))
        for i in range(2, N + 1):
            if i != self.L[i]:
                continue
            for j in range(2 * i, N + 1, i):
                self.L[j] = i

    def get(self, n):
        if n <= 1:
            return []
        D = []
        while n != 1:
            cnt = 0
            now = self.L[n]
            while n % now == 0:
                cnt += 1
                n //= now
            D.append((now, cnt))
        return D


Q = int(input())
mod = 998244353
n = 2 * 10 ** 6
fact = [1] * (n + 1)
invfact = [1] * (n + 1)
for i in range(1, n):
    fact[i + 1] = ((i+1) * fact[i]) % mod
invfact[n] = pow(fact[n], mod - 2, mod)
for i in range(n - 1, -1, -1):
    invfact[i] = invfact[i + 1] * (i + 1) % mod

def comb(n, r):
    if n < 0 or r < 0 or n - r < 0:
        return 0
    return fact[n] * invfact[r] * invfact[n - r] % mod

F = Factorization(10**5+5)
now = 0
for i in range(Q):
    a, b = map(int, input().split())
    for _, v in F.get(a):
        now += v
    print(comb(now - 1, b - 1))