#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned long long);
int /*<<< orphan*/ scanf(char *, unsigned long long *);
int main() {
  unsigned long long N, T;
  scanf("%Lu", &T);
  while (T--) {
    unsigned long long total;
    unsigned long long i;
    int status = 0;
    scanf("%Lu", &N);
    total = N;
    while (status == 0) {
      i = 2;
      while (i <= N) {
        if ((total % i) == 0) {
          i++;
        } else {
          total++;
          break;
        }
      }
      if (i > N)
        status = 1;
    }
    printf("%Lu\n", total);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x18(%rbp)
cmp    $0x0,%rax
je     1203 <main+0xe3>
movl   $0x0,-0x2c(%rbp)
lea    0xe9a(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jne    11ee <main+0xce>
movq   $0x2,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x10(%rbp),%rax
ja     11d4 <main+0xb4>
mov    -0x20(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x28(%rbp)
cmp    $0x0,%rdx
jne    11be <main+0x9e>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    11cf <main+0xaf>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    11d4 <main+0xb4>
jmp    1189 <main+0x69>
mov    -0x28(%rbp),%rax
cmp    -0x10(%rbp),%rax
jbe    11e9 <main+0xc9>
movl   $0x1,-0x2c(%rbp)
jmp    1177 <main+0x57>
mov    -0x20(%rbp),%rsi
lea    0xe0b(%rip),%rdi
call   1030 <printf@plt>
jmp    113f <main+0x1f>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed0(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
subq   $0x1,(%rsp)
jae    114b <main+0x2b>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xeae(%rip),%r14
lea    0x8(%rsp),%r15
lea    0xea6(%rip),%rbx
jmp    1172 <main+0x52>
mov    %rcx,%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
subq   $0x1,(%rsp)
jb     113f <main+0x1f>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0x8(%rsp),%rsi
cmp    $0x2,%rsi
jb     1163 <main+0x43>
mov    %rsi,%rcx
mov    $0x2,%edi
mov    %rcx,%rax
or     %rdi,%rax
shr    $0x20,%rax
je     11b0 <main+0x90>
mov    %rcx,%rax
xor    %edx,%edx
div    %rdi
test   %rdx,%rdx
je     11bb <main+0x9b>
jmp    11d0 <main+0xb0>
nopl   0x0(%rax,%rax,1)
mov    %ecx,%eax
xor    %edx,%edx
div    %edi
test   %rdx,%rdx
jne    11d0 <main+0xb0>
add    $0x1,%rdi
cmp    %rsi,%rdi
jbe    1190 <main+0x70>
jmp    1160 <main+0x40>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rcx
cmp    $0x1,%rsi
ja     118b <main+0x6b>
jmp    1163 <main+0x43>

LLVM IR (-O0):
@.str = [4 x i8] c"%Lu\00"
@.str.1 = [5 x i8] c"%Lu\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %3)
br label %8
8: ; preds = %41, %0
%9 = load i64, i64* %3
%10 = add i64 %9, -1
store i64 %10, i64* %3
%11 = icmp ne i64 %9, 0
br i1 %11, label %12, label %44
12: ; preds = %8
store i32 0, i32* %6
%13 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %2)
%14 = load i64, i64* %2
store i64 %14, i64* %4
br label %15
15: ; preds = %40, %12
%16 = load i32, i32* %6
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %41
18: ; preds = %15
store i64 2, i64* %5
br label %19
19: ; preds = %34, %18
%20 = load i64, i64* %5
%21 = load i64, i64* %2
%22 = icmp ule i64 %20, %21
br i1 %22, label %23, label %35
23: ; preds = %19
%24 = load i64, i64* %4
%25 = load i64, i64* %5
%26 = urem i64 %24, %25
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %23
%29 = load i64, i64* %5
%30 = add i64 %29, 1
store i64 %30, i64* %5
br label %34
31: ; preds = %23
%32 = load i64, i64* %4
%33 = add i64 %32, 1
store i64 %33, i64* %4
br label %35
34: ; preds = %28
br label %19
35: ; preds = %31, %19
%36 = load i64, i64* %5
%37 = load i64, i64* %2
%38 = icmp ugt i64 %36, %37
br i1 %38, label %39, label %40
39: ; preds = %35
store i32 1, i32* %6
br label %40
40: ; preds = %39, %35
br label %15
41: ; preds = %15
%42 = load i64, i64* %4
%43 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %42)
br label %8
44: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%Lu\00"
@.str.1 = [5 x i8] c"%Lu\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = bitcast i64* %1 to i8*
%4 = bitcast i64* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %2)
%6 = load i64, i64* %2
%7 = add i64 %6, -1
store i64 %7, i64* %2
%8 = icmp eq i64 %6, 0
br i1 %8, label %30, label %9
9: ; preds = %0, %24
%10 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %1)
%11 = load i64, i64* %1
%12 = icmp ult i64 %11, 2
br i1 %12, label %24, label %13
13: ; preds = %9, %22
%14 = phi i64 [ %23, %22 ], [ %11, %9 ]
br label %17
15: ; preds = %17
%16 = icmp ugt i64 %21, %11
br i1 %16, label %24, label %17
17: ; preds = %13, %15
%18 = phi i64 [ %21, %15 ], [ 2, %13 ]
%19 = urem i64 %14, %18
%20 = icmp eq i64 %19, 0
%21 = add i64 %18, 1
br i1 %20, label %15, label %22
22: ; preds = %17
%23 = add i64 %14, 1
br i1 %12, label %24, label %13
24: ; preds = %22, %15, %9
%25 = phi i64 [ %11, %9 ], [ %14, %15 ], [ %11, %22 ]
%26 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %25)
%27 = load i64, i64* %2
%28 = add i64 %27, -1
store i64 %28, i64* %2
%29 = icmp eq i64 %27, 0
br i1 %29, label %30, label %9
30: ; preds = %24, %0
ret i32 0
}