Warped chessboard

Canvas, 34 32 bytes

0#0⁸[#+¶+#xx*yx+m⤢αm;nlw√{y;%‽²X

Try it here!


Python 2, 217 215 212 bytes

def f(x):
 b=['1'];n=1
 for i in range(x):P=max(j*(n%j<(j<=n**.5))for j in range(1,1+n));n+=P;b=[l+P*`j/P%2^i%2`for j,l in enumerate(b)];s=len(b[0]);b+=[((v*P+`1^int(v)`*P)*s)[:s]for v in b[0][len(b):]]
 return b

Try it online!

0-indexed, uses 0 and 1 as characters


Python 2, 184 178 176 169 bytes

def h(j,a=['1'],R=range):
 for i in R(j):L=len(a);k=max(x for x in R(1,L+1)if(x*x<=L)>L%x);a=[a[m]+k*`(i+m/k)%2`for m in R(L)]+[((`i%2`*k+`~i%2`*k)*L)[:L+k]]*k
 return a

Try it online!

Uses 1, 0 for #, -; uses 0-indexing.