Solution:
We claim that the required sum is 20.
Let Tk denote the set of all lattice points in the circle x2+y2=k2. We claim that ∑d∣k∣Sd∣=∣Tk∣. Indeed, given a point (x,y) in Tk, let g=gcd(x,y). Then x/g,y/g are necessarily coprime, and hence (x/g,y/g) visible, and (x/g)2+(y/g)2=(k/g)2. This implies (x/g,y/g)∈⋃d∣kSd. Next, note that the Sd's are necessarily disjoint. Now if (x′,y′) is a visible lattice point in Sd where d∣k, then we can write k=gd so that (x,y)=(gx′,gy′) is a lattice point in Tk. This establishes a bijection between ⋃d∣kSd and Tk, and since the Sd's are disjoint, the claim follows.
From the claim, it suffices to find the number of lattice points in the circle x2+y2=(2021⋅2025)2. This is equivalent to
x2+y2=38⋅54⋅432⋅472
Now it is well-known that if x2+y2≡0(modp) where p≡3(mod4) is a prime, then x≡y≡0(modp). Thus, we must also have x,y≡0(mod34⋅43⋅47). It then follows that the number of lattice points is the same as the number of lattice points in x2+y2=252.
If x=0 or y=0, there are 4 solutions. Otherwise, assume WLOG that they are both positive. Now it is well-known that all solutions to x2+y2=z2 are in the form x=g(m2−n2), y=2gmn, and z=g(m2+n2), where m>n are coprime positive integers, and g is a positive integer. Thus, we want g(m2+n2)=25. Note that g∣25, so g=1,5,25.
If g=25, then m2+n2=1, so n=0, contradiction. If g=5, then m2+n2=5, which yields m=2 and n=1 and thus g(m2−n2)=15 and 2gmn=20, so (x,y)=(15,20),(20,15). If g=1, then we get m2+n2=25, from which we obtain m=4 and n=3. It then follows that (x,y)=(24,7),(7,24), and so we have 2 solutions when x,y are both positive. This implies that there are 4⋅4=16 solutions when x,y are nonzero, and so there are 4+16=20 solutions in total.