Solution:
Because we only care about when the ratio of A to B is an integer, the value of the first term in S does not matter. Let the initial term in S be 1. Then, we can write S as 1,r,r2,…,r2019. Because all terms are in terms of r, we can write A=ra and B=rb. We will now solve for a and b.
Observe that the geometric mean of two terms rm and rn is simply r2m+n, or r raised to the arithmetic mean of m and n. Thus, to solve for a, we can simply consider the sequence 0,1,2,…,2019, which comes from the exponents of the terms in S, and repeatedly replace the smallest two terms with their arithmetic mean. Likewise, to solve for b, we can consider the same sequence 0,1,2,…,2019 and repeatedly replace the largest two terms with their arithmetic mean.
We begin by computing a. If we start with the sequence 0,1,…,2019 and repeatedly take the arithmetic mean of the two smallest terms, the final value will be
a=2220+1+2+3+⋯+2019=k=1∑20192k222020−k
Then, we can compute
2a⟹a=k=1∑201922019−kk=2a−a=k=1∑201922019−kk−k=1∑201922020−kk=k=1∑201922019−kk−k=0∑201822019−kk+1=2019−j=1∑20192j1=2019−(1−220191)=2018+220191
Likewise, or by symmetry, we can find b=1−220191.
Since we want BA=rbra=ra−b to be a positive integer, and a−b=(2018+220191)−(1−220191)=2017+220181, r must be a perfect (22018)th power. Because r>1, the minimal possible value is r=222018. Thus, d=22018+1, and so log2d is clearly closest to 2018.