Draw centered polygonal numbers A centered polygonal number is able to be put into an arrangement of multiple concentric polygons, each with a side length of one more than the inner one. For example (image from linked page),

the above image has 31 dots, so 31 is a centered pentagonal number.
Write a program which receives a number as input (any typical input method is fine), and displays a picture similar to the above.
In particular:

There must be a centered dot.
Each concentric polygon contains an increasing number of dots, all connected through a line.
The angles must be correct for the appropriate regular polygon.
The distance between connected dots must be the same throughout the picture.
Each polygon must be centered inside the surrounding polygon.

The input will be between 2 and 1000, and is guaranteed to be a centered polygonal number of some kind.
If there are multiple possible solutions, display them all. For example, an input of 181 should display both a centered square (of 9 &quot;rings&quot;) and a centered pentagon (of 8 &quot;rings&quot;).
No hardcoding answers.
HTML + JS, 913 857 675 bytes

(Line breaks are added for readability)

&lt;body&gt;&lt;script&gt;
function O(X,x,y,R){X.beginPath();X.arc(x,y,R,0,M.PI*2,true);X.closePath();X.fill()}
Z=300,P=3,H=Z/2,$=+prompt(),M=Math;for(S=3;S&lt;$;S++){for(C=1;C&lt;30;C++){if(S*C*C+S*C+2==$*2){
V=document.createElement("canvas");V.width=V.height=Z;document.querySelector("body").appendChild(V);X=V.getContext("2d");
O(X,H,H,P);for(R=1;R&lt;=C;R++){
D=[],A=R*(H-P)/C,G=0;X.beginPath();X.moveTo(H+A,H);D.push([H+A,H]);for(s=1;s&lt;S;s++){x=M.cos(G+=M.PI*2/S)*A,y=M.sin(G)*A;X.lineTo(H+x,H+y);D.push([H+x,H+y])}X.closePath();X.stroke();
for(j=0;j&lt;D.length;j++){x=D[j][0],y=D[j][1],q=D[(j+1)%S][0]-x,w=D[(j+1)%S][1]-y;O(X,x,y,P);for(k=0;k&lt;R-1;k++)O(X,x+=q/R,y+=w/R,P)}
}break}}}
&lt;/script&gt;&lt;/body&gt;


This is working jsfiddle example, and ungolfed source. It gets input from prompt(). You can adjust output size by adjusting sz = 300, and dot size by pt = 3 (in pixels).

Example (31 dots)