A polygonal number is a number represented as dots or pebbles arranged in the shape of a regular polygon. Namely, it is "a type of figurate number which is a generalization of triangular, square, etc., numbers to an arbitrary n-gonal number".
The following diagrams taken from mathworld.wolfram.com graphically illustrate the process by which the polygonal numbers are built up. We can call them the Corner polygonal numbers, (i.e. growing from the dot in the corner).
Each of the above types of numbers has a cousin of sorts, which is called the Centered polygonal numbers. There each formed by a central dot (See the below diagrams).
Q: How to systematically generate the points (dots) arranged in the above Corner and Centered polygonal diagrams? Also the corresponding polygonal diagrams?
one simple example for certered square, i.e. n=4 (maybe one can directly create pts
):
n = 4; (*3: triangle; 4: square; etc*)
pts =Flatten[Table[{r*Sin[2 Pi k/n], r*Cos[2 Pi k/n]}, {k, n}, {r, 0.1, 0.3, 0.1}], 1];
pts1={{0, 0}, {0.1, 0.1}, {0.1, 0.2}, {0.2, 0.1}, {-0.1, 0.1}, {-0.1, 0.2}, {-0.2, 0.1}, {0.1, -0.1}, {0.1, -0.2}, {0.2, -0.1}, {-0.1, -0.1}, {-0.1, -0.2}, {-0.2, -0.1}};
pts = Join[pts, pts1];
Graphics[{PointSize[Large], Point[pts]}]