#include <bits/stdc++.h>

using namespace std;

#define GO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

#define endl '\n'

//pipe sign |

typedef long long ll;




int sps(int a,int b,int sum)
{
    while(a)
    {
        a/=b;
        sum++;
    }
    return sum;
}

int main()
{
    GO

    int t;
    cin>>t;
    int z,x;

    while(t--)
    {
        cin>>z>>x;
        int s=0;
        if(!z/x)
        {
            cout<<1<<endl;
            continue;
        }
        if(x==1)
        {
            x++;
            s++;
        }

        int result=sps(z,x,s);

        for(int i=1;i<=10;i++)
        {
            x++;
            s++;
            result=min(sps(z,x,s) , result ) ;
        }
        cout<<result<<endl;
    }


    return 0;
}
