Is it a Lynch-Bell number?

25

4

You will be given a positive, whole number (that will never contain a 0) as input. Your task is to check whether it is a Lynch-Bell number or not.

A number is a Lynch-Bell number if all of its digits are unique and the number is divisible by each of its digits.

In fact, there are actually only 548 Lynch-Bell numbers, so hard-coding is a possibility, but will almost certainly be longer.

126 is a Lynch-Bell number because all of its digits are unique, and 126 is divisible by 1, 2, and 6.

You can output any truthy and falsy value.

Examples:

7 -> truthy
126 -> truthy
54 -> falsy
55 -> falsy
3915 -> truthy

This is OEIS A115569.

Okx

Posted 2017-07-04T11:39:21.003

Reputation: 15 025

1Related. (Asks for all the numbers instead of posing a decision problem.) – Martin Ender – 2017-07-04T11:54:10.197

2Can I take input as a string? – TheLethalCoder – 2017-07-04T12:38:48.730

2@TheLethalCoder Of course you can, that's a silly question. – Okx – 2017-07-04T12:40:37.277

10@Okx Not all challenge posters are as flexible in their allowed inputs as you so always worth an ask. – TheLethalCoder – 2017-07-04T12:41:47.677

Answers

27

Mathematica, 42 bytes

0!=##&@@d&&##&@@((d=IntegerDigits@#)∣#)&

I think 0!=##&@@d&&##&@@ is a new low in readability for Mathematica...

Explanation

Some of the basic syntactic sugar used here:

  • & has very low precedence and turns everything left of it into an unnamed function.
  • && is just the And operator.
  • # is the argument of the nearest enclosing unnamed function.
  • ## is a sequence of all of the function's arguments.
  • @ is prefix notation for function calls, i.e. f@x == f[x].
  • @@ is Apply, which passes the elements of a list as individual arguments to a function, i.e. f@@{a,b,c} == f[a,b,c].

With that out of the way...

(d=IntegerDigits@#)

This should be fairly self-explanatory: this gives us a list of the input's decimal digits and stores the result in d.

(...∣#)

This tests the input for divisibility by each of its digits (because the divisibility operator is Listable). This gives us a list of Trues and Falses.

...&@@...

We apply the function on the left-hand side to the list of booleans, such that each boolean is a separate argument.

...&@@d

We apply another function to d, so that the individual digits are given as separate arguments. The function is 0!=##&, i.e. Unequal[0, d1, d2, ...]. It checks that all the digits are distinct (and that they are distinct from 0 but that's given by the challenge, and if it wasn't, it wouldn't be a divisor anyway). 0!=##& is really just a 1-byte saver on using Unequal itself, and it works because there's a 1-byte element (0) that we know is not present. So this first thing checks that the digits are unique. Let's call this result U

...&&##

Again, this is really just shorthand for And[U, ##]. With ## being a sequences, the individual booleans from the initial divisibility check are expanded into the And, so we get And[U, d1∣n, d2∣n, ...] which checks that both the digits are unique and each digit divides the input.

Martin Ender

Posted 2017-07-04T11:39:21.003

Reputation: 184 808

6##&@@d&&##&@@? What does that even do? – Okx – 2017-07-04T12:03:28.430

@Okx Added an explanation. – Martin Ender – 2017-07-04T12:12:04.217

May be you can replace 0!= by 0< ? – sergiol – 2017-07-04T14:26:42.340

@sergiol I'd have to sort the digits to do that. – Martin Ender – 2017-07-04T14:49:15.203

New low in readability indeed, normally Mathematica looks like a bunch of syntax-sugar around a few function names I can understand, I was unaware you could make a program entirely out of the sugar :p (of course, your excellent explanation let's me see that its of course not all sugar, but still, very impressive!) – mbrig – 2017-07-04T19:13:19.150

Please post an ungolfed version. – CalculatorFeline – 2017-07-05T17:12:54.977

Also, I is always Unequal to digits. – CalculatorFeline – 2017-07-05T17:14:54.047

11

Python 3, 56 bytes

lambda n:any(int(n)%int(x)for x in n)or len(n)>len({*n})

Try it online!

Output False if it's IS a Lynch-Bell number, True otherwise.

Rod

Posted 2017-07-04T11:39:21.003

Reputation: 17 588

1Is this inputting as a string? – CalculatorFeline – 2017-07-05T17:18:42.003

2This has two problems: 1) it doesn't give truthy/falsey answers as specified (it's just 4 bytes!); 2) it throws an exception on the input "10". Otherwise, very nice and concise! – CR Drost – 2017-07-05T17:33:03.547

@CalculatorFeline Yes. – CR Drost – 2017-07-05T17:33:16.710

@CRDrost 1) the ouput well defined so there is no problem (usually) 2) there will never be 0 in the input – Rod – 2017-07-05T17:45:48.393

