Own digits power sum: Difference between revisions

m (→‎{{header|Pascal}}: Check if Sum Of Powerdigits in range of digital count, before recalc the digits of sum.~ 20% speed up)
Line 1,260:
{{out}}
<pre>153 370 371 407 1634 8208 9474 54748 92727 93084 548834 1741725 4210818 9800817 9926315 24678050 24678051 88593477 146511208 472335975 534494836 912985153</pre>
 
=={{header|Ring}}==
<lang ring>
see "working..." + nl
see "Own digits power sums for N = 3 to 9 inclusive:" + nl
 
for n = 3 to 9
for curr = pow(10,n-1) to pow(10,n)-1
sum = 0
temp = curr
while temp != 0
dig = temp % 10
temp = floor(temp/10)
sum += pow(dig,n)
end
if sum = curr
see "" + curr + nl
ok
next
next
 
see "done..." + nl
</lang>
{{out}}
<pre>
working...
Own digits power sums for N = 3 to 9 inclusive:
153
370
371
407
1634
8208
9474
54748
92727
93084
548834
1741725
4210818
9800817
9926315
24678050
24678051
88593477
146511208
472335975
534494836
912985153
done...
</pre>
 
=={{header|Ruby}}==
2,468

edits