text:
Interquine - Two programs that output each other in a loop
Program A outputs program B's code when run, and B outputs A's source.
Requirements:

Only one language across both programs
Programs are different. One program that outputs itself does not qualify.
Both programs are non-empty, or at least 1 byte in length. Trailing newlines in both source and output are ignored
stdin is closed. Do not read anything (so you can't read the source and manipulate it). Output goes to stdout.
Edit: stdin is connected to /dev/null. You can order it be closed if clarified.
Do not use random functions.

Additional:

Give explanations if possible

Score is total length. Trailing newline does not count if it doesn't affect the program.

Related.

"Do not use random functions."? What do you mean? Functions that output a random number?

Related Folklore

I'm pretty sure you don't really mean stdin is closed. This blows up some environments as stdin becomes a duplicate of the first opened file. Anyway, if you don't fix it I will abuse it.

CJam, 13 + 13 = 26 bytes
{sYZe\"_~"}_~

Try it online!
Outputs
{sZYe\"_~"}_~

Explanation
{       e# Standard quine framework, leaves a copy of the block on the stack
        e# for the block itself to process.
  s     e# Stringify the block.
  YZe\  e# Swap the characters at indices 2 and 3, which are Y and Z themselves.
  "_~"  e# Push the "_~" to complete the quine.
}_~

Since e\ is commutative in its second and third operand, the other program does exactly the same, swapping Z and Y back into their original order.

CJam, 11 + 13 = 24 11 + 12 = 23 bytes
"N^_p"
N^_p

Try it online!
Outputs:
"N^_p
"
N^_p

The output has 13 bytes, but:

Trailing newline does not count if it doesn't affect the program.

So I changed the space to a newline to take advantage of that.
It is based on the shortest CJam proper quine:
"_p"
_p

And N^ is to xor the string with a newline, which adds a newline if there isn't a newline, and remove it if there is, for a string that each character is unique.
I think I have seen that quine in the quine question, but I couldn't find it.

+1 for having two different sized programs, unlike all other answers so far. Edit: as soon as I can vote again.. reached the limit last vote >.>

Good for being different in length.

"I think I have seen that quine in the quine question, but I couldn't find it." It's only mentioned in the GolfScript answer.

RProgN 2, 3 + 3 = 6 bytes
First program:
0
1

Try it online!
Second program:
1
0

Try it online!
-2 thanks to Martin Ender.

You can save two bytes by switching languages: https://tio.run/##Kyooyk/P0zX6/9@Ay/D/fwA

@MartinEnder Ooh right I forgot RProgN 2 exhibits such behavior...btw I dunno if it's still that buggy.

I don't know anything about RProgN except that this behaviour exists.

@MartinEnder Author of RProgN here, just ask if you need anything clarified!

@ATaco Well, I'd have asked you to clarify the downvote but I don't think you can...

Javascript, 67+67=134 bytes
1st program:
alert(eval(c="`alert(eval(c=${JSON.stringify(c)},n=${+!n}))`",n=0))

2nd program:
alert(eval(c="`alert(eval(c=${JSON.stringify(c)},n=${+!n}))`",n=1))

This is based on Herman Lauenstein's answer to Tri-interquine
Javascript (Invalid - reads source code), 75+75=150 61+61=122 58+58=116 50+50=100 bytes
saved 20 bytes thanks to Tushar, 6 bytes thanks to Craig Ayre, and saved 16 bytes thanks to kamoroso94
1st program:
f=_=>alert(("f="+f).replace(0,a=>+!+a)+";f()");f()

2nd program:
f=_=>alert(("f="+f).replace(1,a=>+!+a)+";f()");f()

Swaps the 1s with the 0s and vice versa. They both do the same thing, just producing different output because of their source code.

Let's save few bytes. f.toString() => (''+f), (0|1) => 0|1, (a,b) => a resulting in f=()=>("f="+(''+f).replace(/0|1/g,a=>a==0?1:0)+";f()");f()

You can use an unused parameter to save a couple of bytes f=_=> and remove parens from the replace callback as @Tushar suggested: a=>+!+a

Replace "f="+(f+"") with ("f="+f) for -3 bytes.

Replace /0|1/g and /1|0/g with 0 and 1 respectively for -5 bytes.

Did you run it?  It works like this f=_=>alert(("f="+f).replace(0,a=>+!+a)+";f()");f().

oh, never mind.

I don't think that this is is a valid solution, since it reads it's own source code (using String.prototype.toString or "f="+f), which is a standard loophole in questions tagged quine.

@HermanLauenstein I added a valid solution based on your answer to Tri-interquine

C, 95 + 95 = 190 bytes
Thanks to @immibis for saving 16*2 bytes!
char*s="char*s=%c%s%c;main(i){i=%d^1;printf(s,34,s,34,i);}";main(i){i=1^1;printf(s,34,s,34,i);}

Try it online!
Outputs:
char*s="char*s=%c%s%c;main(i){i=%d^1;printf(s,34,s,34,i);}";main(i){i=0^1;printf(s,34,s,34,i);}

Try it online!
Which outputs:
char*s="char*s=%c%s%c;main(i){i=%d^1;printf(s,34,s,34,i);}";main(i){i=1^1;printf(s,34,s,34,i);}

Why not just call it C always, and rely on i changing to make the program different? C is shorter than %c

@immibis Yes, you are right, that suffices perfectly.

Python 2, 63+63 = 126 bytes
Try it online
First program:
A='A=%r;print A[:23]%%A+A[29:35]23:29]';print A[:23]%A+A[23:29]

outputs:
A='A=%r;print A[:23]%%A+A[29:35]23:29]';print A[:23]%A+A[29:35]

Second program:
A='A=%r;print A[:23]%%A+A[29:35]23:29]';print A[:23]%A+A[29:35]

Outputs:
A='A=%r;print A[:23]%%A+A[29:35]23:29]';print A[:23]%A+A[23:29]

JavaScript (JsShell), 35 + 34 = 69 bytes
1:
(f=x=>print(`(f=${f})(${-x})`))(-1)

2:
(f=x=>print(`(f=${f})(${-x})`))(1)

Underload, 32+32=64 bytes
(a~a*(:^)*S)(~(a)~a*^a(:^)**S):^

Try it online!
(~(a)~a*^a(:^)**S)(a~a*(:^)*S):^

Try it online!

Mathematica, 43 + 44 = 87 bytes
(Print[#1[#0[#1, -#2]]] & )[HoldForm, -1 1]

and
(Print[#1[#0[#1, -#2]]] & )[HoldForm, -(-1)]

Tested it on my computer and the output of the second one only has -1 at the end, not -1 1.

@numbermaniac I wrote these codes in the text-based interface. It seems that they don't work in notebooks.

asmutils sh, 16+16 bytes, abusing the "stdin is closed" rule.
#!/bin/sh
tr x y

Since stdin is closed and sh will open its script to the first available handle (rather than move it to a high numbered handle like modern shells do), tr ends up reading from a copy of the script without having ever opened it.
This interquine is payload capable but inserting a payload is tricky.
In addition, this original version abuses some crazy bug in the ancient kernel I used in those days. (I don't know what's up with that kernel--I found out later on it had different major and minor numbers for devices too.) If you fix the ABI changes that broke asmutils the interquine still won't work. I forget if asmutils sh has exec or not, but if it does, this is a modern version:
exec dd skip=0 | tr x y

This abuses a deliberate bug in asmutils dd; it has a performance optimization it calls llseek for skip if it can, but to save a byte it passes SEEK_SET rather than SEEK_CUR. This results in garbage on stderr but the interquine on stdout. Asmutils dd doesn't have an option to suppress the stderr spam.

Will this work if stdin in connected to /dev/null instead? Anyway, good job!

@iBug: Nope. Depends utterly on stdin closed and the fact that asmutils sh isn't linked against libc and so doesn't inherit the auto-repair code in libc.

Do you need the #!/bin/sh?

@CalculatorFeline: that depends on the exactness of your definition of something else.

Generally, shebangs are not counted, so this would be 6 bytes.

><>, 16 + 16 = 32 bytes
":1-}80.r   !#o#

and
#o#!   r.08}-1:"

Try it online!
This works by using a jump in the program, the first programs jump will skip the reverse of the stack (if it reversed the stack it would be a quine).
The second program doesn't skip the reverse but was it's already reversed by the flow of the program then it'll create the originial.
This code will end in an error.

RProgN 2, 7 + 7 = 14 bytes
I wanted to try to show off a better usage of RProgN, rather than just abusing print orders...
1
«\1\-

and...
0
«\1\-

Explained
1   # Push the constant, 1. (Or 0, depending on the program)

«\1\-
«       # Define a function from this to the matching », in this case there isn't any, so define it from this to the end of the program, then continue processing.
 \      # Flip the defined function under the constant.
  1\-   # Get 1 - Constant.

Because this prints the stack upside down, the new constant is printed first, then the stringifed version of the function is printed.
Try it online!

Common Lisp, 58 characters
#1=(let((*print-circle* t))(print'(write '#1# :circle t)))

... or 24 characters if you don't mind assuming *print-circle* is globally set to T :
#1=(print '(write '#1#))

The printed representation of the code is read as a cyclic structure, where #1# points back to the cons cell following #1=. We quote programs so that they are not executed. Since *print-circle* is T, the REPL takes care to emit such reader variables during printing; this is what the above code prints, and returns:
#1=(write '(print '#1#))

When we evaluate the above code, it prints:
#1=(print '(write '#1#))

If you want to stick with the default value for *print-circle*, which is NIL in a conforming implementation, then you'll have to rebind the variable temporarily:
#1=(let((*print-circle* t))(print'(write '#1# :circle t)))

Inside the body of the LET, we print things with *print-circle* being T. So we obtain:
#1=(write
    '(let ((*print-circle* t))
       (print '#1#))
    :circle t)

As you can see, the new program doesn't rebind *print-circle*, but since we are using write, which is the low-level function called by print, we can pass additional arguments such as :circle. The code then works as expected:
#1=(let ((*print-circle* t))
     (print '(write '#1# :circle t)))

However, you need to execute the above programs as a script, not inside a REPL, because even though you print things while taking care of circular structures, both write and print also returns the value being printed; and in a default REPL, the value is also being printed, but outside of the dynamic context where *print-circle* is T.

LOGO, 65 + 66 = 131 bytes
apply [(pr ? ` [[,? ,-?2]] )] [[apply [(pr ? ` [[,? ,-?2]] )]] 1]

and
apply [(pr ? ` [[,? ,-?2]] )] [[apply [(pr ? ` [[,? ,-?2]] )]] -1]

Python 3, 74+74=148 bytes
a='a=%r;b=%r;print(b%%(b,a))';b='b=%r;a=%r;print(a%%(a,b))';print(b%(b,a))

and
b='b=%r;a=%r;print(a%%(a,b))';a='a=%r;b=%r;print(b%%(b,a))';print(a%(a,b))

i don't understand it either

><>, 12 + 12 = 24 bytes
'3d*!|o|!-c:

and
':c-!|o|!*d3

Try it online!
Both programs use a wrapping string literal to add the code to the stack, then produce the ' command through different methods. When printing the stack it pushes the code backwards, however the ' stays at the front. There are several variations that produce the '; 3d*, d3*, 00g, :c- when paired with 3d* and :9- when paired with 00g.
A too similar solution to post, in Befunge-98 for 13*2 bytes
"2+ck, @,kc+2

Stax, 18+20=38 bytes
"Vn|^34bL"Vn|^34bL

Run and debug online!
"Vn|^34bL
"Vn|^34bL

Run and debug online!
Explanation
Added for completeness. Port of @jimmy23013's CJam answer. Toggles the newlines using set xor.

Javascript (ES6), 36 + 36 = 72 bytes
Program 1:
f=n=>('f='+f).replace(/4|5/g,n=>n^1)

Program 2:
f=n=>('f='+f).replace(/5|4/g,n=>n^1)

These programs work by cloning themselves and replace 5 with 4 and 4 with 5

console.log((
    f=n=>('f='+f).replace(/4|5/g,n=>n^1)
)())
console.log((
    f=n=>('f='+f).replace(/5|4/g,n=>n^1)
)())

Since this is tagged [tag:quine], this is what would usually be considered a "cheating quine", since it reads its own source. Not sure what OP's decision on that is, but they are usually not allowed.

Klein, 26 24 bytes
<:3+@+3<:"

Try it online!
Explanation
This works the same as my Klein Quine, where it prints the source backwards followed by a ", the last one got away with this by being palindromic, so all we need to do is make it non-palindromic without damaging its functionality.  By switching < and : we were able to do this without interfering with functionality.

Pari/GP, 36 + 36 = 72 bytes
(f=(x)->print1("(f="f")("1-x")"))(1)

Try it online!
(f=(x)->print1("(f="f")("1-x")"))(0)

Try it online!

Python 2, 42 + 43 = 85 bytes,
Python 3, 44 + 45 = 89 bytes
Python 2 (85 bytes):
a='a=%r,-%d;print a[0]%%a',-1;print a[0]%a    # Program 1: 42 bytes
a='a=%r,-%d;print a[0]%%a',--1;print a[0]%a   # Program 2: 43 bytes

Try it online!
Python 3 (89 bytes):
a='a=%r,-%d;print(a[0]%%a)',-1;print(a[0]%a)    # Program 1: 44 bytes
a='a=%r,-%d;print(a[0]%%a)',--1;print(a[0]%a)   # Program 2: 45 bytes

Try it online!
How it works? :
I started from the standard a='a=%r;print(a%%a)';print(a%a) quine. But instead of having a equal only to a string, I have a equal to a tuple regrouping a sting and an integer.
I add the char - in front of my integer:

if it is equal to -1, -%d will be equal to --1
if it is equal to --1, %d will evaluate it as 1 so -%d will be equal to -1

Edits:
I found aferwards this pretty elegant solution. Not better, just elegant. (58 + 58 = 116 bytes):
a="print'a=%r;exec a.lower()'%a.swapcase()";exec a.lower() # 58 char each
a="PRINT'A=%R;EXEC A.LOWER()'%A.SWAPCASE()";exec a.lower() # 116 bytes in total

Try it online!


text:
Is it a Lynch-Bell number?
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.

Related. (Asks for all the numbers instead of posing a decision problem.)

Can I take input as a string?

@TheLethalCoder Of course you can, that's a silly question.

@Okx Not all challenge posters are as flexible in their allowed inputs as you so always worth an ask.

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.

##&@@d&&##&@@? What does that even do?

@Okx Added an explanation.

May be you can replace 0!= by  0< ?

@sergiol I'd have to sort the digits to do that.

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!)

Please post an ungolfed version.

Also, I is always Unequal to digits.

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.

Is this inputting as a string?

This 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!

@CalculatorFeline Yes.

@CRDrost 1) the ouput well defined so there is no problem (usually) 2) there will never be 0 in the input

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.

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.

