YouKn0wWho has an integer sequence $a_1, a_2, \ldots, a_n$. He will perform the following operation until the sequence becomes empty: select an index $i$ such that $1 \le i \le |a|$ and $a_i$ is not divisible by $(i + 1)$, and erase this element from the sequence. Here $|a|$ is the length of sequence $a$ at the moment of operation. Note that the sequence $a$ changes and the next operation is performed on this changed sequence.

For example, if $a=[3,5,4,5]$, then he can select $i = 2$, because $a_2 = 5$ is not divisible by $i+1 = 3$. After this operation the sequence is $[3,4,5]$.

Help YouKn0wWho determine if it is possible to erase the whole sequence using the aforementioned operation.


-----Input-----

The first line contains a single integer $t$ ($1 \le t \le 10000$)  — the number of test cases.

The first line of each test case contains a single integer $n$ ($1 \le n \le 10^5$).

The second line of each test case contains $n$ integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 10^9$).

It is guaranteed that the sum of $n$ over all test cases doesn't exceed $3 \cdot 10^5$.


-----Output-----

For each test case, print "YES" (without quotes) if it is possible to erase the whole sequence using the aforementioned operation, print "NO" (without quotes) otherwise. You can print each letter in any register (upper or lower).


-----Examples-----

Input
5
3
1 2 3
1
2
2
7 7
10
384836991 191890310 576823355 782177068 404011431 818008580 954291757 160449218 155374934 840594328
8
6 69 696 69696 696969 6969696 69696969 696969696
Output
YES
NO
YES
YES
NO


-----Note-----

In the first test case, YouKn0wWho can perform the following operations (the erased elements are underlined): $[1, \underline{2}, 3] \rightarrow [\underline{1}, 3] \rightarrow [\underline{3}] \rightarrow [\,].$

In the second test case, it is impossible to erase the sequence as $i$ can only be $1$, and when $i=1$, $a_1 = 2$ is divisible by $i + 1 = 2$.

Source: codeforces | Difficulty: EASY
Tags: Number theory

Mathematics

Constructive algorithms


Solutions:
from math import gcd

def readline():
	return map(int, input().split())

def lcm(a, b):
	return a * b // gcd(a, b)
x = 1
d = []
i = 2
while x <= 10 ** 9:
	x = lcm(x, i)
	d.append(x)
	i += 1
assert d[-1] > 10 ** 9

def solve():
	(n,) = readline()
	a = readline()
	return all((ai % di for (ai, di) in zip(a, d)))
t = int(input())
for __ in range(t):
	print('YES' if solve() else 'NO')


from math import gcd
a = []
for _ in range(int(input())):
	n = int(input())
	lcm = 1
	for (i, x) in enumerate(map(int, input().split()), 2):
		if lcm != -1:
			lcm = lcm * i // gcd(lcm, i)
			if lcm > int(1000000000.0):
				lcm = -1
		if lcm != -1 and x % lcm == 0:
			a.append('NO')
			break
	else:
		a.append('YES')
print(*a, sep='\n')


def compute_gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def compute_lcm(x, y):
	lcm = x * y // compute_gcd(x, y)
	return lcm
lcms = []
lcm_to_this_moment = 1
for i in range(1, 22):
	lcm_to_this_moment = compute_lcm(lcm_to_this_moment, i + 1)
	lcms.append(lcm_to_this_moment)
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	flag = 1
	for (i, j) in zip(a, lcms[:n]):
		if i % j == 0:
			print('NO')
			flag = 0
			break
	if flag:
		print('YES')


from math import gcd
import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	n = int(input())
	data = list(map(int, input().split()))
	accum = 1
	flg = True
	for (i, t) in enumerate(data):
		accum = accum // gcd(i + 2, accum) * (i + 2)
		if accum > int(1000000000.0):
			break
		if t % accum == 0:
			flg = False
			break
	if flg:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
import math

def gcd(a, b):
	return math.gcd(a, b)
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	x = 1
	xx = 0
	for i in range(n):
		g = gcd(x, i + 2)
		x *= i + 2
		x //= g
		if x > 1000000000:
			xx = 1
			break
		if a[i] % x == 0:
			xx = 2
			break
	if xx == 2:
		print('NO')
	else:
		print('YES')


