Narcissistic decimal number: Difference between revisions

Content added Content deleted
m (→‎{{header|Pascal}}: moved from Own_digits_power_sum)
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 R>for (u in 1:10000000) {
<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 R>generateArmstrong<-function(howMany)
<lang rsplus>generateArmstrong<-function(howMany)
{
{
resultCount<-i<-0
resultCount<-i<-0