◼
  • Link to the instruction video: https://youtu.be/EpmFIBps9VU
  • ◼
  • AOPS Link
  • Out[]=
    Use logarithm to convert exponential function to linear scale
    In[]:=
    NumberLinePlot[{Range[17],Range[7]*Log2[5]},PlotLegends{TraditionalForm@Log2[2^m],TraditionalForm@Log2[5^n]}]
    Out[]=
    log(
    n
    5
    )
    log(2)
    log(
    m
    2
    )
    log(2)
    Also we notice
    In[]:=
    Log2[5.]
    Out[]=
    2.32193
    This number is between 2 and 3. Thus there are at most 3 and at least 2 integers between
    n·
    log
    2
    5
    and
    (n+1)·
    log
    2
    5
    . Because
    log
    2
    5
    is irrational, there is no known formula to find closed form for how many integers no greater than
    n·
    log
    2
    5
    . Lets take a look how the sizes of gap distributed by direct counting.
    In[]:=
    IntCount[k_]:=Floor[(k+1)*Log2[5]]-Ceiling[k*Log2[5]]+1
    In[]:=
    ListPlot[Table[IntCount[k],{k,1,50}],FillingBottom,Ticks{Automatic,{2,3}}]
    Out[]=
    To find how many integers is no greater than
    (k+1)·
    log
    2
    5
    for each k, we have
    In[]:=
    (accumList=Accumulate[Table[IntCount[k],{k,1,867}]])//Short
    Out[]//Short=
    {2,4,7,9,11,14,16,18,21,23,25,28,30,32,839,1983,1985,1987,1990,1992,1994,1997,1999,2001,2004,2006,2008,2011,2013}
    Notice that the problem asks us to find the number of n’s such that there are 3 integers between
    n·
    log
    2
    5
    and
    (n+1)·
    log
    2
    5
    . Because we already know the least number of integers in a gap is 2, we can simply compute difference between
    2n
    and all integers no greater than
    (n+1)·
    log
    2
    5
    to find the desired result.
    Wrap up everything above into a Manipulate function.
    In[]:=
    Manipulate[​​all=Table[IntCount[k],{k,1,n}];​​last=Accumulate[all][[-1]];​​StringForm["There are `1` pairs of integers (m,n) \nare there such that 1 <= m <= `2` \nsuch that 5^n < 2^m < 2^m+2 < 5^(n+1)",last-2*n,last],{n,6,867,1},SaveDefinitionsTrue]
    Out[]=
    Print valid candidates for (m,n)
    In[]:=
    Dynamic[​​resultN=(Position[all,3]//Flatten);​​resultM=Ceiling[resultN*Log[2,5]]//Flatten;Short[Transpose@{resultM,resultN}]]
    Out[]=