from math import gcd
from sys import stdin
from collections import Counter, deque
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	m = 1
	key = 0
	for i in range(n):
		m = m * (i + 2) // gcd(m, i + 2)
		if m > 1000000000:
			break
		if a[i] % m == 0:
			key = 1
			break
	if key == 0:
		print('YES')
	else:
		print('NO')


from cmath import sqrt
import math
from collections import defaultdict, deque, Counter
from functools import reduce
from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	k = 0
	d = 2
	for i in range(n):
		d = d * (i + 2) // math.gcd(d, i + 2)
		if d > 1000000000:
			break
		if a[i] % d == 0:
			k = 1
			break
	if k == 1:
		print('NO')
	else:
		print('YES')


import bisect
import os, sys, math
from io import BytesIO, IOBase
from collections import defaultdict, deque
ip = lambda : input()
it = lambda : int(input())
ma = lambda : map(int, input().split())
li = lambda : list(map(int, input().split()))
MOD = 10 ** 9 + 7
MD = 998244353
mod = 100007
MIL = 1000000
Inf = float('inf')
ye = 'YES'
ne = 'NO'

def lcm(a, b):
	return a * b // math.gcd(a, b)
arr = [-1]
l = 1
for i in range(2, 23):
	z = lcm(l, i)
	arr.append(z)
	l = z
for _ in range(it()):
	n = it()
	a = li()
	ans = ye
	k = min(n, 21)
	for i in range(1, k + 1):
		if a[i - 1] % arr[i] == 0:
			ans = ne
			break
	print(ans)


from math import gcd
inf = 10 ** 9
ans = []
for _ in range(int(input())):
	n = int(input())
	nums = [int(_) for _ in input().split()]
	x = 1
	for (i, j) in enumerate(nums):
		x = x * (i + 2) // gcd(x, i + 2) if x < inf else x
		if j >= x and j % x == 0:
			ans.append('NO')
			break
	else:
		ans.append('YES')
print('\n'.join(ans))


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	for i in range(min(25, n)):
		c = True
		for j in range(i + 2, 1, -1):
			if a[i] % j:
				c = False
				break
		if c:
			return 'NO'
	return 'YES'
for i in range(int(input())):
	print(solve())


def divis(el, ind):
	while ind > 1:
		if el % ind != 0:
			return ind
		ind -= 1
	return -1

def do(arr):
	if arr[0] % 2 == 0:
		return 'NO'
	now = 1
	for i in range(1, len(arr)):
		ni = divis(arr[i], i + 2)
		if ni == -1:
			return 'NO'
		if i - (ni - 2) > now:
			return 'NO'
		now += 1
	return 'YES'
for i in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	print(do(arr))


def divisible(n, a):
	if a[0] % 2 == 0:
		return 'NO'
	for j in range(n):
		delta = 2
		while True:
			i = j + delta
			if i <= 1:
				return 'NO'
			if a[j] % i != 0:
				break
			delta -= 1
	return 'YES'
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	print(divisible(n, a))


lcm = [2]
cur = 2
i = 2

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
while cur <= 10 ** 9:
	cur = lcm[i - 2]
	lcm.append(cur * (i + 1) // gcd(cur, i + 1))
	i += 1
t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split()))
	t -= 1
	f = 1
	for i in range(len(a)):
		if not a[i] % lcm[min(i, len(lcm) - 1)]:
			f = 0
			print('NO')
			break
	if f:
		print('YES')


import math
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	g = 2
	ans = True
	for i in range(n):
		if g > 10 ** 9:
			break
		if l[i] % g == 0:
			ans = False
			break
		else:
			g = g * (i + 3) // math.gcd(g, i + 3)
	if ans == True:
		print('YES')
	else:
		print('NO')


import math
for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	lcm = 1
	for i in range(min(n, 23)):
		lcm = lcm * (i + 2) // math.gcd(lcm, i + 2)
		if a[i] % lcm == 0:
			print('NO')
			break
	else:
		print('YES')


import sys
input = sys.stdin.readline

def solve():
	n = int(input())
	arr = list(map(int, input().split()))
	for i in range(n):
		f = True
		for j in range(i + 1):
			if arr[i] % (j + 2):
				f = False
				break
		if f:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	print(solve())


from math import gcd

