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++,
Clojure,
C#,
D,
Erlang,
F#,
Go,
Groovy,
Haskell,
Java,
Java 8,
JavaScript(Rhino),
JavaScript(Node.js),
Lisp,
Lisp (SBCL),
Lua,
Objective-C,
OCaml,
Octave,
Pascal,
Perl,
PHP,
Python,
Python 3,
R(RScript),
Racket,
Ruby,
Rust,
Scala,
Scala 2.11.8,
Swift,
Visual Basic

Initializing Code Editor...

{"8f31769": "/pagelets/suggested-problems/algorithm/katari-and-his-love-for-mex/", "8f3165c": "/pagelets/show-submission/algorithm/katari-and-his-love-for-mex/", "8f317d6": "/pagelets/problems-hint/algorithm/katari-and-his-love-for-mex/", "8f317fa": "/pagelets/recommended-problems/algorithm/katari-and-his-love-for-mex/", "8f31792": "/pagelets/problem-author-tester/algorithm/katari-and-his-love-for-mex/"}

{}

realtime.hackerearth.com

80

d881a587b3378dba93da59f1d370f69606fb7109

58a29e5cae2309f04b28

/realtime/pusher/auth/