Permuted multiples: Difference between revisions

→‎{{header|AppleScript}}: Additional edit to preamble.
(→‎{{header|AppleScript}}: Woke up realising that six permutations of the same digits requires the numbers to have at least three digits each.)
(→‎{{header|AppleScript}}: Additional edit to preamble.)
Line 9:
 
=={{header|AppleScript}}==
{{trans|Phix}} — except that the 'steps' figure here is cumulative. Also, for six different numbers to have the same digits, each must have at least three digits, none of which can be 0. So the smallest possible value of n is 123. 6 times that is 738, which still doesn't fit the bill, but you have to start somewhere. 'Steps' are the number of 'n's actually tried when n * 6 doesn't exceed the next power of 10. While no power of 10 is exactly divisible by 6, it ''is'' technically the point at which the number of digits increases, so I've pedantically adjusted the logic to reflect this. :) The number of steps between 100,000 and the final arrival at 142,857 is 14,286, which is interesting.
<lang applescript>use AppleScript version "2.3.1" -- Mac OS X 10.9 (Mavericks) or later.
use sorter : script "Insertion Sort" -- <https://www.rosettacode.org/wiki/Sorting_algorithms/Insertion_sort#AppleScript>
557

edits