Dreaming of Freedom
Because to take away a man's freedom of choice, even his freedom to make the wrong choice, is to manipulate him as though he were a puppet and not a person.— Madeleine L'EngleThere are $$$n$$$ programmers choosing their favorite algorithm amongst $$$m$$$ different choice options. Before the first round, all $$$m$$$ options are available. In each round, every programmer makes a vote for one of the remaining algorithms. After the round, only the algorithms with the maximum number of votes remain. The voting process ends when there is only one option left. Determine whether the voting process can continue indefinitely or no matter how people vote, they will eventually choose a single option after some finite amount of rounds?
In the first example, there are $$$8$$$ ways people could vote: $$$\{1|1|1, 1|1|2, 1|2|1, 1|2|2, 2|1|1, 2|1|2, 2|2|1, 2|2|2\}$$$.In cases $$$1$$$, $$$2$$$, $$$3$$$, and $$$5$$$, the programmers are left with the first algorithm, and in the remaining cases people are left with the second one, so the voting ends in one round in any case.In the second example, the programmers could always vote $$$1|1|2|2$$$. Both algorithms have the maximum number of votes and remain for the next round, so the voting never ends.
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^5$$$) — the number of test cases.Each test case consists of a single line containing two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^6$$$) — the number of people and choice options respectively.
For each test case output "YES" if the programmers will eventually choose a single option, and "NO" otherwise.You may print each letter in any case (for example, YES, Yes, yes, yEs will all be recognized as a positive answer).
import sys
import math
input = sys.stdin.buffer.readline
MAX_SIZE = 1000001
spf = [0 for i in range(MAX_SIZE)]

def sive():
    spf[1] = 1
    for i in range(2, MAX_SIZE):
        spf[i] = i
    for i in range(4, MAX_SIZE, 2):
        spf[i] = 2
    for i in range(3, math.ceil(math.sqrt(MAX_SIZE))):
        if spf[i] == i:
            for j in range(i * i, MAX_SIZE, i):
                if spf[j] == j:
                    spf[j] = i

def getSmallest(n):
    primes = list()
    while n != 1:
        primes.append(spf[n])
        n = n // spf[n]
    return primes[0]
sive()
t = int(input())
for _ in range(t):
    (n, m) = list(map(int, input().split()))
    if n == 1:
        print('yEs')
    elif m < getSmallest(n):
        print('yEs')
    else:
        print('nO')
import sys
input = sys.stdin.readline
min_div = [0] * 1000001
for i in range(2, 1001):
    if min_div[i] == 0:
        min_div[i] = i
        for j in range(i * i, 1000001, i):
            if min_div[j] == 0:
                min_div[j] = i
for i in range(1000001):
    if min_div[i] == 0:
        min_div[i] = i
for T in range(int(input())):
    (n, m) = map(int, input().split())
    print('YES' if n == 1 or min_div[n] > m else 'NO')
import sys
input = sys.stdin.readline
tol = 10 ** 6 + 5
p = [-1] * tol
for i in range(2, tol):
    if p[i] != -1:
        continue
    for j in range(i, tol, i):
        p[j] = i
p[1] = 1

def sol(n, m):
    if n == 1:
        return 'YES'
    if n <= m:
        return 'NO'
    s = set()
    while p[n] != n:
        s.add(p[n])
        n //= p[n]
    for i in s:
        if i <= m:
            return 'NO'
    if n > m:
        return 'YES'
    else:
        return 'NO'
t = int(input())
for case in range(t):
    (n, m) = list(map(int, input().split()))
    print(sol(n, m))