def solve():
	l = int(input())
	div = 1
	arr = list(map(int, input().split()))
	for i in range(l):
		val = lcm(div, i + 2)
		if div < 10 ** 9:
			div = val
		if arr[i] % div == 0:
			return 'NO'
	return 'YES'

def lcm(a, b):
	return a * b // gcd(a, b)
n = int(input())
for i in range(n):
	print(solve())


def solve(arr):
	for i in range(len(arr)):
		can_remove = False
		for j in range(2, i + 3):
			if arr[i] % j != 0:
				can_remove = True
				break
		if not can_remove:
			return 'NO'
	return 'YES'
T = int(input())
for _ in range(T):
	n = int(input())
	arr = list(map(int, input().split()))
	print(solve(arr))


import math

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)
mx = 10 ** 9
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if a[0] % 2 == 0:
		print('NO')
		continue
	k = 2
	isit = True
	for i in range(1, n):
		k = lcm(k, i + 2)
		if k > mx:
			break
		if a[i] % k == 0:
			isit = False
			break
	print('YES' if isit else 'NO')


def int_input():
	a = int(input())
	return a

def int_list_input():
	a = list(map(int, input().split()))
	return a

def solve():
	n = int_input()
	arr = int_list_input()
	flag = True
	for i in range(n):
		t = True
		for j in range(i + 1):
			if arr[i] % (j + 2) != 0:
				t = False
				break
		if t:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')
for _ in range(int(input())):
	solve()


def solve(n, v):
	for i in range(min(25, len(v))):
		divisible = True
		for j in range(2, i + 3):
			if v[i] % j > 0:
				divisible = False
				break
		if divisible is True:
			print('NO')
			return
	print('YES')
for _ in range(int(input())):
	n = int(input())
	v = [int(x) for x in input().split()]
	solve(n, v)


import collections
from math import ceil, gcd, sqrt, log
INF = float('inf')
mod = 1000000007

def solve():
	n = int(input())
	A = list(map(int, input().split()))
	for i in range(n):
		flag = 0
		for j in range(i + 2, 1, -1):
			if A[i] % j != 0:
				flag = 1
				break
		if flag == 0:
			print('NO')
			return
	print('YES')
t = int(input())
while t != 0:
	solve()
	t -= 1


for _ in range(int(input())):
	n = int(input())
	array = list(map(int, input().split()))
	i = 2
	ans = 'YES'
	for item in array:
		if item % i != 0:
			i += 1
		else:
			j = i - 1
			while j >= 2 and item % j == 0:
				j -= 1
			if item % j == 0:
				ans = 'NO'
			i += 1
		if ans == 'NO':
			break
	print(ans)


t = int(input())
for e in range(t):
	n = int(input())
	c = 0
	l1 = list(map(int, input().split()))
	for i in range(min(len(l1), 21)):
		q = l1[i]
		chk = 0
		for i in range(2, i + 3):
			if q % i != 0:
				chk = 1
				break
		if chk == 1:
			continue
		else:
			c = 1
			break
	if c == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for t_i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	for i in range(min(29, n)):
		flag = True
		for j in range(2, i + 3):
			if a[i] % j != 0:
				flag = False
				break
		if flag == True:
			print('NO')
			break
	if flag == False:
		print('YES')


for test in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	flag = True
	for i in range(len(a)):
		for j in range(2, i + 3):
			if a[i] % j:
				break
		else:
			flag = False
			break
	print('YES') if flag else print('NO')


I = lambda : map(int, input().split())
for _ in [0] * int(input()):
	n = int(input())
	k = 1
	for i in I():
		for j in range(k + 1, 1, -1):
			if i % j != 0:
				ff = 1
				break
		else:
			ff = 0
			break
		k = k + 1
	print('YNEOS'[int(ff == 0)::2])


def gcd(a, b):
	while b != 0:
		(a, b) = (b, a % b)
	return a
t = int(input())
for w in range(t):
	n = int(input())
	N = list(map(int, input().split()))
	NumLcm = 2
	isGood = True
	for i in range(n):
		if NumLcm < 2 * 10 ** 9:
			NumLcm = NumLcm * (i + 2) // gcd(NumLcm, i + 2)
		if N[i] % NumLcm == 0:
			isGood = False
			break
	if isGood:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	v = [int(i) for i in input().split()]
	s = []
	for i in range(n):
		iss = True
		s.append(i + 2)
		for j in s:
			if v[i] % j != 0:
				iss = False
				break
		if iss:
			print('NO')
			break
	if not iss:
		print('YES')