There's also gQV= if you prefer an ASCII-only solution.

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

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)

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)

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.

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.

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();
    }
}

Obligatory xkcd

05AB1E, 4 bytes
ÑÃÙQ

Try it online!
Same algorithm as this answer to a related question.

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!

Welcome to PPCG!

Welcome! Like Rod's, your function throws an exception on input "10".

@CRDrost "You will be given a positive, whole number (that will never contain a 0) as input."

Right, I've posted comments everywhere else I complained about this, but I apparently missed this one. Sorry, retracted!

@CRDrost No worries!

Regex (ECMAScript), 194 171 167 164 155 145 142 107 bytes
-35 bytes (142 → 107) thanks to H.PWiz; this is a complete reimplementation. The primary sources of bytes saved are using tail = floor((tail + Digit) / 10) - Digit instead of tail = floor(tail / 10) , and "factoring" the assertions – reusing the expression at the end to mean two different things.
^(?!(x{1,9})(((?=(x*)((\1\4){9}x*))\5)*(?=(x*)(\7{9}$))\8\1|(?!\1*$))((?=(x*)((\1\10){9}x*))\11)*(x{10})*$)
Try it online!
Takes its input in unary, as a sequence of x characters whose length represents the number.
This was an interesting challenge to solve without molecular lookahead or variable-length lookbehind. The restrictions result in a completely different algorithm being used.
Note that the above version does not reject numbers that have a zero as at least one of their digits, as per the challenge's rules. It costs 2 bytes 10 bytes to handle zero correctly, for a total of 144 117 bytes:
^(?!(x{0,9})(((?=(x*)((\1\4){9}x*))\5)*(?=(x*)(\7{9}$))\8\1|(?!\1*$))((?=(x*)((\1\10){9}x*))\11)*((x{10})+|(?!\1))$)x
Try it online!
The commented version below describes the 144 117 byte version:
^           # tail = N = input number
(?!         # Negative lookahead - Assert that there's no way for the following to match:
    (x{0,9})                       # \1 = conjectured digit; tail -= \1
    # Assert one of the following two alternatives:
    (
        # Assert that \1 occurs as a digit of N, and chop it away (and all the digits
        # right of it) from tail, returning only the digits left of its found instance.
        (
            (?=
                (x*)((\1\4){9}x*)  # \4 = floor((tail + \1) / 10) - \1;
                                   # \5 = tool to make tail = \4
            )
            \5                     # tail = \4
        )*
        (?=
            (x*)(\7{9}$)           # assert tail % 10 == 0; \7 = tail / 10;
                                   # \8 = tool to make tail = \7
        )
        \8\1                       # tail = \7 - \1 (all the digits of N left of where \1
                                   #                 was found, minus \1)
    |
        # Assert that \1 is not a divisor of N
        (?!\1*$)
    )
    # Assert that \1 occurs as a digit in tail+\1, which will either be a second occurrence
    # found further left in N of an already-found occurrence, or any occurrence of a digit
    # that is not a divisor of N.
    (
        (?=
            (x*)((\1\10){9}x*)     # \10 = floor((tail + \1) / 10) - \1;
                                   # \11 = tool to make tail = \10
        )
        \11                        # tail = \10
    )*
    # Assert one of the following two alternatives:
    (
        # Assert tail > 0 and tail % 10 == 0, which means we've found an occurrence of \1
        # that isn't the leftmost digit
        (x{10})+
    |
        # Assert tail == 0 and tail != \1, which means we've found that \1 is the leftmost
        # digit of N and \1 != 0 (which needs to be asserted, otherwise we'd always find
        # a phantom occurrence of the digit 0 left of the leftmost digit of N)
        (?!\1)
    )$
)
x                                  # Prevent N=0 from being matched

