/***********************************************************
cprimes -- Gauss (ガウス) の整数
***********************************************************/
#N88BASIC

Const N = 39
Const SQRTN = 6 /* floor(sqrt(N)) */

Dim a[N,N] As Char

Dim i As Long, j As Long, p As Long, q As Long, x As Long, y As Long

For i=0 To N
For j=0 To N
a[i,j] = 1
Next
Next

a[0,0] = 0:a[1,0] = 0:a[0,1] = 0


For i = 1 To SQRTN
For j = 0 To i
If (a[i,j]) Then
p = i: q = j
Do
x = p: y = q
Do
a[x,y] = 0:a[y,x] = 0
x = x - j
y = y + i
Loop While (x >= 0) And (y <= N)
x = p: y = q
Do
a[x,y] = 0:a[y,x] = 0
x = x + j
y = y - i
Loop While (x <= N) And (y >= 0)
p = p +i: q = q + j
Loop While (p <= N)
a[i,j] = 1:a[j,i] = 1
End If
Next
Next
For i = -N To N
For j = -N To N
If (a[Abs(i),Abs(j)] And (i * i + j * j) <= N * N) Then
Print "*";
Else
Print " ";
End If
Next
Print ""
Next