Numbers of Armstong WP34s
|
07-30-2018, 12:58 AM
Post: #8
|
|||
|
|||
RE: Numbers of Armstong WP34s
I had solved Armstrong Numbers problem many years ago.
It searched all Armstrong Numbers (digits > 1) in 6 minutes on my laptop. That is a huge 10^60 search space ! This is the gist of my routine: If pattern 543 is checked, other permutations (345, 354, 435, 453, 534) can be skipped. All permutations is going to produce the same sum anyway. So, 1 check = 3! = 6 tests Digits pattern not reached 3 digits can be skipped: 100 110 111, 200, 210, 211, 220, ..., 432 Sum of over 3-digits can also be skipped: 964, 965, 966, 970, 971 ..., 988, 990, ... 999 Patterns to check = 433, 440, 441 ..., 963 (*) The trick is to design how the pattern incremented. You can guess the algorithm from above example. Have you seen it ? Combinatorial problem is fun ! :-) (*) my code actually search to 988 To speed up the code, it need a simple test for endpoint. So, the loop stop if the next pattern had too many 9's in it. |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Numbers of Armstong WP34s - ggauny@live.fr - 11-30-2015, 07:02 PM
RE: Numbers of Armstong WP34s - Thomas Klemm - 11-30-2015, 08:27 PM
RE: Numbers of Armstong WP34s - Dave Frederickson - 11-30-2015, 09:21 PM
RE: Numbers of Armstong WP34s - ggauny@live.fr - 12-01-2015, 06:35 AM
RE: Numbers of Armstong WP34s - Thomas Klemm - 12-01-2015, 10:11 AM
RE: Numbers of Armstong WP34s - ggauny@live.fr - 12-01-2015, 11:14 AM
RE: Numbers of Armstong WP34s - Thomas Klemm - 12-01-2015, 01:07 PM
RE: Numbers of Armstong WP34s - Albert Chan - 07-30-2018 12:58 AM
|
User(s) browsing this thread: 4 Guest(s)