for s in [*open(0)][2::2]:
	print('NYOE S'[all((any((x % j for j in range(2, min(24, i)))) for (i, x) in enumerate(map(int, s.split()), 3)))::2])


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	for i in range(n):
		for j in range(i + 2, 1, -1):
			if a[i] % j != 0:
				break
		else:
			print('NO')
			break
	else:
		print('YES')


import math
t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	lcm = 2
	flag = 1
	for i in range(n):
		k = i + 3
		if lcm > int(1000000000.0):
			break
		if l[i] % lcm == 0:
			flag = 0
		lcm = lcm * k // math.gcd(lcm, k)
	if flag == 0:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	lst = [int(item) for item in input().split()]
	grace = True
	for i in range(n):
		for j in range(2, i + 3):
			if lst[i] % j:
				break
		else:
			grace = False
			break
	print('YES' if grace else 'NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	flag = 1
	for j in range(n):
		index = 0
		for k in range(2, j + 3):
			if a[j] % k != 0:
				index = 1
				break
		if index == 0:
			flag = 0
			break
	if flag == 0:
		print('NO')
	else:
		print('YES')


from sys import stdin
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	arr = list(map(int, stdin.readline().split()))
	ans = 'YES'
	for i in range(n):
		if arr[i] % 2 == 0:
			f = 0
			for k in range(i + 2, 2, -1):
				if arr[i] % k != 0:
					f = 1
					break
			if f == 0:
				ans = 'NO'
				break
	print(ans)


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)

def divisibleConfusion(n, array):
	multiplier = 1
	for x in range(min(n, 24)):
		multiplier = lcm(multiplier, x + 2)
		if array[x] % multiplier == 0:
			return 'NO'
	return 'YES'
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	print(divisibleConfusion(n, l))


for i in range(int(input())):
	a = int(input())
	b = list(map(int, input().split()))
	for i in range(len(b)):
		for l in range(i + 2, 1, -1):
			if b[i] % l != 0:
				break
		else:
			print('NO')
			break
	else:
		print('YES')


for t in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	st = 2
	bool = True
	for i in range(n):
		bool = True
		for j in range(2, i + 3):
			if arr[i] % j != 0:
				bool = False
				break
		if bool:
			print('NO')
			break
	if not bool:
		print('YES')
		continue


for _ in range(int(input())):
	n = int(input())
	ans = 'YES'
	x = list(map(int, input().split()))
	for i in range(n):
		for j in range(2, i + 3):
			if x[i] % j > 0:
				break
		if j == i + 2 and x[i] % j == 0:
			ans = 'NO'
			break
	print(ans)


t = int(input())
ans = []
for _ in range(t):
	n = int(input())
	nums = [int(_) for _ in input().split()]
	for i in range(n):
		for j in range(i + 2, 1, -1):
			if nums[i] % j != 0:
				break
		else:
			ans.append('NO')
			break
	else:
		ans.append('YES')
print('\n'.join(ans))


import sys
input = sys.stdin.readline
t = int(input())
while t > 0:
	n = int(input())
	arr = [int(i) for i in input().split(' ')]
	ans = True
	for i in range(n):
		divall = True
		for j in range(2, i + 3):
			if arr[i] % j != 0:
				divall = False
				break
		if divall:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')
	t -= 1


def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a / gcd(a, b) * b

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		a = list(map(int, input().split(' ')))
		l = len(a)
		flag = True
		lc = 2
		for j in range(l):
			lc = lcm(lc, j + 2)
			if lc > 1000000000:
				break
			if a[j] % lc == 0:
				flag = False
				break
		if flag:
			print('YES')
		else:
			print('NO')
main()


for _ in range(int(input())):
	n = int(input())
	ans = 'YES'
	x = list(map(int, input().split()))
	for i in range(0, n):
		check = False
		for j in range(2, i + 3):
			if x[i] % j != 0:
				check = True
				break
		if check is False:
			ans = 'NO'
			break
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	i = n - 1
	while i >= 0:
		if a[i] % (i + 2) != 0:
			a.pop(i)
			i = len(a) - 1
		else:
			i -= 1
	if i < 0 and len(a) == 0:
		print('YES')
	else:
		print('NO')


