CHEF AND LUCKY NUMBER

Mr. Chef has been given a number N. He has a tendency to double whatever he get. So now he has got the number N with him and he has multiplied the number N by 2. Now Chef is superstitious. He believes in something known as Lucky Number. His lucky number is defined as any number, which
when multiplied by 2 has no other factors other than 1,2, and N. If the number is lucky all you have to do is print “LUCKY NUMBER”. If the number is not a lucky number, print “Sorry”…

Input
The first line consists of T, which is the number of test cases. Every line of the next T lines consists of N.

Output
Print LUCKY NUMBER if the number is lucky and “Sorry” if the number is not lucky followed by a new line.

Constraints
1<=T<=1000
1<=N<=1000000

Input
3
26
12
11

Output:
Sorry
Sorry
LUCKY NUMBER

I’m not able to solve it please help.!!!

@mnairmahesh26: Okay let me try to make you understand.

You know what a prime number is right? Well a prime number is any number, that can be divided only by 1,and that number itself. No other number can divide a prime number.

Now let me take a number. And then when i multiply that number by 2, then obviously 2 will be a factor, of that result right?
See if i take a number say 5, and i multiply 5 by 2, ie is 5x2, the result is 10, which has factors-1,2,5 right? (excluding 10 which will obviously be a factor of 10)
Ealier it we had only 1,5 as the factors of 5.

Now see, when a number N when multiplied by 2 and has factors only which are 1,2,N,and when before multiplying, the number N had only factors like 1,N. then what is that ?
Now what is that number that has only 1,itself as factors? Yes you guessed it right- it is prime number.

All you had to do was check the number was prime or not. And print “LUCKY NUMBER” if prime, else “Sorry”

Well there was a mistake in the input and output file I made. I am really sorry for the trouble. When you are submitting, please try submitting without accepting the value of T. Instead initialize T=1000000.

That should get give you AC.

I forgot to mention in the class. I am really sorry! I dont have the administrative privilage to change the input file i submitted. Please try this way!

HAPPY CODING