Narcissistic decimal number: Difference between revisions
Content added Content deleted
m (→{{header|Pascal}}: moved from Own_digits_power_sum) |
ReeceGoding (talk | contribs) m (→{{header|R}}: Syntax highlighting.) |
||
Line 4,001: | Line 4,001: | ||
===For loop solution=== |
===For loop solution=== |
||
This is a slow method and it needed above 5 minutes on a i3 machine. |
This is a slow method and it needed above 5 minutes on a i3 machine. |
||
<lang |
<lang rsplus>for (u in 1:10000000) { |
||
j <- nchar(u) |
j <- nchar(u) |
||
set2 <- c() |
set2 <- c() |
||
Line 4,047: | Line 4,047: | ||
*As we are using format anyway, we take the chance to make the output look nicer. |
*As we are using format anyway, we take the chance to make the output look nicer. |
||
<lang |
<lang rsplus>generateArmstrong<-function(howMany) |
||
{ |
{ |
||
resultCount<-i<-0 |
resultCount<-i<-0 |