f=[0,1] r='' for i in range(99):f+=[f[i]+f[i+1]];r+=str(f[i]) r=r.replace('215','25') s=[['']*24 for i in[0]*24] x,y=11,12 s[x][x]=d=0 a=[0,1,0,-1] z=2 i=c=1 while 0<=y: if c==z//2:d=(d+1)%4;c=0;z+=1 s[x][y]=r[i];x+=a[d];y+=a[(d+1)%4];i+=1;c+=1 for l in s:print(*l)

Note that non-ascii characters in the above source code will be escaped (such as \x9f).