Sum of the digits of n is substring of n: Difference between revisions

m
no edit summary
(add FreeBASIC)
mNo edit summary
Line 27:
next i : print : end</lang>
{{out}}<pre>0 1 2 3 4 5 6 7 8 9 10 20 30 40 50 60 70 80 90 100 109 119 129 139 149 159 169 179 189 199 200 300 400 500 600 700 800 900 910 911 912 913 914 915 916 917 918 919</pre>
 
 
=={{header|Julia}}==
<lang julia># Find and show numbers n with property that the sum of the digits of n is substring of n, where n < 1000
 
issumsub(n, base=10) = occursin(string(sum(digits(n, base=base)), base=base), string(n, base=base))
 
foreach(p -> print(rpad(p[2], 4), p[1] % 10 == 0 ? "\n" : ""), enumerate(filter(issumsub, 0:999)))
</lang>{{out}}
<pre>
0 1 2 3 4 5 6 7 8 9
10 20 30 40 50 60 70 80 90 100
109 119 129 139 149 159 169 179 189 199
200 300 400 500 600 700 800 900 910 911
912 913 914 915 916 917 918 919
</pre>
 
=={{header|REXX}}==
4,111

edits