Generate the snowflake pattern sequence
I define aA snowflake pattern as a series of rings. Each ring has a certain number of points, with the following restrictionsfigure looks like this:
A few rules govern how many points each ring can have.
- The innermost ring must have between 1 and 8 inclusive points.
- Every other ring must have between 2 and 8 inclusive points.
- EveryTo ensure symmetry, every ring must have a integer multiple times as many points as the next smallest ring.
Valid snowflake sequences, from the smallest to the largest ring, include: 1,2,2,6
, 2,4,8
, 3,6
, 8,8,8,8,8
, etc.
Your task is, given a number, output a snowflake sequence with that total numberthe best configuration of pointsrings.
If there are multiple solutions, find the most aesthetically pleasing one as follows:
- The one with the most unique ring sizes
- Unique ring sizes being equal, the one with the biggest smallest ring. Eg.
2,6
is better than1,7
. - If the unique ring sizes and smallest ring are both equal, output the one with the smallest total number of rings.
If there are still multiple options, you may choose one arbitrarily.
Test Cases
Number | Pattern | Image |
---|---|---|
1 | 1 |
|
2 | 2 |
|
3 | 1,2 |
|
4 | 1,3 |
|
5 | 1,4 |
|
6 | 2,4 |
|
7 | 1,2,4 |
|
8 | 2,6 |
|
9 | 1,2,6 |
|
10 | 1,3,6 |
|
11 | 1,2,8 |
|
12 | 4,8 |
|
13 | 1,4,8 |