Jump to content

Largest number divisible by its digits: Difference between revisions

m
Modified comment.
(Check if first digit is even.)
m (Modified comment.)
Line 1,114:
 
===Base 10===
Brute-forceDerived from C++ version, with some more optimizations: therewe ischeck no 5 andthat the first digit (rightmost) must beis even. Weand 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 =
var n = n
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.