Just to set a baseline, I edited my Fibonacci shortcut to exclude any optimizations. The timing result was 130 milliseconds, which is only a bit slower than the two-shortcut solution. I guess the bottom line is to test and use whatever works best.
Another optimization approach is to limit the number of repeat loops to the exact number required. Google AI provided a formula that works with my Fibonacci shortcut, and the timing results (in milliseconds) are shown below. The new shortcut is not limited in the size of the maximum number.
Max Number
Old Shortcut
New Shortcut
10
126
42
100
127
64
1000
127
85
10000
126
105
100000
127
125
1000000
127
140
The following screenshot only shows a portion of the shortcut.
I rewrote the shortcut mentioned above to use a Text action instead of a Dictionary action to store the window data (position and size). This isn’t any faster but seems a simpler approach to enter the window data.
The following is a helper shortcut that can be used to get the window data for use in the App Arrange shortcut. For a simple task, it does too much, but I wanted to test solutions to a few items (like the off-center stuff).
A few days ago, I happened to watch a YouTube video on the Collatz Conjecture, which is described by Wikipedia as follows:
The Collatz conjecture is one of the most famous unsolved problems in mathematics. The conjecture asks whether repeating two simple arithmetic operations will eventually transform every positive integer into 1. It concerns sequences of integers in which each term is obtained from the previous term as follows: if a term is even, the next term is one half of it. If a term is odd, the next term is 3 times the previous term plus 1. The conjecture is that these sequences always reach 1, no matter which positive integer is chosen to start the sequence. The conjecture has been shown to hold for all positive integers up to 2.36×1021, but no general proof has been found.
I thought this might be an interesting learning project for a shortcut, and I’ve included that below. The simple (and only) purpose of this shortcut is to determine the number of Collatz Conjecture calculations required for a specified start number and to view the result of every calculation.
When the shortcut is first installed, the user is prompted for the folder that will contain a text file with calculation results. The first release candidate of macOS 27.0 has a bug that prevents this from working correctly.
I edited the above shortcut to use the shell to perform the calculations. This works with large numbers, so the shortcut does not set a maximum number of allowed calculations.