The version above is very slow, so I'm keeping my 144 byte solution here:
^(?!(?=(x*)\1{9})(x{0,9})(?=(x{10})*$|(.*(?=\1$)((?=(x*)(\6{9}x*))\7)*?\B(?=(x*)(\8{9}\2$))\9))((?!\2*$)|\4((?=(x*)(\12{9}x*))\13)*\2(x{10})*$))
Try it online!
^           # tail = N = input number
(?!         # Negative lookahead - Assert that there's no way for the following to match:
    (?=(x*)\1{9})                # \1 = floor(N / 10)
    (x{0,9})                     # \2 = take a guess at a numeral that may occur as any
                                 #      digit of N, even the rightmost one; tail -= \2
    # Assert that \2 occurs as a digit in N, and if it does, identify the rest of N to
    # the left of that digit, so that we can set tail equal to it later (so we can later
    # assert that \2 is not duplicated).
    (?=
        (x{10})*$                # Skip the rest if we picked the rightmost digit of N
    |
        (                        # \4 = tool to make tail = \8
            .*(?=\1$)            # tail = \1
            # Loop through chopping away each rightmost decimal digit of tail, one by one
            (
                (?=
                    (x*)         # \6 = floor(tail / 10)
                    (\6{9}x*)    # \7 = tool to make tail = \6
                )
                \7               # tail = \6
            )*?                  # Only iterate until we find the first match of the
                                 # following:
            \B                   # Leave at least one digit remaining (to avoid
                                 # thinking we've found a zero-digit when there isn't
                                 # actually one)
            (?=(x*)(\8{9}\2$))   # \8 = floor(tail/10); \9 = tool to make tail = \8;
                                 # assert that tail % 10 == \2, i.e. that our guessed
                                 # digit matches the current rightmost digit of tail
            \9                   # tail = \8
        )
    )
    # \2 is now one of the decimal digits of N.
    # Assert that either of the following two alternatives could match, and in the
    # context outside of the negative lookahead, that neither of them can match:
    (
        # Assert tail is not divisible by \2. It doesn't matter that tail == N-\2
        # instead of N, because that doesn't alter tail's divisibility by \2.
        (?!\2*$)
    |                            # or...
        # Assert that \2 doesn't occur as any decimal digit left of where it was found
        \4                       # tail = \8 if \8 is set, otherwise no change; this
                                 #        relies on ECMAScript NPCG behavior.
        # Chop away any number (minimum 0) of rightmost decimal digits of tail
        (
            (?=(x*)(\12{9}x*))   # \12 = floor(tail / 10);
                                 # \13 = tool to make tail = \12
            \13                  # tail = \12
        )*                       # Iterate any number of times, minimum 0
        \2                       # tail -= \2
        (x{10})*$                # assert tail is divisible by 10
    )
)

Regex (ECMAScript + (?*)), 81 bytes
^(?!(?*(((?=(x*)(\3{9}(x*)))\4)+))((?!\5+$)|\1((?=(x*)(\8{9}x*))\9)*\5(x{10})*$))
This challenge is much easier to solve with molecular lookahead; it's the version I implemented first.
Working on this alerted me to the presence of a bug in my regex engine (now fixed).
^           # tail = N = input number
(?!         # Negative lookahead - Assert that there's no way for the following to match:
    (?*     # Molecular lookahead - cycle through all possible matches of the following:
        (                            # \1 = tool to make tail = the final value of \3
            # Loop through chopping away each rightmost decimal digit of tail, one by one
            (
                (?=(x*)(\3{9}(x*)))  # \3 = floor(tail / 10); \4 = tool to make tail = \3;
                                     # \5 =       tail % 10
                \4                   # tail = \3
            )+                       # Iterate at least once, otherwise \5 could be unset
            # The above loop relies on ECMAScript no-empty-optional behavior. This
            # prevents it from matching when the final result of zero is again divided
            # by 10, which would yield a value of \5 = 0, making it look like one of N's
            # digits was zero and preventing all values of N from matching.
        )
    )
    # \5 is now one of the decimal digits of N, and tail==N again
    # Assert that either of the following two alternatives could match, and in the context
    # outside of the negative lookahead, that neither of them can match:
    (
        (?!\5+$)                     # Assert tail is not divisible by \5
    |                                # or...
        # Assert that the \5 doesn't occur as any decimal digit left of where it was found
        \1                           # tail = \3
        # Chop away any number (minimum 0) of rightmost decimal digits of tail
        (
            (?=(x*)(\8{9}x*))        # \8 = floor(tail / 10); \9 = tool to make tail = \8;
            \9                       # tail = \8
        )*                           # Iterate any number of times, minimum 0
        \5                           # tail -= \5
        (x{10})*$                    # assert tail is divisible by 10
    )
)

Regex (ECMAScript 2018), 85 bytes
^(?!((?=(x*)(\2{9}(x*)))\3)+((?<=(?=(?!\4+$))^.*)|((?=(x*)(\7{9}x*))\8)*\4(x{10})*$))
Try it online!
This is a port of the molecular lookahead version. The most direct port would be replacing (?*A)B with A(?<=(?=B)^.*), but that would result in an 89 byte regex.
^           # tail = N = input number
(?!         # Negative lookahead - Assert that there's no way for the following to match:
    # Loop through chopping away each rightmost decimal digit of tail, one by one
    (
        (?=(x*)(\2{9}(x*)))      # \2 = floor(tail / 10); \3 = tool to make tail = \2;
                                 # \4 =       tail % 10
        \3                       # tail = \2
    )+                           # Iterate at least once, otherwise \4 could be unset
    # The above loop relies on ECMAScript no-empty-optional behavior. This prevents it
    # from matching when the final result of zero is again divided by 10, which would
    # yield a value of \4 = 0, making it look like one of N's digits was zero and
    # preventing all values of N from matching.

    # \4 is now one of the decimal digits of N, and tail==\2
    # Assert that either of the following two alternatives could match, and in the context
    # outside of the negative lookahead, that neither of them can match:
    (
        (?<=                     # Variable-length lookbehind - used to go back to start
            (?=
                # now tail==N again
                (?!\4+$)         # Assert tail is not divisible by \4
            )
            ^.*                  # Go back to start, then execute the above lookahead
        )
    |                            # or...
        # now tail==\2
        # Assert that the \4 doesn't occur as any decimal digit left of where it was found
        # Chop away any number (minimum 0) of rightmost decimal digits of tail
        (
            (?=(x*)(\7{9}x*))    # \7 = floor(tail / 10); \8 = tool to make tail = \7;
            \8                   # tail = \7
        )*                       # Iterate any number of times, minimum 0
        \4                       # tail -= \4
        (x{10})*$                # assert tail is divisible by 10
    )
)

