All Armstrong numbers An Armstrong number (AKA Plus Perfect number, or narcissistic number) is a number which is equal to its sum of n-th power of the digits, where n is the number of digits of the number.

For example, 153 has 3 digits, and 153 = 1^3 + 5^3 + 3^3, so 153 is an Armstrong number.

For example, 8208 has 4 digits, and 8208 = 8^4 + 2^4 + 0^4 + 8^4, so 8208 is an Armstrong number.

On 14th Nov 2013, we tested if a number is an Armstrong number.

Now, we would like to list all Armstrong numbers. There are exactly 88 Armstrong numbers:

1
2
3
4
5
6
7
8
9
153
370
371
407
1634
8208
9474
54748
92727
93084
548834
1741725
4210818
9800817
9926315
24678050
24678051
88593477
146511208
472335975
534494836
912985153
4679307774
32164049650
32164049651
40028394225
42678290603
44708635679
49388550606
82693916578
94204591914
28116440335967
4338281769391370
4338281769391371
21897142587612075
35641594208964132
35875699062250035
1517841543307505039
3289582984443187032
4498128791164624869
4929273885928088826
63105425988599693916
128468643043731391252
449177399146038697307
21887696841122916288858
27879694893054074471405
27907865009977052567814
28361281321319229463398
35452590104031691935943
174088005938065293023722
188451485447897896036875
239313664430041569350093
1550475334214501539088894
1553242162893771850669378
3706907995955475988644380
3706907995955475988644381
4422095118095899619457938
121204998563613372405438066
121270696006801314328439376
128851796696487777842012787
174650464499531377631639254
177265453171792792366489765
14607640612971980372614873089
19008174136254279995012734740
19008174136254279995012734741
23866716435523975980390369295
1145037275765491025924292050346
1927890457142960697580636236639
2309092682616190307509695338915
17333509997782249308725103962772
186709961001538790100634132976990
186709961001538790100634132976991
1122763285329372541592822900204593
12639369517103790328947807201478392
12679937780272278566303885594196922
1219167219625434121569735803609966019
12815792078366059955099770545296129367
115132219018763992565095597973971522400
115132219018763992565095597973971522401


Your task is to output exactly the list above.

Flexibility

The separator does not have to be be a line-break, but the separator must not contain any digit.

A trailing separator at the end of the output is optional.

Also, your code must terminate before the heat death of the universe in a reasonable amount of time (say, less than a day).

You may hard-code the result or any part thereof.

References


Obligatory OEIS A005188
CJam, 626 397 325 218 168 134 93 55 54 53 bytes

8A#{[_8b3394241224Ab?A0e[A,]ze~__,f#:+s_$@s=*~}%$1&gt;N*


Execution takes roughly four and a half hours on my machine. One Armstrong number is hardcoded, the remaining ones are computed.

Computing all Armstrong numbers is theoretically possible in 24 hours, but the approach

9A#{_9b8 9erA0e[A,]ze~__,f#:+s_$@s=*~}%$1&gt;N*


drives the garbage collector nuts. So far, all settings I've tried resulting either in a GC error message or too much memory consumption.

How it works

8A#              e# Compute 8¹⁰ = 1,073,741,824.
{                e# Map the following block over all I in [0 ... 1,073,741,824].
  [              e#   Begin an array.
    _8b          e#     Copy I and convert the copy to base 8.
    3394241224Ab e#     Push [3 3 9 4 2 4 1 2 2 4], the representation of the
                 e#     Armstrong number 1122763285329372541592822900204593.
    ?            e#     If I is non-zero, select the array of base 8 digits.
                 e#     Otherwise, select the hardcoded representation.
    A0e[         e#     Left-pad the digit array with 0's to length 10.
    A,           e#     Push [0 1 2 3 4 5 6 7 8 9].
  ]              e#   End the array.
  ze~            e#   Transpose and perform run-length decoding, repeating the
                 e#   digit n k times, where k in the n-th entry of the repr.
                 e#   This is a potential Armstrong number, with sorted digits.
  _              e#   Push a copy.
  _,             e#   Compute the length of yet another copy.
  f#             e#   Elevate all digits to that power.
  :+s            e#   Add the results and cast to string.
  _$             e#   Push a sorted copy.
  @s             e#   Stringify the sorted digits.
  =*             e#   Compare for equality and repeat the string that many times.
                 e#   This pushes either the representation of an Armstong number
                 e#   or an empty string.
  ~              e#   Evaluate, pushing the number or doing nothing.
}%               e#
$1&gt;              e# Sort and remove the lowest number (0).
N*               e# Join, separating by linefeeds.