Prime RelationProblem code: NSIT14 |
Given a positive integer 'N' , find the number of positive integers less than or equal to N, which are relatively prime to N.
Two positive integers 'a' and 'b' are called relatively prime if gcd(a,b) = 1 (Where gcd is Greatest Common Divisor).
Input
The first line consists of a number 't' which specifies the number of test cases. 1<=t<=10000. 't' lines follow with a number 'n' on each line. 1<=n<=10^6
Output
For each test case, output the number of positive integers less than or equal to N which are relatively prime to N.
Example
Input: 5 1 2 4 10 20 Output: 1 1 2 4 8
| Author: | admin |
| Date Added: | 1-10-2009 |
| Time Limit: | 3 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TEXT, WSPC |
Comments

Fetching successful submissions

i hav written the code in c
i hav written the code in c on dev c++ compiler,
it works perfectly well on my system.
but when i submit it on the site, it shows me compile error.
i opt for c gcc 4.0.0-8
tell me wat 2 do ?
are you using void
are you using void main()??
AFAIR I have read somewhere that mst of the online compilers give run time error when we use void main() instead of int main(){
...
..
return 0;
}
Read the FAQ
Read the FAQ
hw cn i remove d "time limit
hw cn i remove d "time limit exceeded error"....????
wat shud be the o/p exactly ?
wat shud be the o/p exactly ?
output the number of positive
output the number of positive integers, less than or equal to N, which are relatively prime to N