Scratch, 249 bytes
Try it online!
I feel as though this could be improved by a few bytes, but I'm not sure...
when gf clicked
ask()and wait
set[C v]to()
set[N v]to(answer
repeat(length of(n
change[C v]by(1
add(letter(C)of(N))to[B v
end
say[T
repeat(C
set[D v]to(item(1)of[B v
delete(1)of[B v
if<<[B v]contains(D)?>or<not<((N)/(D))=(round((N)/(D)))>>>then
say(

Alternatively, 34 blocks.

J, 17 bytes
[:(<.-:~.)10&#.%]

Try it online!
Take input as list of digits.

10&#.%] The list of quotients.  Returns floats.
(<.-:~.) Does the unique of that list ~. match -: the list formed by rounding every element down to an integer <.?

Japt, 15 14 11 10 9 bytes
ì®yUÃ¥Uìâ

Try it

©! -> « for -1 byte

Thanks, @JustinMariner; don't know how that went so long without being spotted! I found a shorter solution, though.

Jelly, 8 bytes
D⁼QaDḍ$Ạ

Try it online!

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

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.

This function fails on the input 10.

Sorry, I am wrong about that -- I missed that you're not required to provide any answer for inputs that have 0s in them.

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.

Excel, 76 74 bytes
-2 bytes using ROWS instead of COUNTA
=LET(n,LEN(A2),d,MID(A2,SEQUENCE(n),1),AND(ROWS(UNIQUE(d))=n,MOD(A2,d)=0))

Spreadsheet
LET(                               'Assign Variables
n,LEN(A2)                          '   n = # of digits
d,MID(A2,SEQUENCE(n),1)            '   d = array of digits
AND(ROWS(UNIQUE(d))=n,MOD(A2,d)=0) 'Result
    ROWS(UNIQUE(d))=n              '   # unique d = n
                      MOD(A2,d)=0  '   number mod d = 0
AND(                             ) '   and all tests

Original
=LET(n,LEN(A2),d,MID(A2,SEQUENCE(n),1),AND(COUNTA(UNIQUE(d))=n,MOD(A2,d)=0))

K (ngn/k), 22 bytes
{&/~(t*t~?t:10\x)!\:x}

Try it online!

(...t:10\x) get the individual digits of the input, storing in t
(t*t~?t...) if the digits aren't all unique, multiply them by 0 (otherwise leave them as-is)
(...)!\:x mod the input by each of the digits (with x mod 0 == x)
&/~ are all the remainders 0?

Vyxal, 57 bitsv2, 7.125 bytes
:₌Kf↔$f⁼

Try it Online!
Bitstring:
010100100010101011101010110011110100011101011011111010110

Uiua, 13 bytes
≍⊝⌊.÷-@0$"_".

Try it online!
Not too bad, given the bulky syntax to convert a number into its decimal digits. The main idea is taken from alephalpha's Nekomata answer.
Note: the symbol for "match" (test if two arrays are structurally equal as a whole) has been changed from ≅ to ≍.
Also, this code doesn't work when the input contains a 0, because division by 0 gives NaN, floor of NaN is still NaN, and two NaNs are equal.
≍⊝⌊.÷-@0$"_".    input: a positive integer
         $"_"     stringify the input
      -@0         subtract '0' from each char, giving decimal digits as numbers
     ÷       .    divide the original number by each digit
≍⊝⌊.             test if this array, floored and deduplicated, still equals itself

A version that also handles zero digits (giving falsy) in 15 bytes (Try it):
≍⊚=0⊃◿⊛-@0$"_".
          -@0$"_"     decimal digits of input
     ⊃◿⊛       .    push (input % digits, classification of digits)
                      (classify: assign a unique index to each unique element)
 ⊚=0                 indices where input % digits == 0
≍                    match?

The final match gives 1 if and only if the number is Lynch-Bell, because:

indices where input % digits == 0 has the length equal to the number of digits if and only if input % digits == 0 is all true,
its result is precisely 0 1 2 ... x-1 where x is the number of digits in that case, and
the classification is the same if and only if the digits are all unique.

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!

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.

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

Welcome 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.

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

@Laikoni Thanx for your advice! I'm looking into it

05AB1E, 8 bytes
SÖP¹DÙQ*

Uses the 05AB1E encoding. Try it online!

Mathematica, 57 bytes
Tr@Boole[IntegerQ/@Union[s=#/IntegerDigits@#]]==Length@s&

You can save numerous bytes if you use the builtin IsLynchBellNumber

why don't you make the same offer to Martin?

@Okx but it's less fun that way.

@QBrute Can you take a joke?

@Okx It would have been more believable as LynchBellNumberQ. ;)

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...

Can't you remove some of the whitespace like 'L="y"'

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....

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)

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.

Perl 5 -p, 34 29 bytes
$_=!grep$k{$_}++|"@F"%$_,/./g

Try it online!

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.

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

(,⍵)≡∪ → (,=∪)

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!
R, 62 bytes
Golf by Giuseppe
all(table(d<-utf8ToInt(x<-scan(,''))-48)<2)&all(!strtoi(x)%%d)

Try it online!

63 bytes.

@Giuseppe How you do it I'll never know...

Practice, haha. I started with minor golfs like substituting strtoi for as.double, then noticed that digits were being extracted twice (once with utf8ToInt and once with strsplit), so I got them once at the beginning (with strsplit), then tried to get rid of the strtoi entirely by using utf8ToInt()-48 (which I didn't notice before, but that's also shorter than strsplit), but I wasn't able to get it down all the way.

Another failed approach was to try to collapse the all(...)&all(...) into one all(...&...), which errored out. I did manage to find 62 bytes by better in-lining of assignments, though, so that's neat.

Nekomata + -e, 3 bytes
Ɗ¦ů

Attempt This Online!
Ɗ¦ů
Ɗ       Decimal digits
 ¦      Divided by, and check if the result are integers
  ů     Check if all elements are unique

Q: Is there a way that you could adjust this so it doesn't need a flag?  Or is the existence/nonexistence of the non-deterministic solutions 'invisible' from within the program?

@DominicvanEssen Nekomata doesn't have truthy/falsy. so the flag -e is needed for every [tag:decision-problem] challenge.

@DominicvanEssen You can add an n (\countValue) to the end of the code so that it returns 1 and 0 (Attempt This Online!). But they are not truthy/falsy by this definition on meta.

Surely 'non-fail' and 'fail' could be considered to be analogous to 'truthy' and 'falsy'?  So andThen behaves as "if X doesn't fail, then ..." like this, and if behaves as "if X fails, then ..." like this...

(in which case, Ɗ¦ů is already valid as a decision function as-is, returning 'non-fail' or 'fail', and the -e flag is just for pretty output, and not really required...)

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

(No TIO yet, sorry)

Neim, 9 bytes
ℚ₁₁₁ℚ

Try it online!
-2 thanks to Okx.
Hmm, there's a nice symmetry... oO.O.O.Oo

You can golf D to ℚ (uniquify, check for equality ignoring types)

Still room for golfing there ;)

@Okx Hmm...I don't see anything particularly interesting there.

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!

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.

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")
}

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!

PowerShell, 95 bytes
param($n)$a="$n"|% t*y;if($n-eq([int](($a|gu)-join''))){
($a|%{12%[int]"$_"})-contains0}else{0}

Try it online!

54 and 1232 should be falsy

APL (Dyalog Unicode), 31 bytes
{∧/(0=⍺|⍨¨⍵)∧(⊢≡∪)⍵}∘(10⊥⍣¯1⊢)⍨
 ∧/ ⍝ reduction by logical AND
   0=⍺|⍨¨⍵ ⍝ divisibility check
     ∧ ⍝ logical AND
       (⊢≡∪)⍵ ⍝ check for unique digits
         ∘ ⍝ function composition operator (Beside)
           10⊥⍣¯1⊢ ⍝ convert to array of digits
             ⍨ ⍝ commute operator (Selfie), used to copy input to left side of the composed function

Try it online!

Python 3, 88 86 bytes
def f(n):
 s=""
 for i in n:
  if i in s or int(n)%int(i)!=0:return 0
  s+=i
 return 1

Fixed that it wasn't running with whitespace removed - thanks to @caird coinheringaahing

Welcome to Code Golf! Your version without whitespace doesn't work, but it's an easy fix and golf

@cairdcoinheringaahing Thanks for checking, is there a syntax guide anywhere for writing functions without whitespace without messing them up and having them not run?

Not sure about a syntax guide but feel free to check out our New users guide for golfing in Python for more info

@cairdcoinheringaahing Okay thanks. What actually is it about the syntax that isn't allowed?

So long as the program runs as is, it's a valid submission. As the program doesn't run when you remove the newlines, it isn't a valid submission

Desmos, 109 bytes
n=q-48
l=n.length
abs(\prod_{a=1}^l\prod_{b=a+1}^{l}(n[b]-n[a])(1-sign(mod(\sum_{c=1}^ln[c]10^{l-c},n).max)))

View it in Desmos
There's got to be a better way to do this, but I can't come up with it right now. This is sort of split up into a few sections:
n=q-48

This turns codepoints into digits for convenience's sake
\prod_{a=1}^l\prod_{b=a+1}^{l}(n[b]-n[a])

This checks if any two digits are equal, and if so, returns 0
\sum_{c=1}^ln[c]10^{l-c}

This turns the list of digits into the number
1-sign(mod(\sum_{c=1}^ln[c]10^{l-c},n).max)

This uses the previous section to check if any digit isn't divisible by the sum, and if so, returns 0
Then we turn this into a 1 if the result succeeds both tests and 0 if it fails one. We can cut out 5 bytes if we accept any non-zero number as true by removing the abs( from the start of the third equation and ) from the end, but I'm not sure if negative numbers really count as truthy. We can also get rid of 6 bytes if we can accept a list of digits as input rather than a string.

JavaScript (Node.js), 33 bytes
s=>[...s].every(y=e=>y[e]^=s%e<1)

Try it online!
If an e appears twice then s%e<1 is still true, and y[e]^= returns 0

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Fewest operations to 100
Overview
Given a list of digits, find the fewest operations to make 100
Input
A string of digits, which may or may not be in numerical order. The order of the digits cannot be changed, however plus (+) or minus (-) operators may be added between each so that the total sum is equal to 100.
Output
The number of operators added, followed by the full sequence of digits and operators. The two can be separated by a space, tab, or new line sequence.
Examples
valid
Input: 123456789
Output: 3 123–45–67+89
Invalid
Input: 123456789
Output:
6
1+2+34-5+67-8+9
(There are ways of solving this with fewer operations)

Related

Do we have to use all of the digits? Can we only use + and -? Can we assume we will always be able to make 100 from the input?

@TheLethalCoder All digits must be used, and must remain in the same order. The only thing that can be changed is adding + and -.

Some more test cases would be much welcome.

Is the input guaranteed to lead to at least one solution? If not, what's the expected output?

@Arnauld Yes, there will always be at least 1 possible solution

Is output such as {3, "123-45-67+89"} (use language-specified tuple structure) acceptable?

Can you confirm that signs cannot be prepended to the first digit? That is, given input 299399, would -299+399 be valid?

May we use our languages native operators (or even any alternative but consistent characters) in the output?

Is '0' a digit? E.g., is '10808' a valid input? Is '1 108-08' a valid response?

@KeyuGan yes, as long as the two components are obviously seperate

@LuisMendo no, signs can only be added between digits

@ChasBrown yes, 0 is a digit

@JonathanAllan Yes

JavaScript (ES6), 153 176 bytes
EDIT: In non-strict mode, JS interprets 0-prefixed numerical expressions as octal (e.g. 017 is parsed as 15 in decimal). This is a fixed version that supports leading zeros.

let f =

s=>[...Array(3**(l=s.length,l-1))].map((_,n)=>m=eval((x=s.replace(/./g,(c,i)=>c+['','+','-'][o=(n/3**i|0)%3,j-=!o,o],j=l)).replace(/\b0+/g,' '))-100|j>m?m:(S=x,j),m=l)&&m+' '+S

console.log(f("123456789"))
console.log(f("20172117"))

Nice, what about 20172117 as input?

@LuisMendo Actually, I think the expected answer is 2-017-2+117. But 017 is an octal notation in JS, which gives 15 in decimal. So my current code only finds 2-0-17-2+117. I'll try to address that problem later today.

@Arnauld Ah, I hadn't seen that other solution. Removing my comment

@mdahmoune Thanks for bringing this up. Now fixed.

3**(l=s.length,l-1) => 3**~-(l=s.length)

MATL, 37 36 bytes
n'+-'OhZ^!t2\s&SZ)"G@!vXzU100=?@z3M.

The test case takes about 6 seconds in TIO.
Try it online!
How it works
n        % Implicitly input a string. Number of elements, say k
'+-'     % Push this string
Oh       % Append char 0. This is treated like ' ' (space)
Z^       % Cartesian power of the three-char string '+- ' raised to k.
         % Gives a matrix where each row is a Cartesian k-tuple
!        % Transpose
t        % Duplicate
2\       % Modulo 2. This turns '+' and '-' into 1, and ' ' into 0
s        % Sum of each column: number of '+' and '-' symbols
&S       % Sort and push the indices of the sorting
Z)       % Apply as column indices. This sorts the columns (k-tuples)
         % by the number of '+' and '-' they contain
"        % For each column, i.e. each k-tuple formed by '+', '-' and ' '
  G      %   Push input string again
  @!     %   Push k-tuple as row vector (string)
  v      %   Concatenate vertically into a 2×k char array
  Xz     %   Remove space (and char 0). Gives a string as result. In this
         %   process, the 2×k array is linearized in column major order
         %   (down, then across). So the '+' and '-' signs are between
         %   digits of the input, or at the end
  U      %   Convert to number. This performs the operation determined by
         %   by the '+' and '-' signs and returns the result. A trailing
         %   '+' or '-' sign makes the input invalid, which causes an
         %   empty result
  100=   %   Is it equal to 100?
  ?      %   If so
    @    %     Push current k-tuple
    z    %     Number of nonzeros, i.e. of '+' and '-' signs
    3M   %     Push linearized string without spaces again
    .    %     Break for loop
         %   Implicit end
         % Implicit end
         % Implicitly dispplay stack

Great, what about 299399 as input?

@mdahmoune 299399 has no solution and is hence not a valid input (the operators were specified to go "between" the digits, that input would require -299+399 where the - is not between digits).

@mdahmoune If the signs can only be inserted between the digits (as the challenge text says), I think there is no solution. If they can also be prepended to the first digit, the solution is -299+399, and in that case I need a small change in my code. I've asked the OP for clarification

Also noteworthy that if it were meant to be both before and between then the example 123456789 should have an operator count of 4 not 3.

@mdahmoune The OP has confirmed that signs can only be between digits. So my code is correct and 299399 is an invalid input because, as the OP has also clarified, every input should have at least one solution

Jelly, 32 bytes
L’⁾+_ṗż@€
ŒṖÇ€ẎµFV=ȷ2µÐfLÞḢFṄḟ³L

A full program which displays using the Jelly operators (_ instead of -).
Note: To show - in the output instead of _ (not a requirement) add ⁾_-y between F and Ṅ (⁾_- is a character pair literal ['_','-'] and y is the dyadic "translate" atom).
How?
L’⁾+_ṗż@€ - Link 1, form all sums from a partition: list of lists of characters
                                     e.g. ["12","345","67"]
L         - length                        3
 ’        - decremented                   2
  ⁾+_     - literal ['+','_']
     ṗ    - Cartesian power               ["++","+_","_+","__"]
      ż@€ - zip for €ach (swap @rguments) ["12+345+67","12+345_67","12_345+67","12_345_67"]

ŒṖÇ€ẎµFV=ȷ2µÐfLÞḢFṄḟ³L - Main link: list of characters
ŒṖ                     - all partitions
  Ç€                   - call the last link (1) as a monad for €ach
    Ẏ                  - tighten (flatten by 1 level)
     µ     µÐf         - filter keep if:
      F                -   flatten
       V               -   evaluate as Jelly code (perform the sum)
         ȷ2            -   literal 100
        =              -   equal?
               Þ       - sort by:
              L        -  length
                Ḣ      - head
                 F     - flatten
                  Ṅ    - print that and a newline
                   ḟ³  - filter out the characters from the input
                     L - length (number of operators)
                       - implicit print

Try it online!

PHP, 166 171 bytes
for(;$n<3**$e=strlen($x=$argn);eval("return $s;")-100?:$r[]=sprintf("%2d $s",strlen($s)-$e))for($i=0,$s="",$k=$n++;a&$c=$x[$i];$k/=3)$s.="+-"[$i++?$k%3:2].$c;echo min($r);

Run as pipe with -nR or test it online.
uses formatted numbers to sort the results -->
may print leading blanks (and may fail for input with more than 99 digits; increase the number at %2d to fix).
no more than 10 digits, 161 bytes
for(;$n<3**$e=strlen($x=$argn);eval("return $s;")-100?:$r[]=(strlen($s)-$e)." $s")for($i=0,$s="",$k=$n++;a&$c=$x[$i];$k/=3)$s.="+-"[$i++?$k%3:2].$c;echo min($r);

breakdown
for(;$n<3**$e=strlen($x=$argn); # loop $n up
    eval("return $s;")-100?:        # 2. evaluate term, if 100 then
                                    # prepend number of operations, add to results
        $r[]=sprintf("%2d $s",strlen($s)-$e)
)
                                # 1. create term
    for($i=0,$s="",$k=$n++;         # init variables, increment $n
        a&$c=$x[$i];$k/=3)          # loop through digits/operator index
        $s.="+-"[$i++?$k%3:2].$c;   # prepend operator for base-3 digit (nothing for 2)
echo min($r);                   # print lowest result

[Python 2], 164 158 bytes
from itertools import*
f=lambda N:min((len(s)-len(N),s)for s in(''.join(sum(zip(N,p+('',)),()))for p in product(('+','-',''),repeat=len(N)-1))if eval(s)==100)

Try it online!
Take N as a string of digits; returns a tuple (numOps, expressionString).
Basically the same approach as others; uses itertools.product to construct the individual "cases" e.g. for N=='1322', a "case" would be ('-','','+'), and would evaluate '1-32+2'.
Throws an ValueError if the input is invalid (but I think OP gauranteed no invalid inputs).

Brachylog, 36 bytes
~cịᵐ{|ṅ}ᵐ{+100&{ℕṫ,"+"↻|ṫ}ᵐcbE&kl;E}

Try it online!
More than half of this is to get the output format right though. The actual core logic is only:
15 bytes
~cịᵐ{|ṅ}ᵐ.+100∧

Try it online!
This returns a list like [123,–45,–67,89]. The expression is the sum of the elements, and the number of operators is 1 less than the length of the list.
~cLhℕ∧100~+L almost works for 12 bytes (Try it online!) - but it's too slow to handle full 9 digit input on TIO, and more importantly, it fails for inputs like 10808 - Brachylog is too smart to split numbers to have leading zeros, so doesn't see the [108, -08] partition.

Python 2, 256 230 208 205 172 171 170 165 bytes, iterative method

33 thanks to Chas Brown
One saved byte when replacing len(a) by w
One saved byte when replacing z-=1;d=z by d=z=z-1

q=[];a=input()
w=len(a);z=n=3**w
while z-n/3:
 d=z=z-1;j=0;b=''
 while d:r=d%3;d/=3;b+=a[j]+chr(r+43)*(d>0!=r-1);j+=1
 if eval(b)==100:q+=[(len(b)-w,b)]
print min(q)

Try it online!
Little explanation
Using the representation in base 3, the code interleaves the digits with the operators {'+','-',concatenation} according to all possible combinations.
Python 2, 167 bytes, recursive method
def f(s):
 if len(s)==1:return[s]
 b=s[0];q=[]
 for z in f(s[1:]):q+=[b+'+'+z,b+'-'+z,b+z]
 return q
a=input()
print min((len(x)-len(a),x)for x in f(a)if eval(x)==100)

Try it online!
Some outputs
"399299"    --> (1, '399-299')
"987654321" --> (4, '98-76+54+3+21')
"1111111"   --> (3, '1+111-1-11')

I like the use of divmod! A few golfs I can see: replace list(input()) with just input(), since a string is already iterable to save 6 bytes; replace b.count('+')+b.count('-') with len(b)-len(a) to save 12 bytes; and replace chr(r+43) with chr(r+43)*(d>0!=r-1) and then you can delete the line b=b[:-1].replace(',','') to save net 15 bytes ((d>0!=r-1) is equivalent to (d>0 and 0!=r-1)).

Mathematica, 136 146 149 156 165 166 bytes
#&@@Sort[{StringLength@#-e+9!(ToExpression@#-100)^2,#}&/@StringJoin/@(Riffle[b,#]&)/@Tuples[{"","+","-"},(e=Length[b=Characters@#])-1]]&

Returns {3, 123-45-67+89} for example.
The test case takes about 0.09 seconds to complete.

Haskell, 180 178 bytes
m#[a]=[[a]]
m#(b:r)|s<-m#r=m(b:)=<<[s,m('+':)s,m('-':)s]
o '-'=(-)
o _=(+)
(p:r)?a|[(b,s)]<-lex r=s?o p a(read b)
_?a=a
g s=minimum[(sum[1|c<-t,c<'0'],t)|t<-map#s,('+':t)?0==100]

Try it online! Usage: g "123456789" yields (3,"123-45-67+89").
# builds a list of all possible terms, ? evaluates a term and g filters those terms which evaluate to 100 and returns the one with the minimal number of operands.

Jelly, 27 bytes
L’““+“_”ṗ⁸żF¥ⱮV⁼ȷ2ƊƇLÞḢṄḟ⁸L

Try it online!
Can't say I didn't take a few hints from Jonathan Allan's older answer. ;-)
Compared to his answer, this one is just two bytes shorter (30), not five, if we make the comparison fair due to language updates:
L’““+“_”ṗ⁸żF¥Ð€V⁼ȷ2$$ÐfLÞḢṄḟ⁸L

If we compare the other way (newer version instead of older), the difference is the same (his becomes 29 bytes, seen below):
ŒṖżⱮL’⁾+_ṗƲ$€ẎFV=ȷ2ƲƇLÞḢFṄḟ³L

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Turn a string inside out
A balanced string is a string of parentheses () so that every parenthesis is can be matched with another one.  More rigorously they are the strings spanned by this grammar:
S → (S)S | ε

We can turn a string "inside out" by:

Switching all occurrences of ( and ) with each other
Moving characters from the front of the string to the back until the string is balanced again.

Lets do an example.
We start with the balanced string:
(()(())())

We then switch the parens to make
))())(()((

Then move characters from the front of the string to the back of the string until the string is balanced.
))())(()((
)())(()(()
())(()(())
))(()(())(
)(()(())()
(()(())())

Thats our result!

Note that some strings can be turned inside out in multiple ways, for example the string
(()())

When turned inside out can be either:
()(())

or
(())()

However every string has at least one solution.
Task
Write a program to take a balanced string as input and output that string turned inside out.  In cases where there may be multiple valid outputs you need only output one of them.  You may use a different brace type (<>,[] or {}) if you so wish.
This is a code-golf competition so you should aim to minimize your size of your source code, as measured by bytes.
Test Cases
(()())     -> ()(()), (())()
(()(())()) -> (()(())())
((())())() -> (()(()()))

Is it guaranteed that there is always a solution?

@LuisMendo Yes, I have proven this.  If you would like to see the proof, feel free to ping me in chat.

Thanks. It is sufficient for me to know that. Maybe you should write it into the challenge, otherwise you would need to define what to output if no solution

related

Haskell, 124 120 119 117 113 110 109 106 105 104 101 98 bytes
4 bytes saved thanks to bartavelle!
3 bytes saved thanks to Zgarb
1 byte saved thanks to Peter Taylor
Here's a solution I worked out in Haskell.  Its ok right now pretty good thanks to some help I received, but I'm looking to make this shorter, so feedback/suggestions are appreciated.
until(!0)g.map d
_!1=1<0
('(':a)!x=a!(x-1)
(_:a)!x=a!(x+1)
_!_=1>0
g(a:b)=b++[a]
d '('=')'
d _='('

Try it online!
Explanation
This program defines 4 functions,  the first (!) determines if a string is balanced.  Its defined as follows:
_!1=1<0
('(':a)!x=a!(x-1)
(_:a)!x=a!(x+1)
_!_=1>0

This check assumes that the input has an equal number of open and close parens thanks to a suggestion from Peter Taylor.
The next g will rotate the string once.
g(a:b)=b++[a]

Then we have d which simply takes a paren and mirrors it
d '('=')'
d _='('

Finally we have the function we are concerned with. Here we use a pointfree representation of until(!0)g composed with map d, which maps d to the input and applies g until the result is balanced.  This is the exact process described in the question.
until(!0)g.map d

You can scrap a few bytes with g x@(a:b)|x!0=x|1>0=g$b++[a] and removing the parens for d '('=')'.

@bartavelle Removing the parens for d causes a compiler error, believe me I've tried.  But the first suggestion is welcome. Thanks!

You can definitively drop those parens. Also, as your "f" function can be expressed in point-free style, you are allowed not to count the f= part. You can use CPP to make it fit in tio, like THAT !

@bartavelle I see, I need to add a space if I remove the parens.  Thanks!

You can save another byte in ! because you don't need to handle cases where the string has an unequal number of open and close parentheses, so you can swap the first two cases and have _!1=1<0 []!_=0<1

Use until to shorten g: TIO

I think there should be a decent saving by making d map '(' to (-1) and anything else to 1, and then the two longest cases of ! can be combined to (i:a)!x=a!(x+i). The top level structure then needs reworking to push map d into the until condition, and I have to run so I haven't got time right now to figure out what combinators are required to glue it all together.

@PeterTaylor I've been playing around with it and I haven't been able to figure a way to make it work.  The main drawback is you need to convert back to parens.  Originally I had intended for more lenient IO that would have made golfs like this possible but I forgot to include them and, but I don't want to abuse my power as OP.

@PeterTaylor I have this but it requires import Data.Char which ends up costing it bytes.

Yes, I realised that later. Sorry.

SOGL V0.12, 12 11 bytes
↔]»:l{Ƨ()øŗ

Try it Here!
Explanation:
↔            mirror characters
 ]           do ... while the top of stack is truthy
  »            put the last letter at the start
   :           duplicate it
    l{         length times do
      Ƨ()        push "()"
         ø       push ""
          ŗ      replace ["()" with ""]
             if the string left on stack is empty (aka all matched parentheses could be removed), then stop the while loop

Note: l{ could be replaced with ( for 10 bytes, but, sadly, it isn't implemented.

Are you sure that mirroring the characters works?  I don't know exactly what that means but my intuition tells me that it also reverses the order of the characters which, I don't think would work.

@Olmman It was intended to reverse the characters, but doesn't (which saves a byte here!). It's on V0.13s line-up to change trough. Example

CJam (20 chars)
q1f^0X${~_}%_:e>#)m<

Online demo
or for the same char count
q1f^_,,{0W$@<~}$W=m<

Online demo
Dissection
The two versions have a common header and footer
q1f^    e# Read input and toggle least significant bit of each character
        e# This effectively swaps ( and )

m<      e# Stack: swapped_string index
        e# Rotates the string to the left index characters

Then the bit in the middle obviously calculates how far it's necessary to rotate. Both of them use evaluation and rely on ( being the CJam decrement operator and ) being the increment operator.
0X$     e# Push 0 and a copy of the swapped string
{~_}%   e# Map: evaluate one character and duplicate top of stack
        e# The result is an array of the negated nesting depth after each character
_:e>    e# Copy that array and find its maximum value
#       e# Find the first index at which that value occurs
)       e# Increment

vs
_,,     e# Create array [0 1 ... len(swapped_string)-1]
{       e# Sort with mapping function:
  0W$@  e#   Rearrange stack to 0 swapped_string index
  <~    e#   Take first index chars of swapped_string and evaluate
}$      e# The result is an array of indices sorted by the negated nesting depth
W=      e# Take the last one

Retina, 46 38 bytes
T`()`)(
(.*?)(((\()|(?<-4>\)))+)$
$2$1

Try it online! Link includes test cases. Edit: Saved 8 bytes with help from @MartinEnder. The first stage simply transposes the parentheses, while the second stage looks for longest suffix that's a valid balanced prefix, which apparently is a sufficient condition for the rotation to be fully balanced. The balancing is detected using balancing groups. The construct ((\()|(?<-4>\)))+ matches any number of (s plus any number of )s as long as we have already (<-4>) seen as many (s. Since we're only looking for a valid prefix we don't have to match the remaining )s.

Normally, instead of repeating both parentheses, you just put them in an alternation, which saves a byte ((\()|(?<-2>\))). But your attempt just inspired me to find a completely new approach that saves another two: (?<-1>(\()*\))+. This will certainly come in handy in the future, so thank you. :)

It's even shorter to determine the rotation by matching the first suffix through which you can reach the end of the string without getting a negative stack depth: https://tio.run/##JcaxDkAwFIbRvc9xJd9fIcEqOnoBY4caDBaDeP@LdDrnPp7z2r1hLb4VVESgj0mQ5m5ayChmqc1EU7DRBncQUvj5rK1BLw

@MartinEnder I originally tried an alternation but I couldn't get it to work at the time, but I fail to see how (?<-1>(\()*\))+ even works, since it seems to want to pop from the 1 stack before having actually matched anything...

@MartinEnder As it happens, the alternation version seems to be golfer when it comes to matching balanced prefixes.

The actual popping happens at the end of the group, not the beginning. Good point with the alternation to avoid the duplicate \(* though.

JavaScript (ES6), 111 105 bytes
(Saved 2 bytes thanks to @CraigAyre, 2 bytes thanks to @PeterTaylor, 2 bytes thanks to @Shaggy.)
s=>(r=[...s].map(c=>'()'[c<')'|0])).some(_=>r.push(r.shift(i=0))&&!r.some(c=>(i+=c<')'||-1)<0))&&r.join``

Ungolfed:
s=>(
  r=[...s].map(c=>'()'[c<')'|0]),  //switch "(" and ")"
  r.some(_=>(
    r.push(r.shift(i=0)),          //move last element to beginning of array, initialize i
    !r.some(c=>(i+=c<')'||-1)<0)   //check if balanced (i should never be less than 0)
  )),
  r.join``
)

Test cases:

let f=

s=>(r=[...s].map(c=>'()'[c<')'|0])).some(_=>r.push(r.shift(i=0))&&!r.some(c=>(i+=c<')'||-1)<0))&&r.join``

console.log(f('(()())'));      // ()(())
console.log(f('(()(())())'));  // (()(())())
console.log(f('((())())()'));  // (()(()()))

Octave, 62 bytes
@(s)")("(x=hankel(s,shift(s,1))-39)(all(cumsum(2*x'-3)>=0)',:)

Try it online!
A function that takes the string as input and prints all results.
Explanation:
           hankel(a,shift(a,1))                                % generate a matrix of n*n where n= length(s) and its rows contain incresing circulraly shifted s
         x=...                 -39                             % convert matrix of "(" and ")" to a mtrix of 1 and 2
    ")("(x                        )                            % switch the parens
                                               2*x'-3          % convert [1 2] to [-1 1]
                                        cumsum(      )         % cumulative sum along the rows
                                    all(              >=0)'    % if all >=0
                                   (                       ,:) % extract the desired rows

Mathematica, 78 bytes
""<>{"(",")"}[[2ToCharacterCode@#-81//.x_/;Min@Accumulate@x<0:>RotateLeft@x]]&

PHP, 110 108 bytes
for($s=$argn;;$p?die(strtr($s,"()",")(")):$s=substr($s,1).$s[$i=0])for($p=1;$p&&$c=$s[$i++];)$p-=$c<")"?:-1;

Run as pipe with -nR or test it online.
breakdown
for($s=$argn;               # import input
    ;                       # infinite loop
    $p?die(strtr($s,"()",")(")) # 2. if balanced: invert, print and exit
    :$s=substr($s,1).$s[$i=0]   #    else: rotate string, reset $i to 0
)                               # 1. test balance:
    for($p=1;                   # init $p to 1
        $p&&$c=$s[$i++];)       # loop through string while $p is >0
        $p-=$c<")"?:-1;             # increment $p for ")", decrement else

Python 3, 112 103 101 bytes
-2 bytes thanks to @Mr.Xcoder

k=y=input().translate(' '*40+')(')
while k:
 k=y=y[1:]+y[0]
 for _ in y:k=k.replace('()','')
print(y)

Try it online!

101 bytes? Not sure it works

JavaScript (ES6), 97 bytes
f=(s,t=s,u=t.replace(')(',''))=>u?t==u?f(s.slice(1)+s[0]):f(s,u):s.replace(/./g,c=>c<')'?')':'(')

Works by recursively rotating the input string until its transpose is balanced, then transposing it.

Simply beautiful.

APL (Dyalog Unicode), 35 30 bytes
Golfed a new approach thanks to @Adám
1⌽⍣{2::0⋄1∊⍎⍕1,¨⍺}')('['()'⍳⎕]

Try it online!
Golfing is in progress.
Explanation
'()'⍳⎕              Find the index of each character of the input in the string '()'
                    (this is 1-indexed, so an input of '(())()' would give 1 1 2 2 1 2)
')('[...]           Find the index of the vector in the string ')('
                    This essentially swaps ')'s with '('s and vice versa
⍣                   On this new string, do:
 1⌽                   rotate it one to the left
                    Until this results in 1:
 1,¨⍺                 Concatenate each element of the argument with a 1
                      This inserts 1 one before each parenthesis
 ⍕                    Stringify it
 ⍎                    And evaluate it, if the parentheses are balanced, this produces no errors
 1∊                   Check if 1 belongs to evaluated value
                      If the parentheses were not matches during ⍎, this causes a syntax error
 2::0                 This catches a syntax error and returns 0
                      Essentially this code checks if the brackets are balanced or not

Python 2, 99 bytes
r=[0];S=''
for c in input():b=c>'(';r+=[r[-1]+2*b-1];S+=')('[b]
n=r.index(min(r))
print S[n:]+S[:n]

Try it online!
In function form for easy test cases:
Python 2, 108 bytes
def f(s):
 r=[0];S=''
 for c in s:b=c>'(';r+=[r[-1]+2*b-1];S+=')('[b]
 n=r.index(min(r))
 return S[n:]+S[:n]

Try it online!
This uses a slightly different approach - instead of recursively rotating the string, if we think of the parens as incrementing and decrementing some balance counter, then a balanced string must never have a total sum of increments - decrements that is less than 0.
So we take
(()(())())

invert the parens:
))())(()((

and convert it to a list of sums of increments/decrements:
[-1,-2,-1,-2,-3,-2,-1,-2,-1,0]

-3 is the minimum at index 4 (zero based); so we want to shift by that index+1. This guarantees that the cumulative increment/decrement will never be less than 0; and will sum to 0.

On my phone so I can't test, but could you do r=0, instead of r=[0]?

If you're going with @Cyoce's suggestion, you will need to replace r+=[r[-1]+2*b-1] with r+=r[-1]+2*b-1, as well

Clojure, 118 bytes
#(loop[s(map{\(\)\)\(}%)](let[s(conj(vec(rest s))(first s))](if(some neg?(reductions +(map{\( 1\) -1}s)))(recur s)s)))

Returns a sequence of characters, so I'd call it like this:
(apply str (f "(()(())())"))
; "(()(())())"

First flips brackets, then loops as long as the cumulative sum of bracket count goes negative at some point of the sequence.

brainfuck, 82 bytes
,[++[->->++<<]-[--->+>-<<]>-->+[-[-<<+>>>>+<<]],]+[<<]>>>[.[-]>>]<[<<]<[<<]>>[.>>]

Try it online!
Explanation
With each character read, a counter is modified as follows:

The counter starts at 0.
After each ), the counter increases by 1.
After each (, the counter decreases by 1, unless the counter was 0, in which case the counter is unchanged.

Each prefix is a valid suffix of a balanced string (after inversion) if and only if this counter is 0.  This code uses the longest such prefix to form the output.
,[                   Take input and start main loop
                     The cell one space right is the output cell (0 at this point),
                     and two spaces right is a copy of the previous counter value
  ++                 Add 2 to input
  [->->++<<]         Negate into output cell, and add twice to counter
  -[--->+>-<<]       Add 85 to output cell, and subtract 85 from counter
  >-->+              Subtract 2 from output cell and add 1 to counter
                     The output cell now has (81-input), and the counter has been increased by (2*input-80)
  [-[-<<+>>>>+<<]]   If the counter is nonzero, decrement and copy
,]
+[<<]                Go to the last position at which the counter is zero
>>>                  Go to following output character
[.[-]>>]             Output from here to end, clearing everything on the way
                     (Only the first one needs to be cleared, but this way takes fewer bytes)
<[<<]                Return to the same zero
<[<<]>>              Go to beginning of string
[.>>]                Output remaining characters


text:
Generate a box based on user input
NOTE: This question is different than Draw an ASCII Rectangle because the user has to input only 1 number to generate a box, unlike the other question, where the user has to input the x and y size of the box.
Your task is to create a box based upon user input. Let's say I inputted 2. The box generated would look like:
--
--

As in, two by two long.
Or, if I entered 7:
-------
|     |
|     |
|     |
|     |
|     |
-------

So, seven by seven.
Notice the box generated above has 5 bars up and seven hyphens across. The hyphen directly above or below the bars does count as one vertical iteration.
One more example. I enter 5. The box generated:
-----
|   |
|   |
|   |
-----

You can use any  programming language you wish. The task is to be able to generate a box using the least possible amount of bytes.
Current leaderboard:
[1] dzaima in SOGL, 17 bytes
[2] Adam in APL, 27 bytes
[3] HyperNeutrino in Python, 51 bytes

@DJMcMayhem While I don't dispute your dupeuammer, this challenge is slightly different and offers some golfing opportunities because the characters are unique across rows, not columns, which is how most languages work. I trust your judgement more than mine though :P

Can we assume that the input will always be at least 2?

Your comment about the input consisting of only one number isn't a valid de-duplicating reason. If the other one requires both dimensions and this only requires one, then every solution there can be easily transferred to this question by simply repeating the left argument and using that as the right argument. See my above point though.

SOGL V0.12, 21 17 bytes
1.⁰{1.┐∙ž}:┐┌ŗH╬8

Try it Here!
Explanation:
1.⁰                push 1, input and wrap in an array
   {     }         for each item in that array do
    1                push 1
     .┐∙             get an array of input amount of items of "|"
        ž            at coordinates [currentArrayItem; 1] place those bars
          :        duplicate it
           ┐┌ŗ     replace "|" with "-"
              H    rotate anti-clockwise
               ╬8  place the 2nd array over the 1st

APL (Dyalog), 27 bytes
'-'⍪'-'⍪⍨'|','|',⍨''⍴⍨2⍴-∘2

Try it online!
-∘2 subtract two
2⍴ reshape into length 2
''⍴⍨ use that as height and width to reshape an empty string (padding with spaces)
'|',⍨ put stiles on the right
'|', put stiles on the left
'-'⍪⍨ put dashes below
'-'⍪ put dashes on top

{'--| '[a⌊⌽⊖a←2⊥¨×⍳⌽⍵]}

@ngn I don't get it. Can you post a TryAPL or TIO link?

it's []io=0  https://tio.run/##SyzI0U2pTMzJT///qG9qZv6jtgkG/9OAZLW6rm6Ngnp04qOerkc9ex91TUsEiho96lp6aMXh6Y96N4MEe7fG1v7/n3ZohYaxgrGmhoWCqSaQZWigCQA

@n It almost answers this then, alhough you can specify input in reverse, and use ⎕, saving 3 bytes. However, here there is only one input, so we need '--| '[a⌊⌽⊖a←2⊥¨×⍳2/⎕]

I must have confused the two... well, still an improvement.

JavaScript (ES6), 61 60 bytes
n=>`${h="-"[r="repeat"](n)}
${`|${" "[r](n-=2)}|
`[r](n)}`+h

Python, 51 bytes
lambda x:'-'*x+'\n'+('|'+' '*(x-2)+'|\n')*(x-2)+'-'*x

I tested this on my laptop and then manually wrote this answer on mobile so please tell me if this doesn't work.

I believe you meant *x at the end.

@Fedone Yes, that is what I meant. Thanks.


text:
BASKETBALL FRVR?
You might already be familiar with the game: Basketball FRVR in facebook. There are two types of score you can make:

A virgin-shot:(we call it so in our country :D) When the ball enters the basket without touching the rim  or
A stale shot: When the ball enters the basket, but after touching the rim.

The game is over once you miss a shot. Stale shot always scores 2 points.The first in a run of consecutive virgin-shots scores 3 points, the second scores 6 points, and subsequent ones score 9 points each.
For example,
Hits             Total score

S-V-V-V          2+3+6+9 = 20
S-V-V-V-V        2+3+6+9+9 = 29 (see how added score for consecutive virgin-
                                 shots
                                 saturates at the 5th hit)
S-V-S-V-V-S-V    2+3+2+3+6+2+3= 21

Using simple mathematics, it can easily be proven that any score greater than 1 n>1 can be scored in the game
The Challenge
For any given number 1<n<100, output all the possible ways to score n.
Rules:

You can either write a complete program or function(s), snippets however are not acceptable.
Hard-coding the output or loading from memory/other programs/website is strictly prohibited, you must compute the output in real-time.
The output must be a well-separated collection of string of Ss and Vs. For eg: ['SVS','SSV','VSS'] or {'SVS','SSV','VSS'}.
It is encouraged to, but the collection need not be sorted or contain only unique elements. Brownie points if you output sorted and unique collection of strings.

Winning condition:

This is code-golf so the shortest code in bytes wins.

Input/Output (Test-cases)
2: {'S'}
3: {'V'}
4: {'SS'}
12: {'SSSSSS', 'VSSVS', 'VSVSS', 'VSSSV', 'SSVSV', 'SVSVS', 'SVSSV'}
16: {'SSSVSVS', 'SSSVSSV', 'VSSSSSV', 'SSVSSVS', 'SVVSV', 'VSSSSVS', 'SVSVV', 'SVSSSSV', 'VVSSV', 'VSVVS', 'SVSVSSS', 'SVSSSVS', 'VSSVSSS', 'SSVSSSV', 'SSSSSSSS', 'VVSVS', 'VSSSVSS', 'SVSSVSS', 'VSVSSSS', 'SSSSVSV', 'SSVSVSS', 'VSSVV'}

Thanks to Peter Taylor for improving this question

In case anyone cares, as an American, I always called rimless (and backboardless) shots "swishes" (and Wikipedia backs me up here: Swish, a basketball shot that goes through the basket without touching the rim or backboard)

I'm mostly just curious where they call them 'virgin shots'... I'm afraid to look it up behind my company's firewall xD

@bendl Nepal or Npl when censored. xD

Very nice question—not hard, but definitely not trivial, and allows for different approaches :)

I think 28 should be 29 in the second test case.

Oh, yes. Thank you. @JulianWolf

Jelly, 30 bytes
o2,5ṁo8‘
Hṗ@€⁾VSẎðOḂŒgÇ€FS=ðÐf

A monadic link returning a list of the strings (lists of characters).
Try it online! - The footer calls the link and separates the entries by newlines since a full program's implicit output would smash them together.
How?
o2,5ṁo8‘ - Link 1, helper to form shot scores: list of shots grouped by type (S=1 and V=0)
         -                                e.g. [[1,1],[0,0,0,0,0],[1,1],[0],[1,1]]
 2,5     - 2 paired with 5 = [2,5]
o        - logical or (vectorises)             [[1,1],[2,5,0,0,0],[1,1],[2,5],[1,1]]
    ṁ    - mould like the input                [[1,1],[2,5,0,0,0],[1,1],[2],[1,1]]
     o8  - logical or with 8                   [[1,1],[2,5,8,8,8],[1,1],[2],[1,1]]
       ‘ - increment                           [[2,2],[3,6,9,9,9],[2,2],[3],[2,2]]

Hṗ@€⁾VSẎðOḂŒgÇ€FS=ðÐf - Link: number, total score, n
H                     - halve n
    ⁾VS               - literal ['V','S']
 ṗ@€                  - Cartesian power with swapped @rguments for €ach
                      -   ...i.e. for each in [1,2,...,floor(half n)]
                      -   yielding all strings of Vs and Ss from length 1 to floor(half n)
       Ẏ              - tighten (from a list of lists of lists to a list of lists)
        ð         ðÐf - filter keep those entries for which this yields a truthy value:
         O            -   cast to ordinals (S->83, V->86)
          Ḃ           -   modulo 2         (S->1, V->0)
           Œg         -   group equal runs (e.g. [0,0,1,1,0] -> [[0,0],[1,1],[0]])
             Ç€       -   call the last link (1) as a monad for €ach (transform to scores)
               F      -   flatten (make one list of scores)
                S     -   sum (calculate the total score of the string)
                 =    -   equals right argument (n)?

The resulting order is actually lexicographical in reverse, to have it forward sorted just reverse it by appending Ṛ.

Nice. Your brownie .

@officialaimm We usually call those cookies but whatever...

JavaScript (ES6), 73 72 bytes
Prints all unique, lexically sorted combinations.
f=(n,p=0,s='')=>n?n>1&&f(n-2,0,s+'S')&f(n-(p-9?p+=3:9),p,s+'V'):alert(s)

Test cases
In this snippet, alert() has been replaced by console.log() for user-friendliness.

f=(n,p=0,s='')=>n?n>1&&f(n-2,0,s+'S')&f(n-(p-9?p+=3:9),p,s+'V'):console.log(s)

;[2, 3, 4, 12, 16]
.forEach(n => { console.log('[' + n + ']'); f(n); })

Here's a crunchy brownie:

Python 3, 96 95 85 77 73 bytes
-1 byte thanks to @notjagan
-4 bytes thanks to @xnor
f=lambda x,s='',i=3:f(x-2,s+'S')+f(x-i,s+'V',3*(i<9)+i)if x>0 else[s]*-~x

Try it online!

You can remove a byte by changing x==0 to x<1.

Recursive functions that print can usually be shortened to instead produce a list. In place of printing, return a list of length 1 or 0, and recursively sum the lists corresponding to the branches.

PHP>=7.1, 158 bytes
function b($s="",$g=0){global$r,$i;$g-$i?$g>$i?:b($s."2",$g+2)&b($s.($n=$s[-1]>2?min(9,$s[-1]+3):3),$g+$n):$r[]=strtr($s,2369,SVVV);}$i=$argn;b();print_r($r);

PHP Sandbox Online
Expanded
function b($s="",$g=0){
  global$r,$i;
  $g-$i
    ?$g>$i
      ?
      :b($s."2",$g+2) # recursive call add a S
      &b($s.($n=$s[-1]>2?min(9,$s[-1]+3):3),$g+$n) # recursive call add a V
    :$r[]=strtr($s,2369,SVVV); # add to result array if reach score replace integers with S and V
}
$i=$argn; #short input variable
b(); #call the function
print_r($r); #print results

@officialaimm You must use a PHP Version equal greater than 7.1

@officialaimm you can change the version to the highest available version. At the first time you visit the site it is not set to a PHP 7.1 Version And the only output I reach for input=6 with a Version 7.1 is SSS

Oh, its fine now.Anyways,  its quite weird how different versions of PHP are giving different outputs for the same code though.. :D

@officialaimm This depends on the new feature in PHP 7.1 that is use in this case. $string[-1] belongs to "" in all versions under 7.1 http://php.net/manual/en/language.types.string.php

Mathematica, 95 102 105 112 bytes
If[#4==#2,Echo@#,If[#4>#2,#0[#<>"S",#2+2,0,#4];#0[#<>"V",#2+Min[3#3+3,9],#3+1,#4]]]&["",0,0,#]&

There should be a lot of golfing potential.
Bascially it is a recursive function that perform a DFS over all possible combinations.

Haskell, 75 bytes
n#v|n<1=[[]|n==0]|n>0=(('S':)<$>(n-2)#3)++(('V':)<$>(n-v)#min(v+3)9)
f=(#3)

Call f with the total score value. Uses a fairly straightforward depth-first search to find all the solutions. Sadly, Haskell's precedence rules seem to be out to get me today, so there are lots of parentheses here.

As @Laikoni pointed, VVVV should evaluate to 27 while you seem to evaluate it as 30.

Fixed the truncation problem at the cost of a few bytes. Thanks, @Laikoni, for pointing that out.

@Laikoni If I change <$> to map, I have to wrap the # call in parentheses, so it's a wash.