Sum of the digits of n is substring of n: Difference between revisions
Content added Content deleted
Alpha bravo (talk | contribs) (Added AutoHotkey) |
|||
Line 312: | Line 312: | ||
<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 |
<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> |
910 911 912 913 914 915 916 917 918 919</pre> |
||
=={{header|AutoHotkey}}== |
|||
<lang AutoHotkey>result := "", cntr := 1 |
|||
loop 1000{ |
|||
n := A_Index-1, sum := 0 |
|||
for i, v in StrSplit(n) |
|||
sum += v |
|||
if InStr(n, sum){ |
|||
result .= n (mod(cntr, 8)?"`t":"`n") |
|||
if (++cntr = 50) |
|||
break |
|||
} |
|||
} |
|||
MsgBox % result</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|AWK}}== |
=={{header|AWK}}== |