Narcissistic decimal number: Difference between revisions

Content added Content deleted
No edit summary
No edit summary
Line 2,171: Line 2,171:
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 153, 370, 371, 407, 1634, 8208, 9474, 54748,
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 153, 370, 371, 407, 1634, 8208, 9474, 54748,
92727, 93084, 548834, 1741725, 4210818, 9800817, 9926315]
92727, 93084, 548834, 1741725, 4210818, 9800817, 9926315]
</pre>

=={{header|EMal}}==
<syntaxhighlight lang="emal">
fun narcissistic = void by int count
for int i, n, sum = 0; i < count; ++n, sum = 0
text nText = text!n
for each text c in nText
sum += (int!c) ** nText.length
end
if sum == n
if (i % 5 == 0) do writeLine() end
write((text!n).padStart(8, " "))
++i
end
end
writeLine()
end
narcissistic(25)
</syntaxhighlight>
{{out}}
<pre>
0 1 2 3 4
5 6 7 8 9
153 370 371 407 1634
8208 9474 54748 92727 93084
548834 1741725 4210818 9800817 9926315
</pre>
</pre>