A   Narcissistic decimal number   is a non-negative integer,   



n


{\displaystyle n}

,   that is equal to the sum of the   



m


{\displaystyle m}

-th   powers of each of the digits in the decimal representation of   



n


{\displaystyle n}

,   where   



m


{\displaystyle m}

   is the number of digits in the decimal representation of   



n


{\displaystyle n}

.



Narcissistic (decimal) numbers are sometimes called   Armstrong   numbers, named after Michael F. Armstrong.

They are also known as   Plus Perfect   numbers.



An example

   if   



n


{\displaystyle n}

   is   153 
   then   



m


{\displaystyle m}

,   (the number of decimal digits)   is   3 
   we have    13 + 53 + 33   =   1 + 125 + 27   =   153  
   and so   153   is a narcissistic decimal number


Task

Generate and show here the first   25   narcissistic decimal numbers.



Note:   




0

1


=
0


{\displaystyle 0^{1}=0}

,   the first in the series.



See also

   the  OEIS entry:     Armstrong (or Plus Perfect, or narcissistic) numbers.
   MathWorld entry:   Narcissistic Number.
   Wikipedia entry:     Narcissistic number.


 narn: Proc Options(main);
 Dcl (j,k,l,nn,n,sum) Dec Fixed(15)init(0);
 Dcl s Char(15) Var;
 Dcl p(15) Pic'9' Based(addr(s));
 Dcl (ms,msa,ela) Dec Fixed(15);
 Dcl tim Char(12);
 n=30;
 ms=milliseconds();
 Do j=0 By 1 Until(nn=n);
   s=dec2str(j);
   l=length(s);
   sum=left(s,1)**l;
   Do k=2 To l;
     sum=sum+substr(s,k,1)**l;
     If sum>j Then Leave;
     End;
   If sum=j Then Do
     nn=nn+1;
     msa=milliseconds();
     ela=msa-ms;
     /*Put Skip Data(ms,msa,ela);*/
     ms=msa;                            /*yyyymmddhhmissmis*/
     tim=translate('ij:kl:mn.opq',datetime(),'abcdefghijklmnopq');
     Put Edit(nn,' narcissistic:',j,ela,tim)
             (Skip,f(9),a,f(12),f(15),x(2),a(12));
     End;
   End;
 dec2str: Proc(x) Returns(char(16) var);
 Dcl x Dec Fixed(15);
 Dcl ds Pic'(14)z9';
 ds=x;
 Return(trim(ds));
 End;
 milliseconds: Proc Returns(Dec Fixed(15));
 Dcl c17 Char(17);
 dcl 1 * Def C17,
      2 * char(8),
      2 hh Pic'99',
      2 mm Pic'99',
      2 ss Pic'99',
      2 ms Pic'999';
 Dcl result Dec Fixed(15);
 c17=datetime();
 result=(((hh*60+mm)*60)+ss)*1000+ms;
 /*
 Put Edit(translate('ij:kl:mn.opq',datetime(),'abcdefghijklmnopq'),
          result)
         (Skip,a(12),F(15));
 */
 Return(result);
 End
 End;