Minimum multiple of m where digital sum equals m: Difference between revisions
Content added Content deleted
Not a robot (talk | contribs) (add Refal) |
Not a robot (talk | contribs) (Add ABC) |
||
Line 87: | Line 87: | ||
163918 322579 315873 937342 1076923 1030303 880597 1469116 1157971 12842857 |
163918 322579 315873 937342 1076923 1030303 880597 1469116 1157971 12842857 |
||
</pre> |
</pre> |
||
=={{header|ABC}}== |
|||
<syntaxhighlight lang="ABC">HOW TO RETURN digit.sum n: |
|||
PUT 0 IN sum |
|||
WHILE n>0: |
|||
PUT sum + (n mod 10) IN sum |
|||
PUT floor (n/10) IN n |
|||
RETURN sum |
|||
HOW TO RETURN a131382 n: |
|||
PUT 1 IN m |
|||
WHILE n <> digit.sum (m*n): PUT m+1 IN m |
|||
RETURN m |
|||
FOR n IN {1..70}: |
|||
WRITE (a131382 n)>>9 |
|||
IF n mod 10=0: WRITE /</syntaxhighlight> |
|||
{{out}} |
|||
<pre> 1 1 1 1 1 1 1 1 1 19 |
|||
19 4 19 19 13 28 28 11 46 199 |
|||
19 109 73 37 199 73 37 271 172 1333 |
|||
289 559 1303 847 1657 833 1027 1576 1282 17497 |
|||
4339 2119 2323 10909 11111 12826 14617 14581 16102 199999 |
|||
17449 38269 56413 37037 1108909 142498 103507 154981 150661 1333333 |
|||
163918 322579 315873 937342 1076923 1030303 880597 1469116 1157971 12842857</pre> |
|||
=={{header|APL}}== |
=={{header|APL}}== |
||
Line 99: | Line 124: | ||
17449 38269 56413 37037 1108909 142498 103507 154981 150661 1333333 |
17449 38269 56413 37037 1108909 142498 103507 154981 150661 1333333 |
||
163918 322579 315873 937342 1076923 1030303 880597 1469116 1157971 12842857</pre> |
163918 322579 315873 937342 1076923 1030303 880597 1469116 1157971 12842857</pre> |
||
=={{header|AWK}}== |
=={{header|AWK}}== |
||
<syntaxhighlight lang="awk"> |
<syntaxhighlight lang="awk"> |