import sys
inp = sys.stdin.readline

def solve():
	n = int(inp())
	a = list(map(int, inp().split()))
	c = 0
	for i in range(n):
		b = None
		for j in range(i, -1, -1):
			if a[i] % (j + 2) != 0:
				b = j
				break
		if b is None or b < i - c:
			print('NO')
			return
		c += 1
	print('YES')

def main():
	for i in range(int(inp())):
		solve()
main()


def gcd(a, b):
	return a if b == 0 else gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)
for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	div = 1
	ok = True
	for i in range(0, n):
		if i <= 24:
			div = lcm(div, i + 2)
		if a[i] % div == 0:
			ok = False
			break
	if ok:
		print('YES')
	else:
		print('NO')


from math import *
from bisect import bisect_left as bl
from bisect import bisect_right as br
from collections import Counter as ctr
from collections import deque as dq
from array import array
from re import search
li = lambda : list(map(int, input().split()))
arr = lambda a: array('i', a)
bi = lambda n: bin(n).replace('0b', '')
yn = lambda f: print('NYOE S'[f::2])
sbstr = lambda a, s: search('.*'.join(a), s)

def smnd(n):
	for i in range(2, n + 2):
		if n % i != 0:
			return i

def solve():
	for _ in range(int(input())):
		n = int(input())
		a = li()
		f = True
		d = 1
		for i in range(n):
			if a[i] % (i + 2) == 0 and smnd(a[i]) > i + 2:
				f = False
				break
		yn(f)
solve()


for test in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	flag = True
	for i in range(len(a)):
		for j in range(2, min(i + 2, 30) + 1):
			if a[i] % j:
				break
		else:
			flag = False
			break
	print('YES') if flag else print('NO')


t = int(input())
for i in range(t):
	n = input()
	a = input().split()
	check = True
	for _ in range(len(a)):
		k = int(a[_])
		jud = False
		for j in range(2, _ + 3):
			if k % j != 0:
				jud = True
				break
		if jud == False:
			check = False
			break
	if check == False:
		print('NO')
	else:
		print('YES')


def GCD(a, b):
	if b == 0:
		return a
	return GCD(b, a % b)

def LCM(a, b):
	return int(a * b / GCD(a, b))
t = int(input())
m = 1000000000.0 + 7
for x1 in range(t):
	h = 2
	boo = 0
	n = int(input())
	a = input().split()
	for y in range(n):
		if h < m:
			h = LCM(h, y + 2)
		if int(a[y]) % h == 0:
			print('NO')
			boo = 2
			break
	if boo == 0:
		print('YES')


import sys
sys.setrecursionlimit(100100)

def main():
	for _ in range(int(input())):
		_ = int(input())
		seq = list(map(int, input().split()))
		print(iter_solution(seq))

def solution(seq: list) -> str:
	if not seq:
		return 'YES'
	for i in range(len(seq), 0, -1):
		a = seq[i - 1]
		if a % (i + 1) != 0:
			del seq[i - 1]
			return solution(seq)
	return 'NO'

def iter_solution(seq: list) -> str:
	while seq:
		no = True
		for i in range(len(seq), 0, -1):
			a = seq[i - 1]
			if a % (i + 1) != 0:
				no = False
				del seq[i - 1]
				break
		if no and seq:
			return 'NO'
	return 'YES'
main()


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	i = n - 1
	while i >= 0:
		if arr[i] % (i + 2) != 0:
			arr.pop(i)
			i = len(arr) - 1
		else:
			i -= 1
	if i < 0 and len(arr) == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	h = list(map(int, input().split()))
	accomodate = True
	for i in range(n):
		j = 2
		k = i + 2
		while j <= k:
			if h[k - 2] % j != 0:
				break
			else:
				j += 1
		if j == k + 1:
			accomodate = False
			break
	if accomodate:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ans = 0
	for j in range(n):
		var = False
		for k in range(2, j + 3):
			if a[j] % k != 0:
				ans += 1
				var = True
				break
		if var == False:
			break
	if ans == n:
		print('YES')
	else:
		print('NO')


