{"id":"820e750a-c1b2-46a0-b695-2bd52f126518","name":"All Factors Using Sieve","description":"Given t test cases and in each test case you have a positive integer n, we have to find the total number of divisors for n.","inputFormat":"The first line of input contains integer t.\r\nThe next t lines of the input contains integer n.","outputFormat":"Print number of divisors in a line for each test case.","constraints":"1 <= t <= 1000\r\n1 <= n <= 10^5","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.io.BufferedReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.util.ArrayList;\r\n\r\npublic class Main {\r\n\r\n\r\n public static void main(String[] args) throws NumberFormatException, IOException {\r\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n\r\n }\r\n}\r\n"},"ruby":{"code":""},"python":{"code":""},"javascript":{"code":""}},"points":10,"difficulty":"medium","sampleInput":"10\r\n21\r\n22\r\n23\r\n24\r\n25\r\n26\r\n27\r\n28\r\n29\r\n30\r\n","sampleOutput":"4\r\n4\r\n2\r\n8\r\n3\r\n4\r\n4\r\n6\r\n2\r\n8\r\n\r\n","questionVideo":"","hints":[],"associated":[],"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":"086949fa-3c5e-40c6-8a9c-f9be4b400318","name":"Number Theory For Experts","slug":"number-theory-for-experts","type":0},{"id":"319f8b60-b521-4b74-9e86-f8673e9a6665","name":"All Factors Using Sieve","slug":"all-factors-using-sieve","type":1}],"next":{"id":"ca5aa38f-bc98-4278-86dc-a8a6106aef3e","name":"Count Of Common Divisors","type":1,"slug":"count-of-common-divisors"},"prev":{"id":"7a0addd3-431f-49f2-9130-83ccdd374ccf","name":"Prime Factors Using Sieve","type":1,"slug":"prime-factors-using-sieve"}}}

All Factors Using Sieve

Given t test cases and in each test case you have a positive integer n, we have to find the total number of divisors for n.

{"id":"820e750a-c1b2-46a0-b695-2bd52f126518","name":"All Factors Using Sieve","description":"Given t test cases and in each test case you have a positive integer n, we have to find the total number of divisors for n.","inputFormat":"The first line of input contains integer t.\r\nThe next t lines of the input contains integer n.","outputFormat":"Print number of divisors in a line for each test case.","constraints":"1 <= t <= 1000\r\n1 <= n <= 10^5","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.io.BufferedReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.util.ArrayList;\r\n\r\npublic class Main {\r\n\r\n\r\n public static void main(String[] args) throws NumberFormatException, IOException {\r\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n\r\n }\r\n}\r\n"},"ruby":{"code":""},"python":{"code":""},"javascript":{"code":""}},"points":10,"difficulty":"medium","sampleInput":"10\r\n21\r\n22\r\n23\r\n24\r\n25\r\n26\r\n27\r\n28\r\n29\r\n30\r\n","sampleOutput":"4\r\n4\r\n2\r\n8\r\n3\r\n4\r\n4\r\n6\r\n2\r\n8\r\n\r\n","questionVideo":"","hints":[],"associated":[],"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":"086949fa-3c5e-40c6-8a9c-f9be4b400318","name":"Number Theory For Experts","slug":"number-theory-for-experts","type":0},{"id":"319f8b60-b521-4b74-9e86-f8673e9a6665","name":"All Factors Using Sieve","slug":"all-factors-using-sieve","type":1}],"next":{"id":"ca5aa38f-bc98-4278-86dc-a8a6106aef3e","name":"Count Of Common Divisors","type":1,"slug":"count-of-common-divisors"},"prev":{"id":"7a0addd3-431f-49f2-9130-83ccdd374ccf","name":"Prime Factors Using Sieve","type":1,"slug":"prime-factors-using-sieve"}}}
plane

Editor


Loading...

All Factors Using Sieve

medium

Given t test cases and in each test case you have a positive integer n, we have to find the total number of divisors for n.

Constraints

1 <= t <= 1000 1 <= n <= 10^5

Format

Input

The first line of input contains integer t. The next t lines of the input contains integer n.

Output

Print number of divisors in a line for each test case.

Example

Sample Input

10 21 22 23 24 25 26 27 28 29 30

Sample Output

4 4 2 8 3 4 4 6 2 8

Discussions

Show Discussion

Related Resources

related resources

Turning Off Zen Mode