The astronomical clock in Prague has a bell that rings 1, 2, 3, or 4 times. The number of strokes follows the sequence 1234321234321…, and for the nth hour, the total number of strokes is n. So, during a day, the patterns are 1, 2, 3, 4, 32, 123, 43, 2123, 432, 1234, 32123, 43212, 34321, 23432, 123432, 1234321, 2343212, 3432123, 4321234, 32123432, 123432123, 43212343, 2123432123, and 432123432.
Write a function to produce the pattern for a given number of hours. Assume that the rules hold for hours beyond 24.

Photo linked from amazingczechia.com
Solution Stats
Problem Comments
3 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers5
Suggested Problems
More from this Author321
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
Apparently my solution "was marked as potential spam and was not posted", and will now be reviewed by administrators.
I wonder what triggered that - or whether Cody shouldn't have a "we're pretty sure this isn't a spammer" flag for established users, to be set by admins at their discretion or perhaps awarded based on problems solved, points earned or so.
Even I am not sure why your solution was flagged as spam.
I will inform and ask the Cody team about this behaviour.
I don't understand why singular answers are flagged as spam. ¯\_(ツ)_/¯
>> I don't understand why singular answers are flagged as spam.
Hey, you gotta nip these things in the bud. If people submit one solution, they might escalate to two. Do we really want to live in a world like that? :-)
It is amusing to think of a zero-tolerance Cody world in which thousands of problems sit on the server uncontaminated by solutions.