This just shows the reduced residues mod n. There are n squares in the nth row from the top. Color the kth square of the nth row black if gcd(k,n)=1, color it red otherwise.
Isn't it plotting a prime spiral, not GCD?
Obviously prime implies gcd=1, but the "kth" square isn't "k", because it's a spiral counting up from the center.