Jump to content

Self numbers: Difference between revisions

Added Easylang
m (→‎{{header|Wren}}: Changed to Wren S/H)
(Added Easylang)
 
Line 577:
 
Overall took 7.0237244s</pre>
 
=={{header|EasyLang}}==
{{trans|Go}}
<syntaxhighlight>
fastfunc digsum h .
while h > 0
sum += h mod 10
h = h div 10
.
return sum
.
fastfunc isself start i .
j = start
sum = digsum start
while j < i
if j + sum = i
return 0
.
sum += 1
j += 1
if j mod 10 = 0
sum = digsum j
.
.
return 1
.
proc main . .
i = 1
po = 10
digits = 1
offs = 9
repeat
start = higher (i - offs) 0
if isself start i = 1
cnt += 1
if cnt <= 50
write i & " "
.
.
until cnt = 100000000
i += 1
if i mod po = 0
po *= 10
digits += 1
offs = digits * 9
.
.
print ""
print i
.
main
</syntaxhighlight>
{{out}}
<pre>
1 3 5 7 9 20 31 42 53 64 75 86 97 108 110 121 132 143 154 165 176 187 198 209 211 222 233 244 255 266 277 288 299 310 312 323 334 345 356 367 378 389 400 411 413 424 435 446 457 468
1022727208
</pre>
 
=={{header|Elixir}}==
2,078

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.