t = int(input())
answers = list()
for k in range(t):
	n = int(input())
	mas = list(map(int, input().split()))
	solved = False
	for i in range(n):
		if not mas[i] % (i + 2) == 0:
			continue
		else:
			m = 0
			for j in range(i + 1, 0, -1):
				if not mas[i] % j == 0:
					m = j
					break
			if m == 0:
				solved = True
				answers.append('NO')
				break
	if not solved:
		answers.append('YES')
print('\n'.join(answers))


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.insert(0, 0)
	flag = True
	for i in range(1, n + 1):
		f = True
		for j in range(1, i + 1):
			if a[i] % (j + 1) != 0:
				f = False
				break
		if f:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


a = int(input())
for x in range(a):
	b = int(input())
	c = list(map(int, input().split()))
	l = 0
	for y in range(b):
		s = 2
		t = -1
		while s <= y + 2:
			if c[y] % s != 0:
				t = 0
				break
			s += 1
		if t == -1:
			l = -1
			break
	if l == -1:
		print('NO')
	else:
		print('YES')


n_test = int(input())
for k in range(n_test):
	n = int(input())
	elements = input().split()
	for x in range(len(elements)):
		i = x + 2
		valido = False
		indice = i
		while valido is not True:
			if indice == 1:
				print('NO')
				break
			elif int(elements[x]) % indice != 0:
				valido = True
			else:
				indice = indice - 1
		if valido is not True:
			break
	if valido:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(i) for i in input().strip().split()]
	i = 0
	min_i = 0
	while i < n:
		check = False
		for j in range(0, i + 1):
			if a[i] % (j + 2) != 0:
				check = True
				break
		if check == False:
			break
		i += 1
	if check:
		print('YES')
	else:
		print('NO')


t = int(input())
for k in range(t):
	b = int(input())
	ls = list(map(int, input().split()))
	key = 'YES'
	for i in range(b):
		for j in range(2, i + 3):
			if ls[i] % j != 0:
				key == 'YES'
				break
			elif j == i + 2 and ls[i] % j == 0:
				print('NO')
				key = 'NO'
				break
		if key == 'NO':
			break
	if key == 'YES':
		print(key)


def solve(n, arr):
	while n != 0:
		for i in range(n - 1, -1, -1):
			if arr[i] % (i + 2) != 0:
				arr.pop(i)
				n -= 1
				break
		else:
			return 'NO'
	return 'YES'
t = int(input().strip())
for _ in range(t):
	_n_ = int(input().strip())
	_arr_ = [int(x) for x in input().strip().split()]
	_result_ = solve(_n_, _arr_)
	print(_result_)


t = int(input())

def ucln(a, b):
	if a == 0:
		return b
	else:
		return ucln(b % a, a)
for i in range(t):
	n = int(input())
	s1 = '0 '
	s2 = input()
	a = (s1 + s2).split()
	kt = 0
	for j in range(1, n + 1):
		kt = 0
		a[j] = int(a[j])
		for g in range(2, j + 2):
			if a[j] % g != 0:
				kt = 1
				break
		if kt == 0:
			print('NO')
			break
	if kt == 1:
		print('YES')


import sys

def read_line():
	return sys.stdin.readline()
cases = int(read_line())
for _ in range(cases):
	N = int(read_line())
	arr = read_line().split()
	num_arr = list(map(int, arr))
	removable = 0
	problem = 0
	for i in range(len(num_arr)):
		if num_arr[i] % (i + 2) != 0:
			removable += 1
			continue
		found = 0
		for r in range(1, removable + 1):
			if num_arr[i] % (i + 2 - r) != 0:
				removable += 1
				found = 1
				break
		if found == 0:
			problem = 1
			break
	if problem == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	yes = True
	for i in range(n):
		b = 0
		if a[i] == 1:
			b = 1
		for j in range(1, a[i] + 2):
			if a[i] % (j + 1) != 0:
				b = j
				break
		if b > i + 1:
			yes = False
			break
	print('YES' if yes else 'NO')


t = int(input())
for tc in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	solve = True
	for i in range(1, n + 1):
		num = a[i - 1]
		numflag = False
		if i >= 22:
			numflag = True
		else:
			for j in range(2, i + 2):
				if num % j != 0:
					numflag = True
					break
		solve &= numflag
	if solve:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	while a:
		for i in range(len(a) - 1, -1, -1):
			if a[i] % (i + 2):
				del a[i]
				break
		else:
			break
	if a:
		print('NO')
	else:
		print('YES')


