Largest number divisible by its digits: Difference between revisions
Content added Content deleted
(Check if first digit is even.) |
m (Modified comment.) |
||
Line 1,114: | Line 1,114: | ||
===Base 10=== |
===Base 10=== |
||
Derived from C++ version, with some more optimizations: we check that the first digit (rightmost) is even and we use also an iterator rather than a conversion to string, which speeds up significantly the computation. Result is obtained in about 800 ms. |
|||
<lang nim>iterator digits(n: int): int = |
<lang nim>iterator digits(n: int): int = |
||
var n = n |
var n = n |