Self-describing numbers: Difference between revisions

(add CLU)
Line 1,220:
</pre>
 
 
=={{header|EasyLang}}==
Works with backtracking, iterative is too slow. Constraint: the digit sum is the number of digits.
<syntaxhighlight lang="easylang">
proc test d[] . .
cnt[] = [ 0 0 0 0 0 0 0 0 0 0 ]
for d in d[]
cnt[d + 1] += 1
.
for i to len d[]
if cnt[i] <> d[i]
break 2
.
.
# found
for d in d[]
write d
.
print ""
.
proc backtr ind max . d[] .
if ind > len d[]
call test d[]
break 1
.
for d = 0 to max
if d < 10
d[ind] = d
call backtr ind + 1 max - d d[]
.
.
.
for i = 1 to 10
len d[] i
call backtr 1 len d[] d[]
.
</syntaxhighlight>
{{out}}
<pre>
1210
2020
21200
3211000
42101000
521001000
6210001000
</pre>
 
=={{header|Elixir}}==
2,069

edits