# [bzoj2440] [中山市选2011]完全平方数

## Sample Input

4
1
13
100
1234567


## Sample Output

1
19
163
2030745


## Solution

$\sum_{d|n}\mu(d)=[n=1]$

#include<bits/stdc++.h>
using namespace std;

#define int long long

#define ONLINE_JUDGE

#ifdef ONLINE_JUDGE
#endif

namespace fast_IO {
char buf[1<<21],*p1=buf,*p2=buf;

template <typename T> inline void read(T &x) {
x=0;T f=1;char ch=getchar();
for(;!isdigit(ch);ch=getchar()) if(ch=='-') f=-f;
for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';x*=f;
}
template <typename T,typename... Args> inline void read(T& x,Args& ...args) {
}

char buf2[1<<21],a[80];int p,p3=-1;

inline void flush() {fwrite(buf2,1,p3+1,stdout),p3=-1;}
template <typename T> inline void write(T x) {
if(p3>(1<<20)) flush();
if(x<0) buf2[++p3]='-',x=-x;
do {a[++p]=x%10+48;} while(x/=10);
do {buf2[++p3]=a[p];} while(--p);
buf2[++p3]='\n';
}
template <typename T,typename... Args> inline void write(T x,Args ...args) {
write(x),write(args...);
}
}

using fast_IO :: write;
using fast_IO :: flush;

const int maxn = 1e6+10;

int pri[maxn],tot,vis[maxn],mu[maxn];

void sieve() {
mu[1]=1;
for(int i=2;i<maxn;i++) {
if(!vis[i]) pri[++tot]=i,mu[i]=-1;
for(int j=1;j<=tot&&i*pri[j]<maxn;j++) {
vis[i*pri[j]]=1;
if(i%pri[j]==0) break;
mu[i*pri[j]]=-mu[i];
}
}
}

int check(int n) {
int tmp=0;
for(int i=1;i*i<=n;i++) tmp=tmp+mu[i]*n/(i*i);
return tmp;
}

void solve() {
while(l<=r) {
mid=((l+r)>>1);
if(check(mid)>=n) ans=mid,r=mid-1;
else l=mid+1;
}write(ans);
}

signed main() {
sieve();