{"id":"7092599f-3958-4f23-8d32-4e4f53090e36","name":"Is A Number Prime","description":"1. You've to check whether a given number is prime or not.\r\n2. Take a number \"t\" as input representing count of input numbers to be tested.\r\n3. Take a number \"n\" as input \"t\" number of times.\r\n4. For each input value of n, print \"prime\" if the number is prime and \"not prime\" otherwise.","inputFormat":"A number t\r\nA number n\r\nA number n\r\n.. t number of times","outputFormat":"prime\r\nnot prime\r\nnot prime\r\n.. t number of times","constraints":"1 &lt;= t &lt;= 10000\r\n2 &lt;= n &lt; 10^9","sampleCode":{"cpp":{"code":"#include <iostream>\r\nusing namespace std;\r\nint main(int argc, char **argv){\r\n int t;\r\n cin >> t;\r\n\r\n //write your code here\r\n \r\n}"},"java":{"code":"import java.util.*;\r\n \r\n public class Main{\r\n \r\n public static void main(String[] args) {\r\n Scanner scn = new Scanner(System.in);\r\n \r\n // write ur code here\r\n \r\n }\r\n }"},"python":{"code":"t=int(input())\n\n#write your code here"}},"points":10,"difficulty":"easy","sampleInput":"5\r\n13\r\n2\r\n3\r\n4\r\n5","sampleOutput":"prime\r\nprime\r\nprime\r\nnot prime\r\nprime","questionVideo":"https://www.youtube.com/embed/3bCf5xSVkbo","hints":[],"associated":[{"id":"82cbb4a5-2572-4f94-a50d-cd9e1b7681a5","name":"What will be the time complexity of Is A Number Prime?","slug":"what-will-be-the-time-complexity-of-is-a-number-prime","type":4},{"id":"bd394410-b3c2-4ad9-aea6-4a2ea91335d7","name":"What will we print if we encounter '1' as our input?","slug":"what-will-we-print-if-we-encounter-1-as-our-input","type":4},{"id":"cd83904c-1d0e-4312-91ae-07889bad2064","name":"What error will we get if we run this loop until the number instead of the square root of that number?","slug":"what-error-will-we-get-if-we-run-this-loop-until-the-number-instead-of-the-square-root-of-that-number","type":4},{"id":"d7de1407-d133-49ff-a59e-f35f9e8c16c1","name":"Is 23 a prime number?","slug":"is-23-a-prime-number","type":4}],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"72157774-7fd0-4b8e-88dc-037800acd626","name":"Getting Started","slug":"getting-started-9996","type":0},{"id":"a07dd517-e83d-4926-a164-eac0b29dcdce","name":"Is A Number Prime","slug":"is-a-number-prime","type":1}],"next":{"id":"38a6c0ce-7eda-43f3-ab44-a356e0cbafdc","name":"Is a Number Prime?","type":3,"slug":"is-a-number-prime"},"prev":{"id":"d0f676bd-0e28-4e81-a445-a3be0052339c","name":"How To Take Input In Programming Language","type":0,"slug":"how-to-take-input-in-programming-language"}}}

Is A Number Prime

1. You've to check whether a given number is prime or not. 2. Take a number "t" as input representing count of input numbers to be tested. 3. Take a number "n" as input "t" number of times. 4. For each input value of n, print "prime" if the number is prime and "not prime" otherwise.

{"id":"7092599f-3958-4f23-8d32-4e4f53090e36","name":"Is A Number Prime","description":"1. You've to check whether a given number is prime or not.\r\n2. Take a number \"t\" as input representing count of input numbers to be tested.\r\n3. Take a number \"n\" as input \"t\" number of times.\r\n4. For each input value of n, print \"prime\" if the number is prime and \"not prime\" otherwise.","inputFormat":"A number t\r\nA number n\r\nA number n\r\n.. t number of times","outputFormat":"prime\r\nnot prime\r\nnot prime\r\n.. t number of times","constraints":"1 &lt;= t &lt;= 10000\r\n2 &lt;= n &lt; 10^9","sampleCode":{"cpp":{"code":"#include <iostream>\r\nusing namespace std;\r\nint main(int argc, char **argv){\r\n int t;\r\n cin >> t;\r\n\r\n //write your code here\r\n \r\n}"},"java":{"code":"import java.util.*;\r\n \r\n public class Main{\r\n \r\n public static void main(String[] args) {\r\n Scanner scn = new Scanner(System.in);\r\n \r\n // write ur code here\r\n \r\n }\r\n }"},"python":{"code":"t=int(input())\n\n#write your code here"}},"points":10,"difficulty":"easy","sampleInput":"5\r\n13\r\n2\r\n3\r\n4\r\n5","sampleOutput":"prime\r\nprime\r\nprime\r\nnot prime\r\nprime","questionVideo":"https://www.youtube.com/embed/3bCf5xSVkbo","hints":[],"associated":[{"id":"82cbb4a5-2572-4f94-a50d-cd9e1b7681a5","name":"What will be the time complexity of Is A Number Prime?","slug":"what-will-be-the-time-complexity-of-is-a-number-prime","type":4},{"id":"bd394410-b3c2-4ad9-aea6-4a2ea91335d7","name":"What will we print if we encounter '1' as our input?","slug":"what-will-we-print-if-we-encounter-1-as-our-input","type":4},{"id":"cd83904c-1d0e-4312-91ae-07889bad2064","name":"What error will we get if we run this loop until the number instead of the square root of that number?","slug":"what-error-will-we-get-if-we-run-this-loop-until-the-number-instead-of-the-square-root-of-that-number","type":4},{"id":"d7de1407-d133-49ff-a59e-f35f9e8c16c1","name":"Is 23 a prime number?","slug":"is-23-a-prime-number","type":4}],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"72157774-7fd0-4b8e-88dc-037800acd626","name":"Getting Started","slug":"getting-started-9996","type":0},{"id":"a07dd517-e83d-4926-a164-eac0b29dcdce","name":"Is A Number Prime","slug":"is-a-number-prime","type":1}],"next":{"id":"38a6c0ce-7eda-43f3-ab44-a356e0cbafdc","name":"Is a Number Prime?","type":3,"slug":"is-a-number-prime"},"prev":{"id":"d0f676bd-0e28-4e81-a445-a3be0052339c","name":"How To Take Input In Programming Language","type":0,"slug":"how-to-take-input-in-programming-language"}}}
plane

Editor


Loading...

Is A Number Prime

easy

1. You've to check whether a given number is prime or not. 2. Take a number "t" as input representing count of input numbers to be tested. 3. Take a number "n" as input "t" number of times. 4. For each input value of n, print "prime" if the number is prime and "not prime" otherwise.

Constraints

1 <= t <= 10000 2 <= n < 10^9

Format

Input

A number t A number n A number n .. t number of times

Output

prime not prime not prime .. t number of times

Example

Sample Input

5 13 2 3 4 5

Sample Output

prime prime prime not prime prime

Question Video

Discussions

Show Discussion

Related Resources

related resources

Turning Off Zen Mode