CF1423K.Lonely Numbers
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
In number world, two different numbers are friends if they have a lot in common, but also each one has unique perks.
More precisely, two different numbers a and b are friends if gcd(a,b) , gcd(a,b)a , gcd(a,b)b can form sides of a triangle.
Three numbers a , b and c can form sides of a triangle if a+b>c , b+c>a and c+a>b .
In a group of numbers, a number is lonely if it doesn't have any friends in that group.
Given a group of numbers containing all numbers from 1,2,3,...,n , how many numbers in that group are lonely?
输入格式
The first line contains a single integer t (1≤t≤106) - number of test cases.
On next line there are t numbers, ni (1≤ni≤106) - meaning that in case i you should solve for numbers 1,2,3,...,ni .
输出格式
For each test case, print the answer on separate lines: number of lonely numbers in group 1,2,3,...,ni .
输入输出样例
输入#1
3 1 5 10
输出#1
1 3 3
说明/提示
For first test case, 1 is the only number and therefore lonely.
For second test case where n=5 , numbers 1 , 3 and 5 are lonely.
For third test case where n=10 , numbers 1 , 5 and 7 are lonely.