1>

  • I mean, there is a problem, which is that they asked for X and you did not give it. 2) Ah, you're totally right, I missed that completely.
  • < – CR Drost – 2017-07-05T17:55:55.390

    8

    Brachylog, 10 bytes

    ≠g;?z%ᵐ=h0
    

    Try it online!

    Explanation

    ≠             All digits are different
     g;?z         Zip the input with each of its digits
         %ᵐ       Map mod
           =      All results are equal
            h0    The first one is 0
    

    Fatalize

    Posted 2017-07-04T11:39:21.003

    Reputation: 32 976

    6

    JavaScript (ES6), 42 41 bytes

    s=>![...s].some((e,i)=>s%e|s.search(e)<i)
    

    Takes input as a string and returns true or false as appropriate. Edit: Saved 1 byte thanks to @RickHitchcock. Other versions:

    Takes input as a string and returns 0 or 1 (i.e. logical inverse) for 40 bytes:

    s=>/(.).*\1/.test(s)|[...s].some(e=>s%e)
    

    Takes input as a number and returns 0 or 1 for 43 bytes:

    n=>/(.).*\1/.test(n)|[...''+n].some(e=>n%e)
    

    Takes input as a number and returns 1 or 0 for 45 bytes:

    n=>!/(.).*\1/.test(n)&![...''+n].some(e=>n%e)
    

    Neil

    Posted 2017-07-04T11:39:21.003

    Reputation: 95 035

    I was unfamiliar with the \n option for back-referencing. +1. You can move the test logic to the some method to save a byte: s=>![...s].some((e,i)=>s%e|s.search(e)<i) – Rick Hitchcock – 2017-07-04T14:09:47.360

    When I used [...new Array(9999999)].map((_,n)=>n+1+"").filter(s=>![...s].some((e,i)=>s%e|s.search(e)<i)).length I got 5081 instead of the expected 548, so this is not correct as written. Really tight code, though. – CR Drost – 2017-07-05T17:25:12.210

    Sorry, I retract my comment about this not being correct. My test code is not correct because the original poster expects that zeros have already been filtered out. With an extra .filter(x => x.indexOf('0')===-1) this returns 548 as promised. – CR Drost – 2017-07-05T18:01:14.507

    6

    C#, 87 83 bytes

    using System.Linq;s=>s.Distinct().Count()==s.Length&s.All(c=>int.Parse(s)%(c-48)<1)
    

    I wrote this in notepad before testing in Visual Studio, where it worked fine, so just realised I'm now that level of nerd...

    Full/Formatted Version:

    using System;
    using System.Linq;
    
    class P
    {
        static void Main()
        {
            Func<string, bool> f = s => s.Distinct().Count() == s.Length
                                      & s.All(c => int.Parse(s) % (c - 48) < 1);
    
            Console.WriteLine(f("7"));
            Console.WriteLine(f("126"));
            Console.WriteLine(f("54"));
            Console.WriteLine(f("55"));
            Console.WriteLine(f("3915"));
    
            Console.ReadLine();
        }
    }
    

    TheLethalCoder

    Posted 2017-07-04T11:39:21.003

    Reputation: 6 930

    5Obligatory xkcd – Sanchises – 2017-07-04T16:14:27.970

    6

    Jelly, 6 4 bytes

    Dg⁼Q
    

    Try it online!

    How it works

    Dg⁼Q  Main link. Argument: n
    
    D     Decimal; convert n to base 10.
     g    Take the GCD of each decimal digit k and n.
          For each k, this yields k if and only if k divides n evenly.
       Q  Unique; yield n's decimal digits, deduplicated.
      ⁼   Test the results to both sides for equality.
    

    Dennis

    Posted 2017-07-04T11:39:21.003

    Reputation: 196 637

    3There's also gQV= if you prefer an ASCII-only solution. – Dennis – 2017-07-04T16:00:21.037

    5

    Python 3, 54 bytes

    Returns False when a number is a Lynch-Bell number. Takes strings as input. Came up with on my own but very similar to Rod's. I would've commented under his post but I don't have any reputation yet.

    lambda s:len({*s})<len(s)+any(int(s)%int(c)for c in s)
    

    Try it online!

    C McAvoy

    Posted 2017-07-04T11:39:21.003

    Reputation: 229

    2Welcome to PPCG! – Stephen – 2017-07-04T21:27:19.923

    Welcome! Like Rod's, your function throws an exception on input "10". – CR Drost – 2017-07-05T17:34:38.623

    1@CRDrost "You will be given a positive, whole number (that will never contain a 0) as input." – C McAvoy – 2017-07-05T19:32:49.630

    Right, I've posted comments everywhere else I complained about this, but I apparently missed this one. Sorry, retracted! – CR Drost – 2017-07-05T19:36:26.887

    @CRDrost No worries! – C McAvoy – 2017-07-05T20:01:25.880

    2

    Jelly, 8 bytes

    D⁼QaDḍ$Ạ
    

    Try it online!

    Erik the Outgolfer

    Posted 2017-07-04T11:39:21.003

    Reputation: 38 134

    2

    PHP, 62 48 bytes

    while($i=$argn[$k++])$r|=$argn%$i|$$i++;echo!$r;
    

    Run as pipe with -nR or test it online. Empty output for falsy, 1 for truthy.

    breakdown

    while($i=$argn[$k++])   # loop through digits
        $r|=                    # set $r to true if
            $argn%$i            # 1. number is not divisible by $i
            |$$i++;             # 2. or digit has been used before
    echo!$r;                # print negated $r
    

    Titus

    Posted 2017-07-04T11:39:21.003

    Reputation: 13 814

    2

    Haskell, 61 bytes

    (#)=<<show
    (d:r)#n=notElem d r&&mod n(read[d])<1&&r#n
    _#_=0<3
    

    Try it online!

    Defines an anonymous function (#)=<<show which, given a number, returns True or False.

    Laikoni

    Posted 2017-07-04T11:39:21.003

    Reputation: 23 676

    This function fails on the input 10. – CR Drost – 2017-07-05T17:17:09.200

    Sorry, I am wrong about that -- I missed that you're not required to provide any answer for inputs that have 0s in them. – CR Drost – 2017-07-05T18:02:05.753

    2

    05AB1E, 4 bytes

    ÑÃÙQ
    

    Try it online!

    Same algorithm as this answer to a related question.

    Grimmy

    Posted 2017-07-04T11:39:21.003

    Reputation: 12 521

    1

    Japt, 15 14 11 10 9 bytes

    ì®yUÃ¥Uìâ
    

    Try it

    Shaggy

    Posted 2017-07-04T11:39:21.003

    Reputation: 24 623

    ©! -> « for -1 byte – Justin Mariner – 2017-09-11T17:35:54.293

    Thanks, @JustinMariner; don't know how that went so long without being spotted! I found a shorter solution, though. – Shaggy – 2017-09-11T19:11:29.473

    1

    05AB1E, 8 bytes

    SÖP¹DÙQ*
    

    Uses the 05AB1E encoding. Try it online!

    Adnan

    Posted 2017-07-04T11:39:21.003

    Reputation: 41 965

    1

    Mathematica, 57 bytes

    Tr@Boole[IntegerQ/@Union[s=#/IntegerDigits@#]]==Length@s&
    

    J42161217

    Posted 2017-07-04T11:39:21.003

    Reputation: 15 931

    1You can save numerous bytes if you use the builtin IsLynchBellNumber – Okx – 2017-07-04T14:53:18.057

    1why don't you make the same offer to Martin? – J42161217 – 2017-07-04T15:00:52.277

    @Okx but it's less fun that way. – QBrute – 2017-07-04T21:57:14.540

    @QBrute Can you take a joke? – Okx – 2017-07-04T22:02:56.670

    1@Okx It would have been more believable as LynchBellNumberQ. ;) – Martin Ender – 2017-07-05T05:20:09.240

    1

    Python 2, 66 bytes

    This is a solution in Python 2, whose whole purpose is to output True for truthy and False for falsy:

    lambda n:len(set(n))==len(n)and not any((int(n)%int(x)for x in n))
    

    Try it online!

    Mr. Xcoder

    Posted 2017-07-04T11:39:21.003

    Reputation: 39 774

    1

    Haskell, 260 241 201 162 bytes

    f([x])=1<2
    f(x:xs)=not(x`elem`xs)&&(f xs)
    r n i= n`mod`(read[(show n!!i)]::Int)==0
    q n 0=r n 0 
    q n i=r n i&&q n(i-1)
    p n=length(show n)-1
    s n=q n(p n)&&f(show n)
    

    Explanation

    f ([x]) = True                                           f function checks for                                                       
    f (x:xs) = not(x `elem` xs) && (f xs)                    repeated digits              
    r n i = n `mod` (read [(show n !! i)] :: Int) == 0       checks whether num is 
                                                             divisible by i digit
    q n 0 = r n 0                                            checks wether n divisible
    q n i = r n i && q n (i-1)                               by all of its digits                             
    p n = length (show n) -                                  gets length of number                             
    s n = (q n (p n)) && (f (show n))                        sums it all up!!!
    

    Have significantly shortened thanx to Laikoni

    Sergii Martynenko Jr

    Posted 2017-07-04T11:39:21.003

    Reputation: 213

    1Welcome to PPCG and Haskell golfing in particular! This answer can be considerably shortened by removing superfluous spaces, e.g. the ones around the equal signs or next to parenthesis. – Laikoni – 2017-07-05T12:40:05.197

    1

    You might also be interested in Tips for golfing in Haskell and the Guide to Golfing Rules in Haskell.

    – Laikoni – 2017-07-05T12:43:27.893

    @Laikoni Thanx for your advice! I'm looking into it – Sergii Martynenko Jr – 2017-07-05T13:51:58.447

    0

    Neim, 9 bytes

    ℚ₁₁₁ℚ
    

    Try it online!

    -2 thanks to Okx.

    Hmm, there's a nice symmetry... oO.O.O.Oo

    Erik the Outgolfer

    Posted 2017-07-04T11:39:21.003

    Reputation: 38 134

    You can golf D to (uniquify, check for equality ignoring types) – Okx – 2017-07-04T12:11:23.617

    Still room for golfing there ;) – Okx – 2017-07-04T12:19:38.677

    @Okx Hmm...I don't see anything particularly interesting there. – Erik the Outgolfer – 2017-07-04T12:26:38.730

    0

    PHP, 51 bytes

    prints zero for true and one for false

    for(;$c=$argn[$i++];$$c=1)$t|=$$c||$argn%$c;echo$t;
    

    Try it online!

    PHP, 62 bytes

    prints zero for true and one for false

    for($a=$argn;$c=$a[$i];)$t|=strpos($a,$c)<+$i++||$a%$c;echo$t;
    

    Try it online!

    Jörg Hülsermann

    Posted 2017-07-04T11:39:21.003

    Reputation: 13 026

    0

    Perl 6, 27 bytes

    {$_%%.comb.all&&[!=] .comb}
    

    Try it online!

    • .comb is a method which, when given no arguments, splits a string into its individual characters. A number is implicitly converted into a string, and so .comb returns its digits.
    • .comb.all is an and-junction of all of the digits.
    • $_ %% .comb.all is an and-junction of the divisibility of the input argument $_ by all of its digits. For example, if $_ is 123, the junction is all(True, False, True), which collapses to False in a truthy context.
    • [!=] .comb reduces the digits of the input argument with the != operator, which evaluates to True if the digits are all different.

    Sean

    Posted 2017-07-04T11:39:21.003

    Reputation: 4 136

    0

    Retina, 37 bytes

    (.).*\1
    0
    .
    <$&$*1>$_$*
    <(1+)>\1+
    
    ^$
    

    Try it online! Link includes test cases. Explanation: The first stage replaces any duplicate digit with a zero. The second stage replaces each digit with its unary representation followed by the unary representation of the original number. The third stage then computes the remainder of the division of original number by each non-zero digit. If the number is a Lynch-Bell number then this will delete everything and this is tested for by the final stage.

    Neil

    Posted 2017-07-04T11:39:21.003

    Reputation: 95 035

    0

    Ruby 2.4, 42 bytes

    ->x{(r=x.digits)|[]==r&&r.none?{|f|x%f>0}}
    

    (No TIO yet, sorry)

    G B

    Posted 2017-07-04T11:39:21.003

    Reputation: 11 099

    0

    CJam, 17 bytes

    CJam is the Java of golfing languages. It's even interpreted in Java!

    {_Ab__L|=@@f%:+>}
    

    Explanation:

    {   e# Stack:              3915
    _   e# Duplicate:          3915 3915
    Ab  e# Digits in base 10:  3915 [3 9 1 5]
    __  e# Duplicate twice:    3915 [3 9 1 5] [3 9 1 5] [3 9 1 5]
    L|  e# Remove duplicates:  3915 [3 9 1 5] [3 9 1 5] [3 9 1 5]
    =   e# Test equality:      3915 [3 9 1 5] 1
    @@  e# Rotate twice:       1 3915 [3 9 1 5]
    f%  e# Modulo each:        1 [0 0 0 0]
    :+  e# Sum:                1 0
    >   e# Greater than:       1
    }   e# Output:             1 (truthy)
    

    Esolanging Fruit

    Posted 2017-07-04T11:39:21.003

    Reputation: 13 542

    0

    VBScript, 177 bytes

    Hey all, this is my very first CG post, and first attempt, so hope I followed all the rules...

    Function L(s)
    dim i,j,k,m,n
    j = Len(s)
    redim a(j)
    n = 0
    for i = 0 to j-1
       A(i) = Mid(s,i+1,1)   
       m = m + s Mod A(i)   
       if j = 1 then         
       else                             
            for k = 0 to i - 1        
                if A(i)  = A(k) then n = n + 1   
            next
       end if
    next
    if m + n = 0 then L = "y" else L = "n"
    End Function
    

    This can be run from Notepad by adding a line at the end

    Msgbox L(InputBox(""))
    

    And then saving it as .vbs, then double click.

    Explanation:

    Function L(s)                  'creates the function "L" taking test number as input
    dim i,j,k,t,m,n                'variables
    j = Len(s)                     '"j" gets length of test number
    redim a(j)                     'creates array "a", size is length of test number 
    n = 0                          'sets repeat character counter "n" to zero
    for i = 0 to j-1               'for length of string
       A(i) = Mid(s,i+1,1)         'each array slot gets one test number character
       m = m + s Mod A(i)          '"m" accumulates moduli as we test divisibility of each digit
       if j = 1 then               'if test number is of length 1, it passes (do nothing)
       else                        'otherwise, gotta test for repeats     
            for k = 0 to i - 1     'for each digit already in array, test against current digit   
                if A(i)  = A(k) then n = n + 1  
                                   'repeat char counter "n" stores no of repeats  
            next                   'proceed through array looking for repeat  
       end if
    next                           'test next digit for divisibility and repeats
    if m + n = 0 then L = "y" else L = "n"      
                                   'check for any repeats and moduli,
                                   'then return yes or no for LynchBelledness
    End Function
    

    VBScript is a bit of blunt instrument for golfing, but hey, I haven't learned Ruby yet...

    aAaa aAaa

    Posted 2017-07-04T11:39:21.003

    Reputation: 141

    Can't you remove some of the whitespace like 'L="y"' – Okx – 2017-07-08T20:01:33.230

    Technically, yes! I shoulda done that...btw, i'm looking at codegolf languages that might be cool to learn, but for most, the documentation is minimal to non-existent...can anyone recommend a good language that is well documented? Was trying out "Actually/Seriously" but hit some obstacles due to lack of doc.... – aAaa aAaa – 2017-07-11T00:07:02.887

    0

    Pyth, 10 bytes

    qiRQKjQT{K
    

    Verify all the test cases.

    How?

    qiRQKjQT{K  ~ Full program.
    
         jQT    ~ The list of decimal digits of the input.
        K       ~ Assign to a variable K.
     iRQ        ~ For each decimal digit...
     i Q          ~ ... Get the greatest common divisor with the input itself.
            {K  ~ K with the duplicate elements removed.
    q           ~ Is equal? Output implicitly.
    

    Pyth, 11 bytes

    &!f%sQsTQ{I
    

    Verify all the test cases.

    How?

    &!f%sQsTQ{I  ~ Full program, with implicit input.
    
      f     Q    ~ Filter over the input string.
       %sQsT     ~ The input converted to an integer modulo the current digit.
                 ~ Keeps it if it is higher than 0, and discards it otherwise.
     !           ~ Negation. If the list is empty, returns True, else False.
    &        {I  ~ And is the input invariant under deduplicating? Output implicitly.
    

    Mr. Xcoder

    Posted 2017-07-04T11:39:21.003

    Reputation: 39 774

    0

    Perl 5, 34 bytes

    33 bytes of code + 1 for -p flag

    $n=$_;$\|=$n%$_|$k{$_}++for/./g}{
    

    Try it online!

    Outputs 0 for truthy, any other number for falsy

    Xcali

    Posted 2017-07-04T11:39:21.003

    Reputation: 7 671

    0

    Kotlin 1.1, 98 66 59 bytes

    {i->i.none{i.toInt()%(it-'0')>0}&&i.length==i.toSet().size}
    

    Beautified

    {i ->
        // None of the digits are not factors
        i.none { i.toInt() % (it-'0') > 0 }
        // AND
        &&
        // None of the digits are repeated
        i.length == i.toSet().size
    }
    

    Test

    var L:(String)-> Boolean =
    {i->i.none{i.toInt()%(it-'0')>0}&&i.length==i.toSet().size}
    data class TestData(val input: String, val output: Boolean)
    
    fun main(args: Array<String>) {
        var inputs = listOf(
            TestData("7", true),
            TestData("126", true),
            TestData("54", false),
            TestData("55", false),
            TestData("3915", true)
        )
    
        for (test in inputs) {
            if (L(test.input) != test.output) {
                throw AssertionError(test.toString())
            }
        }
        println("Test Passed")
    }
    

    jrtapsell

    Posted 2017-07-04T11:39:21.003

    Reputation: 915

    0

    APL (Dyalog Unicode), 24 bytes

    {((,⍵)≡∪⍵)×∧/0=(⍎¨⍵)|⍎⍵}
    

    Try it online!

    Simple Dfn, can probably be golfed a bit more. Yield standard APL booleans 1 for truthy, 0 for falsy.

    It's worth to mention that the function takes the arguments as strings rather than ints.

    How:

    {((,⍵)≡∪⍵)×∧/0=(⍎¨⍵)|⍎⍵} ⍝ Dfn, argument ⍵.
                          ⍎⍵  ⍝ Convert ⍵ to integer
                         |    ⍝ Modulus
                    (⍎¨⍵)     ⍝ Each digit in ⍵
                  0=          ⍝ Equals 0? Returns a vector of booleans
                ∧/            ⍝ Logical AND reduction
               ×              ⍝ multiplied by (the result of)
      (     ∪⍵)               ⍝ unique elements of ⍵
           ≡                  ⍝ Match
       (,⍵)                   ⍝ ⍵ as a vector; the Match function then returns 1 iff all digits in ⍵ are unique
    

    J. Sallé

    Posted 2017-07-04T11:39:21.003

    Reputation: 3 233

    0

    Julia 1.0, 39 bytes

    f(x,d=digits(x))=rem.(x,d)==0*unique(d)
    

    rem.(x,d) is a vector containing the remainders after dividing x by each digit in x. 0*unique(d) is a vector with length equal to the number of unique digits, with all zero values. Check if they are equal.

    Try it online!

    gggg

    Posted 2017-07-04T11:39:21.003

    Reputation: 1 715

    0

    ruby -n, 40 bytes

    p gsub(/./){$'[$&]||$_.to_i%$&.hex}<?0*8
    

    Try it online!

    Read in the number as a string. Substitute each character (digit) with a subsequent occurrence of that character, if present, or the whole number modulo that digit. This will result in a string of only 0s if and only if this is a Lynch-Bell number. Why? If there's a repeated digit, every instance of the last stays the same, and since the input doesn't contain zeroes that means a non-zero digit. Otherwise, we're just checking whether every digit evenly divides the number.

    Since there are no 8-or-more-digit Lynch-Bell numbers (formal proof: OEIS says so), checking whether the resulting string is lexicographically earlier than the string '00000000' is equivalent to checking whether it's all zeroes.

    histocrat

    Posted 2017-07-04T11:39:21.003

    Reputation: 20 600

    0

    R, 86 bytes

    x=scan(,'');a=as.double;all(table(utf8ToInt(x))==1)&&all(!a(x)%%a(el(strsplit(x,""))))
    

    Takes input as a string. I certainly feel like this is golfable.

    Try it online!

    Sumner18

    Posted 2017-07-04T11:39:21.003

    Reputation: 1 334

    0

    Python 3, 50 bytes

    lambda n:all(int(n)%int(d)+n.count(d)<2for d in n)
    

    Try it online!

    Returns True if the (zero-free) number is a Lynch-Bell number, False otherwise.

    Luciano

    Posted 2017-07-04T11:39:21.003

    Reputation: 11