Task

Find the largest base 10 integer whose digits are all different,   and   is evenly divisible by each of its individual digits.



These numbers are also known as   Lynch-Bell numbers,   numbers   n   such that the
(base ten) digits are all different (and do not include zero)   and   n   is divisible by each of its individual digits.



Example

135   is evenly divisible by   1,   3,   and   5.



Note that the digit zero (0) can not be in the number as integer division by zero is undefined.

The digits must all be unique so a base ten number will have at most 9 digits.

Feel free to use analytics and clever algorithms to reduce the search space your example needs to visit, but it must do an actual search. (Don't just feed it the answer and verify it is correct.)



Stretch goal

Do the same thing for hexadecimal.



Related tasks

   gapful numbers.
   palindromic gapful numbers. 


Also see

   The OEIS sequence:   A115569: Lynch-Bell numbers. 


Red []
t0: now/time/precise    ;; measure runtime
lbn: 98764321 + 1       ;; because digit 5 is ruled out, this is the highest 8 digit number
                        ;; possible, add 1 because only even numbers are possible
 
check: func [tos [ string! ]] [               ;; function to check if number is divideable by
  foreach ele tos [                           ;; all of its digits
      div: to-integer  ele - #"0"             ;; convert asci digit to integer
      unless lbn % div = 0 [ return false ]   ;; fail at first false condition ( unless = if not...)
  ]
 true                                         ;; true if all digits passed
]
 
forever [
  lbn: lbn - 2                  ;; only even numbers could be possible results
  if find tos: to-string lbn  "0" [continue]  ;; no "0" allowed
  if find tos "5" [continue]                  ;; "5" also excluded
  unless tos = unique tos [ continue ]        ;; only unique digits allowed
  unless check tos [continue]                 ;; passed check ?
  print lbn                                   ;; first hit is result
  probe now/time/precise - t0                 ;; display runtime
  halt
]
 