ETF  Euler Totient Function
In number theory, the totient φ of a positive integer n is defined to be the number of positive integers less than or equal to n that are coprime to n.
Given an integer n (1 <= n <= 10^6). Compute the value of the totient φ.
Input
First line contains an integer T, the number of test cases. (T <= 20000)
T following lines, each contains an integer n.
Output
T lines, one for the result of each test case.
Example
Input: 5 1 2 3 4 5 Output: 1 1 2 2 4
hide comments
mrmajumder:
20191127 11:55:18
Try to implement O(sqrt(n)) ;) 

lizmurray:
20191120 08:20:36
How can i avoid tle in java?


sicklesplit:
20190911 19:13:33
Was using long long and getting wa, Use float and then type convert to get AC 

prabhat7298:
20190909 05:10:04
Can be done in O(n) using linear sieve 

sidharth20:
20190814 07:10:46
AC in 100th go Last edit: 20190814 07:14:46 

sanket17:
20190708 09:04:00
By using seive in c++ i m getting TLE


sid779:
20190701 09:47:21
AC in one go using Euler's totient function. 

fill32:
20190619 10:00:09
for python, don't use sieve8 cause import numpy takes alot of time, use naive sive with max 10^4 is enough to get AC. 

anmol_9557:
20190618 19:23:03
AC in one go! just go cpalgorithm for implementation in case neede. 

aj_254:
20190513 20:40:10
after many optimization solved in python 0.10 sec ez pz lemon squezy used standard i/o and euler sieve and you definetely get ac 
Added by:  Race with time 
Date:  20090327 
Time limit:  1s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ERL JSRHINO NODEJS PERL6 VB.NET 