SOLVE

LATER

Katari and his love for Mex

Problem

Editorial

Analytics

As we all know, Katari is very desperate about winning every game he plays. So, he needs your help to win the games using your knowledge on Mex . Mex is an ancronym for Minimum Excludant.

Mex of a number in this game can be defined as the minimum positive integer that is not in the set containing the Mex of all the divisors of the number.

Input :

```
First line of the input contains t, number of test case.
Next t lines contains a number n, to which you have to find the Mex.
1 <= t <= 100000
1 <= n <= 10^11
```

Output :

```
Output t lines each line containing the value of Mex of number.
```

Explanation

Mex(4) can be calculated as:

```
Divisors of 4 = {1, 2}
Mex of 1 = 0.
Mex of 2 = Mex(Mex of divisors of 2) = Mex{Mex(1)} = Mex{0} = 1.
Mex of 4 = Mex{Mex(1),Mex(2)} = Mex{0,1} = 2.
```

Time Limit:
2.0 sec(s)
for each input file.

Memory Limit:
256 MB

Source Limit:
1024 KB

Marking Scheme:
Marks are awarded when all the testcases pass.

Allowed Languages:
C,
C++,
C++14,
Clojure,
C#,
D,
Erlang,
F#,
Go,
Groovy,
Haskell,
Java,
Java 8,
JavaScript(Rhino),
JavaScript(Node.js),
Julia,
Kotlin,
Lisp,
Lisp (SBCL),
Lua,
Objective-C,
OCaml,
Octave,
Pascal,
Perl,
PHP,
Python,
Python 3,
R(RScript),
Racket,
Ruby,
Rust,
Scala,
Swift,
Visual Basic

Initializing Code Editor...

{"4ce458f": "/pagelets/problem-author-tester/algorithm/katari-and-his-love-for-mex/", "f342b19": "/pagelets/recommended-problems/algorithm/katari-and-his-love-for-mex/", "7f77a84": "/pagelets/show-submission/algorithm/katari-and-his-love-for-mex/", "22f1422": "/pagelets/problems-hint/algorithm/katari-and-his-love-for-mex/", "c77c7ed": "/pagelets/suggested-problems/algorithm/katari-and-his-love-for-mex/"}

realtime.hackerearth.com

80

d881a587b3378dba93da59f1d370f69606fb7109

58a29e5cae2309f04b28

/realtime/pusher/auth/