Microsoft Small Basic

Program Listing: XHS673
'created by aabproducoes.peperonity.com
'Antonio Augusto Barbaro
'aabproducoes.cwap.me
'aabproducoes.mywapblog.com (SB)
'facebook.com/antonio.augusto.9444023
'aaugusto444@gmail.com
GraphicsWindow.Title="Spiral Prime Numbers v0.1"
GraphicsWindow.Top=(Desktop.Height-GraphicsWindow.Height)/2 'center x
GraphicsWindow.Left=(Desktop.Width-GraphicsWindow.Width)/2 'center y
GraphicsWindow.CanResize=0
gw= GraphicsWindow.Width
gh= GraphicsWindow.Height
cx= gw/2
cy= gh/2
bw= 20 'shapes width and height
nang=200
supang=math.Round(GraphicsWindow.Width/bw/2)+2
GraphicsWindow.PenWidth=0
colour="1=Blue;2=Green;"
For j=2 To (supang*nang)
angle= j*Math.Pi/(nang/2)-Math.Pi/2
If XMath.PrimeFactors(j)=j Then
GraphicsWindow.BrushColor=colour[1]
Else
GraphicsWindow.BrushColor=colour[2]
EndIf
px= cx+(j/bw*2)*Math.Cos(angle)
py= cy+(j/bw*2)*Math.Sin(angle)
ell[j]= Shapes.AddEllipse(bw,bw)
Shapes.Move(ell[j],px-(bw/2),py-(bw/2))
EndFor