#include #include namespace my{ #define eb emplace_back #define LL(...) ll __VA_ARGS__;lin(__VA_ARGS__) #define FO(n) for(ll ij=n;ij--;) #define FOR(i,...) for(auto[i,i##stop,i##step]=range(0,__VA_ARGS__);i=i##stop;i-=i##step) #define fe(a,i,...) for(auto&&__VA_OPT__([)i __VA_OPT__(,__VA_ARGS__]):a) #define quotient_range_fe(n,y,l,r) for(ll _n=n,y,l,r=1;(y=_n/(l=r))&&(r=_n/y+1);) #define single_testcase void solve();}int main(){my::io();my::solve();}namespace my{ using namespace std; void io(){cin.tie(nullptr)->sync_with_stdio(0);cout<>(istream&i,ulll&x){ull t;i>>t;x=t;return i;} ostream&operator<<(ostream&o,const ulll&x){return(x<10?o:o<>(istream&i,lll&x){ll t;i>>t;x=t;return i;} ostream&operator<<(ostream&o,const lll&x){return o<0?x:-x);} auto range(bool s,ll a,ll b=1e18,ll c=1){if(b==1e18)b=a,(s?b:a)=0;return array{a-s,b,c};} constexpr char nl=10; constexpr char sp=32; lll pw(lll x,ll n,ll m=0){assert(n>=0);lll r=1;while(n)n&1?r*=x:r,x*=x,m?r%=m,x%=m:r,n>>=1;return r;} templatestruct pair{ A a;B b; pair()=default; pair(A a,B b):a(a),b(b){} pair(const std::pair&p):a(p.first),b(p.second){} auto operator<=>(const pair&)const=default; friend ostream&operator<<(ostream&o,const pair&p){return o<>auto&sort(auto&a,const F&f={}){ranges::sort(a,f);return a;} templateostream&operator<<(ostream&o,const std::pair&p){return o<concept vectorial=is_base_of_v,V>; templatestruct core_type{using type=T;}; templatestruct core_type{using type=typename core_type::type;}; templateusing core_t=core_type::type; templateistream&operator>>(istream&i,vector&v){fe(v,e)i>>e;return i;} templateostream&operator<<(ostream&o,const vector&v){fe(v,e)o<?nl:sp);return o;} templatestruct vec:vector{ using vector::vector; vec(const vector&v){vector::operator=(v);} vec&operator^=(const vec&u){this->insert(this->end(),u.begin(),u.end());return*this;} vec operator^(const vec&u)const{return vec{*this}^=u;} vec&operator++(){fe(*this,e)++e;return*this;} vec&operator--(){fe(*this,e)--e;return*this;} auto scan(const auto&f)const{pair,bool>r{};fe(*this,e)if constexpr(!vectorial)r.b?f(r.a,e),r:r={e,1};else if(auto s=e.scan(f);s.b)r.b?f(r.a,s.a),r:r=s;return r;} auto sum()const{return scan([](auto&a,const auto&b){a+=b;}).a;} vec zeta()const{vec v=*this;if constexpr(vectorial)fe(v,e)e=e.zeta();fo(i,v.size()-1)v[i+1]+=v[i];return v;} vec mobius()const{vec v=*this;if constexpr(vectorial)fe(v,e)e=e.mobius();of(i,v.size()-1)v[i+1]-=v[i];return v;} }; templatestruct infinity{ templateconstexpr operator T()const{return numeric_limits::max()*(1-is_negative*2);} templateconstexpr operator T()const{return static_cast(*this);} templateconstexpr bool operator==(T x)const{return static_cast(*this)==x;} constexpr auto operator-()const{return infinity();} templateconstexpr operator pair()const{return pair{*this,*this};} }; constexpr infinity oo; void lin(auto&...a){(cin>>...>>a);} templatevoid pp(const auto&...a){ll n=sizeof...(a);((cout<0,c)),...);cout<auto rle(const vec&a){vec>r;fe(a,e)r.size()&&e==r.back().a?++r.back().b:r.eb(e,1).b;return r;} templateauto rce(veca){return rle(sort(a));} uint64_t kth_root_floor(uint64_t a,ll k){ if (k==1)return a; auto is_within=[&](uint32_t x){uint64_t t=1;fo(k)if(__builtin_mul_overflow(t,x,&t))return false;return t<=a;}; uint64_t r=0; of(i,sizeof(uint32_t)*CHAR_BIT)if(is_within(r|(1u<>9;ll t=a;return l>64; return r>=N?r-N:r; } auto&operator+=(const montgomery64&b){if((a+=b.a)>=N)a-=N;return*this;} auto&operator-=(const montgomery64&b){if(i64(a-=b.a)<0)a+=N;return*this;} auto&operator*=(const montgomery64&b){a=reduce(u128(a)*b.a);return*this;} auto&operator/=(const montgomery64&b){*this*=b.inv();return*this;} auto operator+(const montgomery64&b)const{return montgomery64(*this)+=b;} auto operator-(const montgomery64&b)const{return montgomery64(*this)-=b;} auto operator*(const montgomery64&b)const{return montgomery64(*this)*=b;} auto operator/(const montgomery64&b)const{return montgomery64(*this)/=b;} bool operator==(const montgomery64&b)const{return a==b.a;} auto operator-()const{return montgomery64()-montgomery64(*this);} montgomery64 pow(u128 n)const{ montgomery64 r{1},x{*this}; while(n){ if(n&1)r*=x; x*=x; n>>=1; } return r; } montgomery64 inv()const{ u64 a=this->a,b=N,u=1,v=0; while(b)u-=a/b*v,swap(u,v),a-=a/b*b,swap(a,b); return u; } u64 val()const{ return reduce(a); } friend istream&operator>>(istream&i,montgomery64&b){ ll t;i>>t;b=t; return i; } friend ostream&operator<<(ostream&o,const montgomery64&b){ return o<bool miller_rabin(ll n,vecas){ ll d=n-1; while(~d&1)d>>=1; if((ll)modular::mod()!=n)modular::set_mod(n); modular one=1,minus_one=n-1; fe(as,a){ if(a%n==0)continue; ll t=d; modular y=modular(a).pow(t); while(t!=n-1&&y!=one&&y!=minus_one)y*=y,t<<=1; if(y!=minus_one&&~t&1)return 0; } return 1; } bool is_prime(ll n){ if(~n&1)return n==2; if(n<=1)return 0; if(n<4759123141LL)return miller_rabin(n,{2,7,61}); return miller_rabin(n,{2,325,9375,28178,450775,9780504,1795265022}); } templatell pollard_rho(ll n){ if(~n&1)return 2; if(is_prime(n))return n; if((ll)modular::mod()!=n)modular::set_mod(n); modular R,one=1; auto f=[&](const modular&x){return x*x+R;}; while(1){ modular x,y,ys,q=one; R=rand(2,n),y=rand(2,n); ll g=1; constexpr ll m=128; for(ll r=1;g==1;r<<=1){ x=y; fo(r)y=f(y); for(ll k=0;g==1&&k{}; ll d=pollard_rho(m); return d==m?vec{d}:f(f,d)^f(f,m/d); }; return rce(f(f,n)); } ll mobius_prime_pow(ll,int8_t k,ll){return-(k==1);} ll mobius(ll n){ll r=1;fe(factorize(n),p,q)r*=mobius_prime_pow(p,q,pw(p,q));return r;} struct linear_sieve{ ll n; veclpf; veclpf_ord; veclpf_pow; veclpf_pow_except; vecprimes; linear_sieve(ll n):n(n){ lpf.resize(n+1,-1); lpf_ord.resize(n+1); lpf_pow.resize(n+1); lpf_pow_except.resize(n+1); lpf[1]=lpf_ord[1]=lpf_pow[1]=lpf_pow_except[1]=1; fo(i,2,n+1){ if(lpf[i]==-1)primes.eb(lpf[i]=i); fe(primes,p){ if(p*i>n||p>lpf[i])break; lpf[p*i]=p; } ll j=i/lpf[i]; lpf_ord[i]=lpf_ord[j]*(lpf[i]==lpf[j])+1; lpf_pow[i]=((lpf_pow[j]-1)*(lpf[i]==lpf[j])+1)*lpf[i]; lpf_pow_except[i]=i/lpf_pow[i]; } } auto multiplicative_function_enumerate(const auto&f)const{ vecr(n+1); r[1]=1; fo(i,2,n+1)r[i]=f(lpf[i],lpf_ord[i],lpf_pow[i])*r[lpf_pow_except[i]]; return r; } auto mobius_enumerate()const{return multiplicative_function_enumerate(mobius_prime_pow);} }; ll square_free_count(ll n){ ll I=kth_root_floor(n,5); ll x_I=sqrt_floor(n/I); auto mobius=linear_sieve(x_I).mobius_enumerate(); auto mertens=mobius.zeta(); ll S1=0; fo(i,1,x_I+1)S1+=mobius[i]*(n/(i*i)); vecmertens_x(I); of(i,I,1){ mertens_x[i]=1; quotient_range_fe(sqrt_floor(n/i),y,l,r){ if(l==1)continue; mertens_x[i]-=(y<=x_I?mertens[y]:mertens_x[l*l*i])*(r-l); } } ll S2=mertens_x.sum()-(I-1)*mertens[x_I]; return S1+S2; } single_testcase void solve(){ LL(L,R);++R; pp(square_free_count(R-1)-square_free_count(L-1)); }}