Narcissistic decimal number: Difference between revisions
Added Arturo implementation
m (→{{header|Phix}}: added syntax colouring, marked p2js compatible) |
Drkameleon (talk | contribs) (Added Arturo implementation) |
||
Line 584:
{{output}}
<lang applescript>{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}</lang>
=={{header|Arturo}}==
{{trans|REXX}}
<lang rebol>powers: map 0..9 'x [
map 0..9 'y [
x ^ y
]
]
getPair: function [p,sz].memoize[
if not? numeric? last p -> return powers\[to :integer to :string first p]\[sz]
return powers\[to :integer to :string first p]\[sz] + powers\[to :integer to :string last p]\[sz]
]
narcissistic?: function [n][
digs: digits n
sdigs: size digs
n = sum map split.every:2 to :string n 'p -> getPair p sdigs
]
i: new 0
counter: new 0
while [counter < 25][
if narcissistic? i [
print i
inc 'counter
]
inc 'i
]</lang>
{{out}}
<pre></pre>
=={{header|AutoHotkey}}==
|