#include "bits/stdc++.h"
using namespace std;
const int N = 5e6 + 5 ;
int h[ N] ;
vector < int > spf, primes;
void RunLinearSieve( ) {
int n = N;
spf.assign ( n + 1 , 0 ) ;
for ( int i = 2 ; i < n; ++ i) {
if ( ! spf[ i] ) {
spf[ i] = i;
primes.push_back ( i) ;
}
for ( int x : primes) {
int calc = i * x;
if ( x > spf[ i] || calc > n) {
break ;
}
spf[ calc] = x;
}
}
primes.clear ( ) ;
for ( int j = 2 ; j < N; ++ j) {
int let = j, cnt( 0 ) ;
while ( let ! = 1 ) {
let / = spf[ let] ;
++ cnt;
}
h[ j] = cnt + h[ j- 1 ] ;
}
}
inline void solve( ) {
int a, b;
cin >> a >> b;
if ( a == b) {
cout << "0\n " ;
return ;
}
int t = a - b;
cout << h[ a] - h[ a- t] << '\n ' ;
}
signed main( ) {
ios_base:: sync_with_stdio ( 0 ) ;
cin .tie ( NULL ) ;
cout .tie ( NULL ) ;
int t = 1 ;
RunLinearSieve( ) ;
cin >> t; while ( t-- )
solve( ) ;
return 0 ;
}
I2luY2x1ZGUgImJpdHMvc3RkYysrLmgiCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CsKgCmNvbnN0IGludCBOID0gNWU2ICsgNTsKwqAKaW50IGhbTl07CnZlY3RvciA8IGludCA+IHNwZiwgcHJpbWVzOwrCoAp2b2lkIFJ1bkxpbmVhclNpZXZlKCkgewoJaW50IG4gPSBOOwoJc3BmLmFzc2lnbihuICsgMSwgMCk7Cglmb3IoaW50IGkgPSAyOyBpIDwgbjsgKytpKSB7CgkJaWYoIXNwZltpXSkgewoJCQlzcGZbaV0gPSBpOwoJCQlwcmltZXMucHVzaF9iYWNrKGkpOwoJCX0KCQlmb3IoaW50IHggOiBwcmltZXMpIHsKCQkJaW50IGNhbGMgPSBpICogeDsKCQkJaWYoeCA+IHNwZltpXSB8fCBjYWxjID4gbikgewoJCQkJYnJlYWs7CQkJCQoJCQl9CgkJCXNwZltjYWxjXSA9IHg7CgkJfQoJfQoJcHJpbWVzLmNsZWFyKCk7Cglmb3IgKGludCBqID0gMjsgaiA8IE47ICsraikgewoJCWludCBsZXQgPSBqLCBjbnQoMCk7CgkJd2hpbGUgKGxldCAhPSAxKSB7CgkJCWxldCAvPSBzcGZbbGV0XTsKCQkJKytjbnQ7CgkJfQoJCWhbal0gPSBjbnQgKyBoW2otMV07Cgl9Cn0KaW5saW5lIHZvaWQgc29sdmUoKSB7CglpbnQgYSwgYjsKCWNpbiA+PiBhID4+IGI7CglpZiAoYSA9PSBiKSB7CgkJY291dCA8PCAiMFxuIjsKCQlyZXR1cm47Cgl9CglpbnQgdCA9IGEgLSBiOwoJY291dCA8PCBoW2FdIC0gaFthLXRdIDw8ICdcbic7Cn0KwqAKc2lnbmVkIG1haW4oKSB7CiAgICBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKDApOwogICAgY2luLnRpZShOVUxMKTsKICAgIGNvdXQudGllKE5VTEwpOwogICAgaW50IHQgPSAxOwogICAgUnVuTGluZWFyU2lldmUoKTsKICAgIGNpbiA+PiB0OyB3aGlsZSh0LS0pCiAgICAgICAgICAgICAgICBzb2x2ZSgpOwogICAgcmV0dXJuIDA7Cn0=
compilation info
prog.cpp:3:1: error: stray ‘\302’ in program
^
prog.cpp:3:2: error: stray ‘\240’ in program
^
prog.cpp:5:1: error: stray ‘\302’ in program
^
prog.cpp:5:2: error: stray ‘\240’ in program
^
prog.cpp:8:1: error: stray ‘\302’ in program
^
prog.cpp:8:2: error: stray ‘\240’ in program
^
prog.cpp:45:1: error: stray ‘\302’ in program
^
prog.cpp:45:2: error: stray ‘\240’ in program
^
stdout