for w in range(int(input())):
	a = int(input())
	k = a
	b = list(map(int, input().split()))
	if b[0] % 2 == 0:
		print('NO')
	else:
		for q in range(a):
			for i in range(k):
				if b[-1 - i] % (k - i + 1) != 0:
					b.pop(-1 - i)
					k -= 1
					break
		if len(b) == 0:
			print('YES')
		else:
			print('NO')


def canDestroy(a, n):
	while n > 0:
		for (i, elem) in zip(range(n, -1, -1), reversed(a)):
			if elem % (i + 1) != 0:
				del a[i - 1]
				break
		if len(a) == n:
			return False
		else:
			n = len(a)
	return True

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = [x for x in map(int, input().split(' '))]
		print('YES') if canDestroy(a, n) else print('NO')
main()


for _ in range(int(input())):
	size = int(input())
	arr = list(map(int, input().split()))
	while True:
		if len(arr) == 0:
			print('YES')
			break
		dif = 0
		bad = 0
		for ind in range(len(arr) - 1, -1, -1):
			if arr[ind] % (ind + 2) != 0 and (not bad):
				arr.pop(ind)
				dif += 1
			elif arr[ind] % (ind + 2) != 0:
				arr.pop(ind)
				dif += 1
				break
			else:
				bad = 1
		if dif == 0 and len(arr) != 0:
			print('NO')
			break


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if a[0] % 2 == 0:
		print('NO')
		continue
	while True:
		thingy = False
		for j in range(len(a) - 1, -1, -1):
			if a[j] % (j + 2) != 0 or a[j] < j + 2:
				a.pop(j)
				thingy = True
				break
		if len(a) == 0:
			print('YES')
			break
		if thingy == False:
			print('NO')
			break


for _ in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	ok = True
	for i in range(n):
		f = False
		for j in range(i + 2, 1, -1):
			if A[i] % j:
				f = True
				break
		ok &= f
	if ok:
		print('YES')
	else:
		print('NO')


from collections import *
for y in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	ans = 'YES'
	for i in range(n):
		f = 0
		for j in range(2, i + 3):
			if lst[i] % j != 0:
				f = 1
				break
		if f == 0:
			ans = 'NO'
	print(ans)


import math

def main_function():
	test_cases = range(int(input()))
	for test_case in test_cases:
		n = int(input())
		a = [int(u) for u in input().split(' ')]
		ans_not_found = True
		counter = [-1 for i in range(len(a))]
		for i in range(len(a)):
			real_counter = 0
			targ_i = i + 2
			while targ_i > 0 and a[i] % targ_i == 0:
				real_counter += 1
				targ_i -= 1
			if targ_i > 0:
				counter[i] = real_counter
		if -1 in counter:
			print('NO')
		else:
			print('YES')
main_function()


for _ in range(int(input())):
	n = int(input())
	f = 0
	l = list(map(int, input().split()))
	ans = 1
	c = 0
	for i in range(1, n + 1):
		c = 0
		for j in range(i + 1, 1, -1):
			if l[i - 1] % j:
				c = 1
				break
		ans = c & ans
	if ans == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(0, t):
	n = int(input())
	l = list(map(int, input().split()))
	q = []
	i = n - 1
	while i >= 0:
		item = l.pop()
		if item % (i + 2) == 0:
			q.append((item, i))
		elif len(q) > 0:
			j = 0
			while j < len(q) and q[j][0] % (q[j][1] + 1) != 0:
				j += 1
			for k in range(len(q) - 1, j - 1, -1):
				l.append(q[k][0])
				i += 1
			q = []
		i -= 1
	print('YES' if len(l) <= 0 and len(q) <= 0 else 'NO')


t = int(input())
for _ in range(t):
	n = int(input())
	(*a,) = map(int, input().split())
	a = [0] + a
	ans = True
	for i in range(1, n + 1):
		k = False
		for j in range(i + 1, 1, -1):
			if a[i] % j != 0:
				k = True
				break
		ans &= k
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	ok = True
	a = list(map(int, input().split()))
	for i in range(1, n + 1):
		found = False
		for j in range(i + 1, 1, -1):
			if a[i - 1] % j:
				found = True
				break
		ok = ok & found
	if ok:
		print('YES')
	else:
		print('NO')