Problem 60784. Indicate how the Prague astronomical clock strikes the hours

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

100.0% Correct | 0.0% Incorrect
Last Solution submitted on Jan 30, 2025

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers5

Suggested Problems

More from this Author291

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!