Ashu and Prime Factors
Practice
3.9 (207 votes)
Approved
Easy
Math
Open
Primality test
Prime factorization
Ready
Problem
66% Success 10875 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Ashu is very fond of Prime numbers and he like challenging his friends by giving them various problems based on Mathematics and Prime number. One of his friend Harshit is jealous and challenges him to solve a task. Task is :
Given a prime number X, you need to give the count of all numbers in range 1 to 106 inclusive which have minimum prime factor X.
Help Ashu in solving this task.

Input:
First line consist of numer of test cases T.
Each test case contains a single number X.

Output:
Output for each test case count of all numbers in range 1 to 106 inclusive which have minimum prime factor X.

Constraints:
1 ≤ T ≤ 105
Prime number X where 2 ≤ X ≤ 106

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
90 votes
Tags:
ApprovedEasyFactorizationMathNumber TheoryOpen
Points:20
49 votes
Tags:
Basic ProgrammingBit ManipulationBit manipulationMath
Points:20
38 votes
Tags:
Ad-HocApprovedEasyGreatest common divisorMathNumber theorygcd