Narcissistic decimal number: Difference between revisions
m
→{{header|AppleScript}}: Updated preamble.
m (→{{header|AppleScript}}: "Natively written" solution modified to store digit collections as numbers instead of lists, incidentally finding results in order without needing a sort. Also reprefaced, and reheadered.) |
m (→{{header|AppleScript}}: Updated preamble.) |
||
Line 246:
{{Trans|JavaScript}}
{{Trans|Haskell}}
AppleScript is a little out of its depth here,
The full 7 digit search that finds the 25th number takes nearly 14 minutes on the system here (four seconds to scan the 5 digit combinations, and find the first 20, and 103 seconds to scan the six digit combinations for the first 21 narcissi).▼
▲
▲(For comparison, equivalent code in JavaScript for Automation – the alternative idiom for osascript use on macOS – returns all 25 numbers in about 120 milliseconds).
For an imperative hand-optimisation, and a contrasting view, see below :-)
<lang AppleScript>-- NARCISSI -------------------------------------------------------------------
|