Minimum multiple of m where digital sum equals m: Difference between revisions
Content added Content deleted
(→{{header|Ruby}}: Add Ruby) |
(RPL: add section) |
||
Line 1,895: | Line 1,895: | ||
69: 1157971 |
69: 1157971 |
||
70: 12842857</pre> |
70: 12842857</pre> |
||
=={{header|RPL}}== |
|||
≪ 0 SWAP '''WHILE''' DUP '''REPEAT''' |
|||
10 MOD LAST / FLOOR SWAP ROT + SWAP |
|||
'''END''' DROP |
|||
≫ ‘'''∑DIG'''’ STO |
|||
≪ 0 '''DO''' 1 + DUP2 * '''UNTIL ∑DIG''' 3 PICK == '''END''' SWAP DROP |
|||
≫ ‘'''A131382'''’ STO |
|||
≪ { } 1 40 '''FOR''' j j '''A131382''' + '''NEXT''' ≫ EVAL |
|||
{{out}} |
|||
<pre> |
|||
1: { 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 } |
|||
</pre> |
|||
Runs in 98 minutes on a HP-28S. |
|||
=={{header|Ruby}}== |
=={{header|Ruby}}== |
||
Line 1,908: | Line 1,924: | ||
1333333 163918 322579 315873 937342 1076923 1030303 880597 1469116 1157971 |
1333333 163918 322579 315873 937342 1076923 1030303 880597 1469116 1157971 |
||
</pre> |
</pre> |
||
=={{header|Sidef}}== |
=={{header|Sidef}}== |
||
<syntaxhighlight lang="ruby">var e = Enumerator({|f| |
<syntaxhighlight lang="ruby">var e = Enumerator({|f| |