Phases of the Clock Moon Numbers
We can imagine all the factors of a number. For example 7 has factors 1 and 7. 12 has factors 1, 2, 3, 4, 6, and 12. 9 has factors 1, 3, and 9.
We can also imagine that a number has a position on the edge of a wheel or circular face. Let us divide our circle into 12 pieces around the edge evenly. In fact, we can call this a clock face. Human culture has settled on most clock faces having 12 numbers.
Therefore, we can imagine creating hands on a clock face for an integer that we have been given, like 7. Each hand can be imagined as a nice, easily visible line drawn from the center of the circle to the position of the number on the edge of the circle. We can also imagine creating hands on the face for all of that integer's factors, like 1 and 7. Now, we can imagine the clock face with hands at each factor. 1 and 7 for 7. This clock face now has 2 hands.
The number 9 will have 3 hands, at 1, 3, and 9.
The number 10 will have 4 hands, at 1, 2, 5, and 10.
The number 12 will have 5 hands, at 1,2,3,6, and 12.
The number 13... er... well, in that case, we use modular arithmetic. The number 12 becomes 1. In mathematical language, we might say the number 13 modulo 12 is 1. Another way to say this is that the remainder of 13 divided by 12 is 1. We could also say that 13 is congruent to 1, modulo 12.
At any rate, our imaginary clock face for the number 13 will have hands at 1 and.... 1. Now, we will say that the two hands are redundant, so it actually only has one hand, pointing to the position 1.
The number 14 will have 4 hands, at 1, 2, 7, and... 2. So actually just three hands.
Now, you may notice a pattern here. Some numbers generate a clock face with hands clustered together around the right hand side of the face, like 6 with 1, 2, 3. Other numbers seem to have hands all over the face, spread more evenly, like 20 with 1, 2, 4, 5, 10, 8. And we can go further - some numbers like 77 will only have their hands on the left-ish side of the face, at 7 and 11.
To make it even easier, let's rotate the clock anti-clockwise by one hour, so the number 1 is straight up and the number 7 is straight down.
Let us give these patterns names.
Numbers like 1, and 13, with only one clock hand: Full
Numbers with clock hands only on the left, like 77: First South Quarter
Numbers with clock hands only on the right, like 6: Last South Quarter
Numbers with clock hands on all sides, like 20 (10,5,2,1,8): New
Write a program that given some number n, returns it's phase, and how many other numbers have that same phase, but are smaller than n.
For example 13 has the phase Full, and there is 1 other number below it, so the result should be "Full 1"
2, 3, 4, 5, and 6 are all phase Last South Quarter, so they would be
"LSQ 0" "LSQ 1", "LSQ 2", "LSQ 3", "LSQ 4"
7 has phase First South Quarter, and in fact is the first such number, so it will be "FSQ 0".
8 has factors 4, 2, and 1, which are on both the left and right side, so it's phase is New. It's the first full number, so "New 0"