text:
Raise a single number
Introduction
Suppose you want to compute the tail maxima of a list of numbers, that is, the maximum of each nonempty suffix.
One way to do it is to repeatedly choose one number and replace it by a higher number occurring after it, until this is not possible anymore.
In this challenge, your task is to perform one step of this algorithm.
The task
Your input is a list of integers L, which may be empty.
Your output shall be the list L where exactly one number Li has been replaced by another Lj, where Li < Lj and i < j.
In other words, you shall replace one number with a higher number that occurs after it.
You can choose i and j freely among all valid pairs, and the choice can be nondeterministic.
If such i and j do not exist (i.e. L is non-increasing), your output shall be L unchanged.
Example
Consider the input L = [ 3, 1, 4, -1, 2 ].
The possible operations are to replace 3 by 4, replace 1 by 4, replace 1 by 2, or replace -1 by 2.
Thus the possible outputs are:
 [  3 ,   1 ,   4 ,  -1 ,   2 ]
 ------------------------------
 [( 4),   1 ,(  4),  -1 ,   2 ]
 [  3 ,(  4),(  4),  -1 ,   2 ]
 [  3 ,(  2),   4 ,  -1 ,(  2)]
 [  3 ,   1 ,   4 ,(  2),(  2)]

If you repeat the operation enough times, the end result will be [4,4,4,2,2], which is precisely the list of tail maxima of L.
Rules and scoring
You can write a full program or a function.
In the latter case, you can modify the input in place instead of returning a new array, if your language allows that.
Input and output formats are flexible within reason.
The lowest byte count wins.
Test cases
All possible outputs are shown.
[] -> []
[1] -> [1]
[1,2] -> [2,2]
[2,1] -> [2,1]
[4,4,4,4] -> [4,4,4,4]
[-1,-3,-10] -> [-1,-3,-10]
[1,3,10] -> [3,3,10] [10,3,10] [1,10,10]
[1,1,2,1] -> [2,1,2,1] [1,2,2,1]
[998,64,2,-94,-789] -> [998,64,2,-94,-789]
[998,2,64,-94,-789] -> [998,64,64,-94,-789]
[3,1,4,-1,2] -> [4,1,4,-1,2] [3,4,4,-1,2] [3,2,4,-1,2] [3,1,4,2,2]
[-1,4,0,4,7,2,3] -> [4,4,0,4,7,2,3] [0,4,0,4,7,2,3] [-1,4,4,4,7,2,3] [7,4,0,4,7,2,3] [-1,7,0,4,7,2,3] [-1,4,7,4,7,2,3] [-1,4,0,7,7,2,3] [2,4,0,4,7,2,3] [-1,4,2,4,7,2,3] [3,4,0,4,7,2,3] [-1,4,3,4,7,2,3] [-1,4,0,4,7,3,3]
[3542,-12311,7662,1672,6081] -> [7662,-12311,7662,1672,6081] [3542,7662,7662,1672,6081] [3542,1672,7662,1672,6081] [6081,-12311,7662,1672,6081] [3542,6081,7662,1672,6081] [3542,-12311,7662,6081,6081]

JavaScript (ES6), 41 40 39 38 bytes
Saved a byte thanks to @Neil, another thanks to @user81655
x=>x.map(c=>c<x[++i]>d?x[d=i]:c,d=i=0)

Just when it seems reduceRight might finally have a chance, .map shows up yet again...

x=>x.map(c=>c<x[++i]&!d?x[d=i]:c,d=i=0)?

Conditionals are evaluated left-to-right, which means x=>x.map(c=>c<x[++i]>d?x[d=i]:c,d=i=0) (38 bytes) should work.

@user81655 That's amazing :-)

Mathematica, 37 bytes
#/.{a___,b_,c_,d___}/;b<c:>{a,c,c,d}&

Pure function taking a list of real numbers even, and returning a list of real numbers. Looks for the first pair of consecutive entries in the "wrong" order, and replaces the first of that pair with the second. Nice default behavior of /. means that it returns the input unaltered when appropriate.
Amusing side note: if we replace b<c with !OrderedQ[{c,b}], then the function works on strings (and really any data type once the appropriate ordering is described). For example, #/.{a___,b_,c_,d___}/;!OrderedQ[{c,b}]:>{a,c,c,d}& on input {"programming", "puzzles", "code", "golf"} returns {"puzzles", "puzzles", "code", "golf"}.

A caveat for the side note: Mathematica's canonical ordering of strings is weird.

How so, Martin Ender?

Just try Sort[FromCharacterCode /@ Range[32, 127]]. It gets weird once you have strings with multiple words, because then it ignores spaces and stuff.

JavaScript (ES6), 43 39 38 bytes
a=>a[a.some(e=>e<a[++i],i=0)*i-1]=a[i]

Outputs by modifying the array in-place. Edit: Saved 4 bytes thanks to @ETHproductions. Saved 1 byte thanks to @user81655.

I think you can do with a=>a[i=0,a.findIndex(e=>e<a[++i])]=a[i] for 39.

Another approach for 40B: a=>a.map((_,b)=>Math.max(...a.slice(b)))

@Luke I think you're misunderstanding the challenge; the point is to only make one of the integers in the array larger.

@ETHproductions Thanks for returning the favour, now the honours are even!

I think you might be able to replace findIndex with some (38 bytes): a=>a[i=0,a.some(e=>e<a[++i])*i-1]=a[i]

@user81655 I guess that only works when you're already doing 1-based indexing...

Haskell, 36 bytes
f(a:r@(b:_))|a<b=b:r|1>0=a:f r
f e=e

Try it online!
Look through the list for consecutive elements a,b with a<b and changes them to b,b.
Improved from 37 bytes:
f(a:b:t)|a<b=b:b:t
f(a:t)=a:f t
f e=e

I think f(a:r@(b:_))=max(b:r)(a:f r) works and is two bytes shorter.

@ØrjanJohansen That's a beautiful method! I think you should post it as your own answer. I wasn't sure at first it would handle ties correctly, but I see now it works because f r >= r.

Thanks, I've done so!

Jelly, 13 11 bytes
ṫJṀ€ż¹ŒpQ-ị

Replaces the rightmost of all possible numbers.
Try it online!
How it works
ṫJṀ€ż¹ŒpQ-ị  Main link. Argument: A (array)

 J           Yield all indices of A, i.e., the array [1, ..., len(A)].
ṫ            Dyadic tail; for index k, take all elements starting with the k-th.
             This constructs the array of suffixes.
  Ṁ€         Maximum each; map the monadic maximum atom over the suffixes.
     ¹       Identity; yield A.
    ż        Zip; construct all pairs of elements of the result to the left and the
             corresponding elements of the result to the right.
      Œp     Cartesian product. Construct all arrays that, for each index, take
             either the left or the right element.
        Q    Unique; deduplicate the resulting arrays.
         -ị  At-index -1; select the second to last result.
             The last result is A itself, the first maxima of suffixes.

Python 2, 139 134 93 bytes
a=input()
for i in range(len(a)):
 for j in a[i+1:]:
    if a[i]<j:a[i]=j;print a;exit()
print a

Terribly long, but it's a first attempt.
-5 bytes thanks to TemporalWolf
-41 (!!) bytes thanks to Value Ink

[1,2] gives [2,1] instead of [2,2]

@TemporalWolf Yeah, I misread the challenge. No bytes saved or lost, will fix.

You can remove the return before your inner print and use a \t tab instead of extra space for the inner loop. Also, you can drop the 0 in exit() for an extra one. Should bring you down to 132.

a[i+1:j]+[a[j]]+a[j+1:] can be reduced to a[i+1:] to bring it down to 119... I can't actually figure out what that is supposed to do.

if a[i]<a[j]:a[i]=a[j];print a;exit() is even shorter. Heck, it's better to do for j in a[i+1:]:\n\tif a[i]<j:a[i]=j;print a;exit()

@ValueInk um... Thanks for the 57 byte golf... that was a big jump... Thanks!

That doesn't work. I forgot to mention you still needed your for i... block, but the inner block could be golfed the way I mentioned!

@ValueInk Oh whoops, thanks for pointing that out!

You can probably save some redundancy by changing your program to a function which mutates the array. That way you can eliminate the print statements and instead just break the loops if a[i]<j.

MATL, 13 bytes
ttd0>fX>Q)2M(

Try it online!
Explanation
The following two conditions are equivalent:

There is a number that has a higher number to its right
There is a number that has a higher number immediately to its right

The code uses condition 2, which is simpler. It computes consecutive increments and finds the last positive one, if any. For the two involved entries, it writes the value of the second entry into the first.
This trick is used to handle the case when no substitution can be done. Note also that MATL indexing is 1-based.
Let's use input [3,1,4,-1,2] as an example.
tt    % Get input implicitly and duplicate it twice
      % STACK: [3,1,4,-1,2], [3,1,4,-1,2], [3,1,4,-1,2]
d     % Consecutive differences
      % STACK: [3,1,4,-1,2], [3,1,4,-1,2], [-2  3 -5  3]
0>    % Are they positive?
      % STACK: [3,1,4,-1,2], [3,1,4,-1,2], [0 1 0 1]
f     % Find indices of all positive differences. Result may be empty
      % STACK: [3,1,4,-1,2], [3,1,4,-1,2], [2 4]
X>    % Maximum index with a positive difference. Empty input remains as empty
      % STACK: [3,1,4,-1,2], [3,1,4,-1,2], 4
Q     % Add 1. Since the addition is elementwise, empty input remains as empty
      % STACK: [3,1,4,-1,2], [3,1,4,-1,2], 5
)     % Get the entry of the input at that position
      % STACK: [3,1,4,-1,2], 2
2M    % Push maximum index with a positive difference, again
      % STACK: [3,1,4,-1,2], 2, 4
(     % Assign to that position. Implicitly display
      % STACK: [3,1,4,2,2]

Haskell, 34 33 bytes
This is based on the answer by xnor, who suggested I post it myself.
EDIT: xnor found a byte to save.
f(a:r@(b:_))=max(b:r)$a:f r
f e=e

Try it online!
Basically, I observed that the branching of xnor's method always ends up choosing whichever of the branch expressions is largest, since Haskell uses lexicographic ordering for lists. (The case when a==b also works because f r>=r, which can be proved separately by induction.)
Put differently, whenever b:r > a:f r, then b:r is a correct answer, and otherwise we can recurse to a:f r.
So instead of checking a<b in advance, I just calculate both expressions and take the maximum. This could give an exponential blowup, although Haskell's laziness avoids that unless a and b are equal.

Looks like max(b:r)$a:f r saves a byte.

MATL, 15 bytes
tdt0>0whY>d*0h+

Try it online!
I'm not a huge fan of this solution. It seems horribly inefficient to me. Particularly the whY>d* and 0h+ sections.

SWI-Prolog, 70 bytes
f([H|T],[S|T]):-max_list(T,S),S>H,!.
f([H|T],[H|R]):-f(T,R),!.
f(I,I).

First clause replaces the first element of the list with the maximum value of the rest of the list, but only if this max is bigger. The second clause recursively calls the predicate for the tail of the list. If none of these clauses succeed, the third clause simply returns the input.
This return just one of the possible solutions. It's trivial to find all of them with very similar code, but then the case where no change is possible takes a lot more bytes to handle.
Example:
?- f([-1,4,0,4,7,2,3], O).
O = [7, 4, 0, 4, 7, 2, 3]

Ruby, 66 61 bytes
->a{i=r=-1;a.map{|e|m=a[i+=1,a.size].max;r&&m>e ?(r=!r;m):e}}

Try it online!

Python 3, 79 bytes
def f(x):
 for i,a in enumerate(x):
  m=max(x[i+1:])
  if m>a:x[i]=m;break

Mutates the original array (list) given to it. I'm unhappy that this isn't a lambda and I'm sure there are better optimizations; I'll hopefully address those later.
Brief explanation
It takes the max of the array past the current element (starting with the zeroth). It then compares this to the element itself: if the max is greater, replace the current element with it and stop, otherwise, increment by one and keep trying that.

C, 47 bytes
f(p,n)int*p;{n>1?*p<p[1]?*p=p[1]:f(p+1,n-1):0;}

Recursive implementation taking as its input a pointer to the first element of an array, and the length of the array. Modifies the array in place.

Python 2, 89 bytes
Try it online
-1 byte thanks to @TemporalWolf
-25 bytes thanks to @ValueInk
-7 bytes thanks to @Cole
Function that mutates input array
def F(A):
 for i in range(len(A)):
    r=[y for y in A[i+1:]if y>A[i]]
    if r:A[i]=r[0];break

If there was no need to stop after first iteration, it would be a bit prettier

This appears not to work. Try [1, 3, 5, 7]; it returns [3, 3, 5, 7].

A[i]<y and => y>A[i]and saves 1

@HyperNeutrino If I inderstand task right, that is valid outut

Never mind, I misread the challenge. My bad, have a +1 as well! :)

@HyperNeutrino Our answers are still too long for python =\

Yeah, I agree :( Yours is still shorter though :P Nice answer anyway!

Consider r=[y for y in A[i+1:]if y>A[i]]\n if r:A[i]=r[0];break to drop your score to 96!

@ValueInk Good one! Indeed you don't always need this fancy lambdas and reduces :D

@ValueInk The next logical step in golfing it down would bring me to HyperNeutrino answer :)

Oh dear... yeah sorry I golfed theirs below yours. I don't really know what else to say other than congrats to both of you for beating the Python 3 answer?

Might I suggest what I suggested for one of the other Python answers: convert what you have to a function which mutates the original array so that you can avoid printing and input().

R, 71 bytes
a=scan()
l=length(a)
lapply(1:l,function(x){
  a[x]=max(a[x:l])
  a
})

C, 80 bytes
i,j;f(l,n)int*l;{for(i=0;i<n;++i)for(j=i;++j<n;)if(l[i]<l[j]){l[i]=l[j];j=i=n;}}

Call with:
int main()
{
    int a[5]={3,1,4,-1,2};
    f(a,5);
    for(int k=0;k<5;++k)
        printf("%d ", a[k]);
}

Python 2, 60 bytes
f=lambda x:x and[x[:1]+f(x[1:]),[max(x)]+x[1:]][x[0]<max(x)]

Try it Online!
Explanation: Recursively checks if a given element is less than the max element in the rest of the list. If so, returns the list with max replacing the first element.

TI-Basic, 72 bytes
Prompt L1
If 2≤dim(L1
Then
For(A,1,dim(L1)-1
For(B,A,dim(L1
If L1(A)<L1(B
Then
L1(B→L1(A
Goto E
End
End
End
End
Lbl E
L1

Explanation:
Prompt L1          # 4 bytes, input list
If 2≤dim(L1        # 7 bytes, if the list has 2 or 1 element(s), skip this part and return it
Then               # 2 bytes
For(A,1,dim(L1)-1  # 12 bytes, for each element in the list other than the last
For(B,A,dim(L1     # 9 bytes, for each element after that one
If L1(A)<L1(B      # 12 bytes, if the second is larger than the first
Then               # 2 bytes
L1(B→L1(A          # 10 bytes, replace the first with the second
Goto E             # 3 bytes, and exit
End                # 2 bytes
End                # 2 bytes
End                # 2 bytes
End                # 2 bytes
Lbl E              # 3 bytes
L1                 # 2 bytes, implicitly return L1

sh, 118 bytes
Input integers are passed as arguments to the script.
l=("$@");for i in "$@";{ for j in "$@";{(($i<$j))&&{ l[$x]=$j;echo ${l[@]};exit;};};shift;x=`expr $x+1`;};echo ${l[@]}

Breakdown:
l=("$@");                      #copy original list
for i in "$@";{ for j in "$@"; #check all elements j that follow element i in list
{(($i<$j))&&{ l[$x]=$j;echo ${l[@]};exit;};};   #if i<j, make i=j; print list, done
shift;                         #makes sure that i is compared only to j that occur after it
x=`expr $x+1`;};               #keeps track of i'th position in the list
echo ${l[@]}                   #prints list if it was unchanged

PHP, 88 Bytes
<?for(;$i+1<$c=count($a=$_GET)&&$a[+$i]>=$a[++$i];);$i>=$c?:$a[$i-1]=$a[$i];print_r($a);

Breakdown
for(;
$i+1<($c=count($a=$_GET))  # first condition end loop if the item before the last is reach
&&$a[+$i]>=$a[++$i] # second condition end loop if item is greater then before
;);
$i>=$c?:$a[$i-1]=$a[$i]; # replace if a greater item is found
print_r($a); #Output

Haskell, 48 bytes
f(b:l)|l>[],m<-maximum l,b<m=m:l|1<2=b:f l
f x=x

Usage example: f [1,1,2,1] -> [2,1,2,1]. Try it online!.
If the input list has at least one element, bind b to the first element and l to the rest of the list. If l is not empty and b less than the maximum of l, return the maximum followed by l, else return b followed by a recursive call of f l.  If the input list is empty, return it.

Python 3, 103 102 bytes
lambda a:([a[:i]+[max(a[i:])]+a[i+1:]for i in range(len(a))if-~i==len(a)or max(a[i+1:])>a[i]]+[[]])[0]

Try it online!

Racket 202 bytes
(let((g(λ(L i n)(for/list((c(in-naturals))(l L))(if(= c i)n l))))(ol'()))
(for((c(in-naturals))(i L))(for((d(in-range c(length L)))#:when(>(list-ref L d)i))
(set! ol(cons(g L c(list-ref L d))ol))))ol)

Ungolfed:
(define (f L)
  (let ((replace (λ (L i n)   ; sub-function to replace i-th item in list L with n;
                   (for/list ((c (in-naturals))
                              (l L))
                     (if (= c i) n l))))
        (ol '()))             ; outlist initially empty;
    (for ((c (in-naturals))               ; for each item in list
          (i L))
      (for ((d (in-range c (length L)))   ; check each subsequent item in list
            #:when (> (list-ref L d) i))  ; if greater, replace it in list
        (set! ol (cons (replace L c (list-ref L d)) ol)))) ; and add to outlist.
    ol))          ; return outlist.

Testing:
(f '(3 1 4 -1 2))

Output:
'((3 1 4 2 2) (3 2 4 -1 2) (3 4 4 -1 2) (4 1 4 -1 2))

C, 67 bytes
Single Run, 67 bytes Live
j;f(l,i)int*l;{j=i-1;while(i-->0)while(j-->0)l[j]=fmax(l[i],l[j]);}

Single Step, 78 bytes Live
j;f(l,i)int*l;{j=i-1;while(i-->0)while(j-->0)if(l[j]<l[i]){l[j]=l[i];return;}}

Tail Maxima, 96 bytes Live
x;i;j;f(l,n)int*l;{do{x=0;for(i=0;i<n;i++)for(j=0;j<i;j++)if(l[j]<l[i])l[j]=l[i],x=1;}while(x);}


text:
Divide and divide and conquer
Sometimes, when I'm idly trying to factor whatever number pops up in front of me¹, after a while I realize it's easier than I thought. Take 2156 for example: it eventually occurs to me that both 21 and 56 are multiples of 7, and so certainly 2156 = 21 x 100 + 56 is also a multiple of 7.
Your task is to write some code that identifies numbers that are easier to factor because of a coincidence of this sort.
More precisely:
Write a program or function that takes a positive integer n as input, and returns a truthy value if there exists a divisor d (greater than 1) such that n can be chopped in two to yield two positive integers, each of which is a multiple of d; return a falsy value if not.

"Chopped in two" means what you think: the usual base-10 representation of n partitioned at some point into a front half and a back half to yield two other base-10 integers. It's okay if the second integer has a leading zero (but note that it must be a positive integer, so splitting 1230 into 123 and 0 is not valid).
The truthy and falsy values can depend on the input. For example, if any nonzero integer is truthy in your language of choice, then you are welcome to return the divisor d or one of the "pieces" of n (or n itself for that matter).
For example, any even number with at least two digits in the set {2, 4, 6, 8} will yield a truthy value: just split it after the first even digit. Also for example, any prime number n will yield a falsy value, as will any one-digit number.
Note that it suffices to consider prime divisors d.
You may assume the input is valid (that is, a positive integer).

This is code-golf, so the shortest code in bytes wins. But solutions in all languages are welcome, so we can strive for the shortest code in each language, not just the shortest code overall.
Test cases
(You only have to output a truthy or falsy value; the annotations below are just by way of explanation.) Some inputs that yield truthy values are:
39  (3 divides both 3 and 9)
64  (2 divides both 6 and 4)
497  (7 divides both 49 and 7)
990  (splitting into 99 and 0 is invalid; but 9 divides both 9 and 90)
2233  (11 divides both 22 and 33)
9156  (3 divides both 9 and 156; or, 7 divides both 91 and 56)
11791  (13 divides both 117 and 91)
91015  (5 divides both 910 and 15)
1912496621  (23 divides both 1912496 and 621; some splittings are multiples of 7 as well)
9372679892  (2473 divides both 937267 and 9892; some splittings are multiples of 2 as well)

Some inputs that yield falsy values are:
52
61
130  (note that 13 and 0 is not a valid splitting)
691
899
2397
9029
26315
77300  (neither 7730 and 0 nor 773 and 00 are valid splittings)
2242593803

¹ yes I really do this

Retina, 31 29 bytes

,$';$`
\d+
$*
;(11+)\1*,\1+;

Try it online!
Outputs a positive integer for valid inputs and zero for invalid ones.
I wouldn't recommend waiting for the larger test cases...
Explanation

,$';$`

At each position of the input insert a comma, then everything before that position, then a semicolon, then everything after this position. What does that do? It gives us all possible splittings of a number (split by ,, separated by ;), and then the input again at the end. So input 123 becomes
,123;1,23;12,3;123,;123
     ^     ^     ^

where I've marked the original input characters (the stuff that isn't marked is what we inserted). Note that this creates invalid splittings that aren't actual splittings and it also doesn't care whether the trailing component is all zeros, but we'll avoid accepting those later. The benefit of creating the invalid splittings is that we know that each valid splitting has a ; in front and after it, so we can save two bytes on word boundaries.
\d+
$*

Convert each number to unary.
;(11+)\1*,\1+;

Match a splitting by matching both halves as multiples of some number that's at least 2.

Quick question about Retina: What does the leading newline do?

@HyperNeutrino Well the first line is the first regex we match, and we want to match the empty regex, in order to insert the substitution into every single position between characters.

Oh, okay. Thanks! I should probably look a bit more at Retina; since it seems largely regex based it might be good for [tag:kolmogorov-complexity] problems.

Could the last line be ;(11+)+,\1+;

@Riley that doesn't guarantee that the first segment is a multiple of the same factor.

@MartinEnder Isnt x+ equivalent to xx*? It's one or more matches vs one match and zero or more matches. Does the reference make a difference?

@Riley yes. In (11+)+ there's nothing stopping the regex from match two 1s on the first repetition and three 1s on the second repetition.

Brachylog (2), 8 bytes
~c₂ḋᵐ∋ᵐ=

Try it online!
Explanation
~c₂ḋᵐ∋ᵐ=
~c₂       Split the input into two pieces
    ᵐ ᵐ   On each of those pieces:
   ḋ ∋      Choose a prime factor
       =  such that both the chosen factors are equal

Clearly, if the same number (greater than 1) divides both pieces, the same prime number will divide both. Requiring the factor to be prime neatly disallows 1 as a factor. It also prevents a literal 0 being chosen as a segment of a number (because 0 has no prime factorization, and will cause ḋ to fail).
There's no need to check against matching internal zeroes; if a split of x and 0y is valid, x0 and y will work just as well (and going the other way, if x0 and y works, then we have a working solution regardless of whether x and 0y would work or not).
A Brachylog full program, like this one, returns a Boolean; true. if there's some way to run it without failure (i.e. to make choices such that no error occurs), false. if all paths lead to failure. That's exactly what we want here.

Jelly, 14 12 11 10 bytes
ŒṖḌo1g/€P>

Thanks to @JonathanAllan for golfing off 1 byte!
Try it online!
How it works
ŒṖḌo1g/€P>  Main link. Argument: n

ŒṖ          Compute all partitions of n's decimal digits.
  Ḍ         Undecimal; convert each array in each partition back to integer.
   o1       OR 1; replace disallowed zeroes with ones.
     g/€    Reduce (/) each (€) partition by GCD (g).
            The last GCD corresponds to the singleton partition and will always be
            equal to n. For a falsy input, all other GCDs will be 1.
        P   Take the product of all GCDs.
         >  Compare the product with n.

I think you can drop the D, as make_digits is in effect for ŒṖ.

For some reason, I assumed that would create a range... Thanks!

Mathematica, 63 62 bytes
(1 byte thanks to Greg Martin)
1<Max@@GCD@@@Table[1~Max~#&/@Floor@{Mod[#,t=10^n],#/t},{n,#}]&

It's a function that takes an integer as input and returns True or False. If you test it on a big number, bring a book to read while you wait.
Explanation:

Floor@{Mod[#,t=10^n],#/t} arithmetically splits the input into its last n digits and the remaining m-n digits (where m is the total number of digits).
Table[1~Max~#&/@...,{n,#}] does this for every n up to the input number. (This is way too big. We only need to do this up to the number of digits of the input, but this way saves bytes and still gives the correct result.) The 1~Max~#&/@ bit gets rid of zeroes, so numbers like 130 -> {13,0} don't count as True.
1<Max@@GCD@@@... finds the greatest common divisor of each of these pairs, and checks if any of these divisors are more than 1. If they are, we've found a way to factor the number by splitting it.

Nice answer! You can save one byte with either {#~Mod~10^n,#/10^n} or {Mod[#,t=10^n],#/t}.

I tried #~Mod~10^n, but it seems to get bracketed like Mod[#,10]^n instead of Mod[#,10^n]. I didn't think of your second suggestion, though!

fair point on Mod[#,10]^n

Haskell, 57 bytes
x#n|b<-mod x n=x>n&&(b>0&&gcd(div x n)b>1||x#(10*n))
(#1)

Try it online! Usage: (#1) 2156, returns True or False

Python 3, 133 118 117 bytes
i,j=int,input()
from fractions import*
print(any(i(j[k:])*i(j[:k])*~-gcd(i(j[k:]),i(j[:k]))for k in range(1,len(j))))

Certainly not the shortest, probably could be shortened a bit. Works in O(n) time. Input is taken in format \d+ and output is given in format (True|False) as per default Python boolean value
-3 bytes thanks to Dead Possum
-15 bytes thanks to ovs
-1 byte thanks to This Guy

from fractions import* would save 3 bytes

It returns True for 900. I guess, that is wrong. Mb you should change inner any to all? If that's the case, you may change all that part to i(j[k:])and i(j[:k]) bringing it all to 125 bytes. Here are fixes

You can replace the and and all by multiplication : any(i(j[k:])*i(j[:k])*~-gcd(i(j[k:]),i(j[:k]))for k in range(1,len(j)))

@DeadPossum Oh right, I should have done that. And yeah, my current method has a lot of golfable parts in it, but I'm going to be following ovs's suggestions. Thanks for pointing that out! (really should've tested it myself... oh well...)

You can remove a byte (almost nothing) by remove the whitespace between )) for

@ThisGuy Oh, thanks! Didn't notice that!

JavaScript (ES6), 74 71 70 bytes

f=(s,t='',u)=>u?s%t?f(t,s%t,1):t:s&&f(t+=s[0],s=s.slice(1),1)>1|f(s,t)
<input oninput=o.textContent=f(this.value)><span id=o>

Takes input as a string, which is handy for the snippet. Edit: Saved 3 bytes thanks to @user81655.

Saves two bytes: (c,i) -> c, i+1 -> ++i, t='' -> i=t='', this trick is useful any time you need to use 1-based indices and have somewhere to initialise i to 0.

Also I believe t='' could be t=0, since adding c coerces it to a string anyway.

@user81655 This happened because I originally sliced from and to i, so I didn't need 1-based indices, but then I golfed the first slice to t+=c.

Ah, OK. Also one last thing, I think this could also be shorter as a recursive function: f=(x,y,z)=>z?x%y?g(y,x%y):y:x?f(x,y,1)>1||f(x.slice(1),~~y+x[0]):0. I combined your GCD function with f as well. Could probably be golfed further. Last suggestion, I promise! :P

@user81655 Sadly my oversimplified gcd function doesn't work when x=0, and working around that and your typo took me to 72 bytes, so it was fortunate that I was then able to golf away 2 bytes.

C, 145 142 139 138 135 bytes
i,a,b;f(){char s[99];scanf("%s",s);for(char*p=s;*p++;)for(b=atoi(p),i=*p,*p=0,a=atoi(s),*p=i,i=1;i++<b;)*s=a%i-b%i|b%i?*s:0;return!*s;}

QBIC, 91 90 bytes
;_LA|[a-1|B=left$(A,b)┘C=right$(A,a-b)┘x=!B!┘y=!C![2,x|~(x>1)*(y>1)*(x%c=0)*(y%c=0)|_Xq}?0

Explanation:
;               Get A$ from the command prompt
_LA|            Get the length of A$ and place it in a% (num var)
[a-1|           for b%=1; b% <= a%-1; b%++
B=left$(A,b)    break A$ in two components on index b%
C=right$(A,a-b)
x=!B!┘y=!C!     Convert both parts from string to num, assign to x% and y%
[2,x|           FOR c% = 2; c% <= x%; c%++

This next IF (~ in QBIC) is a bit ... iffy. It consists of a set of comparators.
Each comparator yields a -1 or a 0. We take the product of these. At any failed
comparison this will yield 0. When successful, it yields 1, which is seen as true by QBasic.

~(x>1)*(y>1)        IF X>1 and Y>1 --> this stops '00' and '1' splits.
*(x%c=0)*(y%c=0)    Trial divide the splits on loop counter c%.

|_Xq            Success? THEN END, and PRINT q (which is set to 1 in QBIC)
}               Close all language constructs (2 FOR loops and an IF)
?0              We didn't quit on match, so print 0

Python 3, 70 69 bytes
import math
f=lambda n,d=1:n>d and n%d*~-math.gcd(n//d,n%d)+f(n,10*d)

Try it online!

Perl 5, 46 bytes
43 bytes of code + 3 bytes for -p flag.
s~~$\|=grep!($`%$_|$'%$_),2..$`if$`*$'~ge}{

Try it online! or try this modified version allowing multiple inputs.
You probably don't want to try this on the largest input, as it might take a (very long) while.
Explanations:
We iterate through each position in the word with s~~~g, with $` containing the numbers before and $' the numbers after. If $`*$' is true (it means that none is empty, and none is 0), then we check if a number between 2 and $` divides both of them (with the grep!(...),2..$`). If so, $\|=.. will set $\ to a non-zero value, which is implicitly printed at the end thanks to -p flag.

If anyone knows how to render a $<backquote> in SE markdown, I'd be grateful if you tell me how.

You can do it via using explicit <code> … </code> (rather than \`` … `), then escaping the backquotes as \``. Also, this comment was a pain to write, because it has to be double-escaped (and the two sets of escaping rules are different!).

@ais523 Wonderful, thank you very much! :)

Python 2, 69 bytes
f=lambda n,d=10,k=2:k<d<n and(n/d%k+n%d%k<1<n%d)|f(n,d,k+1)|f(n,10*d)

Uses recursion instead of GCD built-ins.
Try it online!
How it works
When f is called with one to three arguments (d defaults to 10, k to 2), it first checks the value of the expression k<d<n. If the inequalities k < d and d < n both hold, the expression following and gets executed and its value is returned; otherwise, f will simply return False.
In the former case, we start by evaluating the expression n/d%k+n%d%k<1<n%d.
d will always be a power of ten, so n/d and n%d effectively split the decimal digits on n into two slices. These slices are both divisible by k if and only if n/d%k+n%d%k evaluates to 0, which is tested by comparing the result with 1.
Since part of the requirements is that both slices must represent positive integers, the value of n%d is also compared with 1. Note that 1 has no prime divisors, so the more expensive comparison with 0 is not required. Also, note that d < n already ensures that n/d will evaluate to a positive integer.
Finally it recursively all f(n,d,k+1) (trying the next potential common divisor) and f(n,10*d) (trying the splitting) and returns the logical OR of all three results. This means f will return True if (and only if) k is a common divisor of n/d and n%d or the same is true for a larger value of k and/or a higher power of ten d.

source: Stack Exchange

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

sort: votes


text:
Snow Blow My Driveway!
There has recently been a big snow, and my driveway needs snow-blowing. If the snow-blower goes over some area that it has already snow-blowed, then that area will have snow blown onto it and need to be blown again. And of course, the snow-blower cannot start in the middle of the driveway, it needs to start from my garage, where it is stored.
More formally:
Your program takes a standard form of input as a string or multidimensional array that looks like the following:
XXXXOOOOXXXX
X          X
X          X
XXXXXXXXXXXX

X represents an area that cannot be snow-blowed, O represents an area where the snow-blower can be deployed, and empty spaces represent areas where there is snow. You can chose different values if you wish.
Your program must output something like the following:
XXXX*%OOXXXX
Xv<<<^<<<<<X
X>>>>>>>>>^X
XXXXXXXXXXXX

The snow-blower starts at the *. The * always points to the nearest non-garage space. The <,>,v, and ^ all represent pointers of where the next direction is. They point the snow-blower where to go. Once a pointer points to the %, the blower has re-arrived into the garage, and the whole driveway should be clear.
The snow blower must go over the whole driveway. The snowblower's path can never overlap itself. Impossible input must not be given.
Because I don't want to be outside any longer than I need to be, and not need to spend a lot of time typing, the program should be as short as possible. Shortest code wins!
Test Cases:
These test cases may have multiple correct answers. I have provided possible solutions below each test case.
Test case 1:
The one given in the example.
Test case 2:
XOOOOOX
X     X
X     X
X     XXXXXXXX
X            X
X            X
XXXXXXXXXXXXXX

X*OOO%X
Xv>>>^X
Xv^<<<X
Xv>>>^XXXXXXXX
Xv^<<<<<<<<<<X
X>>>>>>>>>>>^X
XXXXXXXXXXXXXX

Test case 3:
XOOOOX
X    X
X    X
X  XXX
X    X
X    X
XXXXXX

XOO%*X
X>>^vX
X^v<<X
X^vXXX
X^>>vX
X^<<<X
XXXXXX

Test case 4:
XXXXXXXXXXXXX
O           X
O    X      X
O    X      X
O           X
XXXXXXXXXXXXX

XXXXXXXXXXXXX
*>>>>>>>>>>vX
Ov<v<Xv<<<<<X
Ov^v^X>>>>>vX
%<^<^<<<<<<<X
XXXXXXXXXXXXX

Related ;-)

Can we assume that 1) the O's will always be in a straight continuous line? 2) that the Os will always be on the edge of the array? 3) that there will be no leading spaces? 4) that there will be no trailing spaces (i.e. in test case 2 some lines are shorter than others)?

@Pietu1998 Yes, to all of them.

JavaScript (ES6), 346 310 299 298 297 296 283 bytes

f=(a,y=0,x=0)=>(a[y][x]?a[y][x]=='O'&&(a[y][x]='*',(g=w=>(w=a[y])&&w[x]&&(w[x]<'!'?g(w[x]='v',y++)||g(w[x++]='>',y--)||g(w[--x]='^',y--)||g(w[x--]='<',y++)||+(w[++x]=' '):w[x]=='O'&&!/ /.test(a)?w[x]='%':0))(y++)||g(y-=2)||g(y++,x++)||g(x-=2)||+(a[y][++x]='O'))||f(a,y,x+1):f(a,y+1))
<textarea id="tests">XXXXOOOOXXXX
X          X
X          X
XXXXXXXXXXXX

XOOOOOX
X     X
X     X
X     XXXXXXXX
X            X
X            X
XXXXXXXXXXXXXX

XOOOOX
X    X
X    X
X  XXX
X    X
X    X
XXXXXX

XXXXXXXXXXXXX
O           X
O    X      X
O    X      X
O           X
XXXXXXXXXXXXX</textarea><br><button onclick="for(test of document.getElementById('tests').value.split('\n\n')){console.log(test);arr=test.split('\n').map(line=>line.split(''));f(arr);console.log(arr.map(line=>line.join('')).join('\n'))}">Run</button>

Quite hacky in some places, but I wanted to get the code out there. Input as a 2D character array, output by modifying said array.
Ungolfed version
This is the same exact algorithm, save for some truthy/falsy magic with +' ' being NaN being falsy (and some more), some golf variables and using ifs instead of ?:, || and &&.
f = (a, y = 0, x = 0) => {         // main function
  if (!a[y][x])                    // check for end of line
    return f(a, y + 1);            // end of line, recursively check next
  if (a[y][x] == 'O') {            // check for valid start position
    a[y][x] = '*';                 // set the start position
    function g() {                 // pathfinder function
      if (!a[y] || !a[y][x])       // check for out of bounds
        return 0;
      if (a[y][x] == ' ') {        // check for snow
        a[y][x] = 'v';             // set current cell to 'down'
        y++;                       // move position down
        if (g()) return 1;         // see if a valid route is found from there
        y--;                       // if not, reset position and try again
        a[y][x] = '>';             // repeat for other directions
        x++;
        if (g()) return 1;
        x--;
        a[y][x] = '^';
        y--;
        if (g()) return 1;
        y++;
        a[y][x] = '<';
        x--;
        if (g()) return 1;
        x++;
        a[y][x] = ' ';             // no route found, reset cell to snow
        return 0;
      }
      if (a[y][x] == 'O'           // check for valid exit
          && !/ /.test(a)) {       // and that no snow is left
        a[y][x] = '%';             // set the exit
        return 1;
      }
    }
    y++;                           // move a cell down from the start position
    if (g()) return 1;             // see if a valid route starts there
    y -= 2;                        // repeat for other directions
    if (g()) return 1;
    y++; x++;
    if (g()) return 1;
    x -= 2;
    if (g()) return 1;
    x++;
    a[y][x] = 'O';                 // no route found, continue on
  }
  return f(a, y, x + 1);           // check the next cell
}

Python3, 737 bytes
E=enumerate
G=['v','^','>','<']
O=lambda x,y,D,M=1:[(*t,D[t],m)for(X,Y),m in zip([(1,0),(-1,0),(0,1),(0,-1)],G)if(M==1 or[m in G[:2],m in G[2:]][M in G[:2]])and(t:=(x+X,y+Y))in D]
def f(b):
 d={(x,y):v for x,j in E(b)for y,v in E(j)}
 q=[({**d,i:'*'},*i)for i in d if'O'==d[i]][:1]
 while q:
  D,x,y=q.pop(0)
  u,F={},1
  Q=[]
  for X,Y,v,m in O(x,y,D):
   u[v]=(m,(X,Y))
   if' '==v and{V for J,K,V,_ in O(X,Y,D,m)if(J,K)not in[(X,Y),(x,y)]}&{'O','X',*G}:Q+=[({**D,(X,Y):m},X,Y)];F=0
  if F:
   if' 'not in D.values()and'O'in u:
    D={**D,u['O'][1]:'%'}
    for x,y in D:b[x][y]=D[(x,y)]
    return b
   elif' 'in u:Q+=[({**D,u[' '][1]:u[' '][0]},*u[' '][1])]
  if not all(' 'not in[V for *_,V,_ in O(*i,D)]for i in D if'O'==D[i]):q+=Q

Try it online!

all_licenses: 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/


text:
Island Golf #2: The Eccentric Hermits
This is the second in a series of Island Golf challenges. Previous challenge
Two hermits have arrived on a desert island. Since they came seeking solitude, they wish to live as far away from each other as possible. Where should they build their huts to maximize the walking distance between them?
Related reading
Input
Your input will be a rectangular grid consisting of two characters, representing land and water. In the examples below, land is # and water is ., but you may substitute any two distinct characters you wish.
...........
...##......
..#####....
..#######..
.#########.
...#######.
...#####.#.
....####...
...........

There will always be at least two land tiles. The land tiles will all be contiguous (i.e. there's only one island). The water tiles will also be contiguous (i.e. there are no lakes). The outer border of the grid will all be water tiles. Land tiles will not be connected diagonally: i.e., you will never see something like
....
.#..
..#.
....

Output
Your code must output the same grid, with two hut locations marked on it. In the examples below, the hut locations are marked with X, but you may substitute any character as long as it is distinct from your land and water characters.
The hut locations must be two land tiles, chosen so as to maximize the walking distance between them. We define walking distance as the length of the shortest path, entirely on land, between the two points. Land tiles are considered adjacent horizontally or vertically, but not diagonally.
A possible solution for the above island:
...........
...X#......
..#####....
..#######..
.#########.
...#######.
...#####.X.
....####...
...........

The walking distance between these two points is 11, which is the greatest distance between any two points on this island. There is another distance-11 solution:
...........
...##......
..X####....
..#######..
.#########.
...#######.
...#####.X.
....####...
...........

Details
Your solution may be a full program or a function. Any of the default input and output methods are acceptable.
Your input and output may be a multiline string, a list of strings, or a 2D array/nested list of characters/single-character strings. Your output may (optionally) have a single trailing newline. As mentioned above, you may use any three distinct characters in place of #.X (please specify in your submission which characters you're using).
Test cases
A. Islands with unique hut placements:
....
.##.
....

....
.XX.
....

......
......
..##..
...#..
......
......

......
......
..X#..
...X..
......
......

........
.#####..
.##..##.
.#..###.
.##..##.
........

........
.#####..
.##..##.
.#..###.
.#X..#X.
........

.........
.#####.#.
.#...#.#.
.#.###.#.
.#.....#.
.#######.
.........

.........
.#####.X.
.#...#.#.
.#.X##.#.
.#.....#.
.#######.
.........

B. Example of an island with multiple possible solutions:
........
....##..
...####.
..###...
.#####..
.#####..
..##....
........

Possible outputs:
........
....#X..
...####.
..###...
.#####..
.X####..
..##....
........

........
....#X..
...####.
..###...
.#####..
.#####..
..X#....
........

........
....##..
...###X.
..###...
.#####..
.X####..
..##....
........

........
....##..
...###X.
..###...
.#####..
.#####..
..X#....
........

C. Large test case as a Gist

This is code-golf: the shortest code in each language wins.

These are great little challenges (I especially like not having to do any bounds checking!): looking forward to the next one!

walking distance is manhattan distance?

@SargeBorsch Closely related, but not always the same. Manhattan distance is just Δx + Δy, but walking distance may be longer because you can't walk across ocean tiles. (See the last example in section 'A', for example. The Manhattan distance between the two X's is 6, but the walking distance--following the spiral--is 22.)

Python 3, 249 246 bytes
Shaved off 3 bytes, thanks DLosc.
Input and output are single strings, with '.', '@', and 'X' representing water, huts, and land, respectively.
A='@'
def f(s):
 w=s.find('\n')+1;d=u={(k,k):0for k,c in enumerate(s)if A<c}
 while u:d.update(u);u={(k,j):d[(k,i)]+1for k,i in d for j in{i+1,i+w,i-1,i-w}if A<s[j]and(k,j)not in d}
 k,j=sorted(max(d,key=d.get))
 return s[:k]+A+s[k+1:j]+A+s[j+1:]

Prior version:
Input is a single string, with '.' and '#' representing water and land, respectively.  'X' represents the huts in the output.
def f(s):
 w=s.find('\n')+1;d=u={(k,k):0for k,c in enumerate(s)if'#'==c}
 while u:d.update(u);u={(k,j):d[(k,i)]+1 for k,i in d for j in{i+1,i+w,i-1,i-w}if'#'==s[j]and(k,j)not in d}
 k,j=sorted(max(d,key=d.get))
 return s[:k]+'X'+s[k+1:j]+'X'+s[j+1:]

Explanation:
It's basically doing a breadth first search from every possible starting point at the same time.  Keep a dictionary, d, of path lengths keyed by the start and end of the path, e.g., d[(k,i)] is the distance from k to i.  Then iterate over the keys in the dictionary, d, and create a new dictionary, u, with paths that are 1 unit longer by moving the end point 1 unit to the N,S,E,W, e.g., u[(k, i+1)] = d[(k,i)] + 1.  Don't include paths that are already in d.  If u is not empty, then add the new longer paths to d and repeat.  When u is empty, that means no more paths could be made.  Now d contains all the possible paths and their lengths.  So its just a matter of getting the key with the longest path.
Less golfed, commented version:
def f(s):
  w=s.find('\n')+1                    # width of a row, or a move N or S

  d = {}                              # dictionary of all the paths.
                                      # The key is a tuple (k,j) and the
                                      # value is the distance from k to j.
  for k,c in enumerate(s):            # Initialize. Distance from k to k is 0
    if'#'==c:                         # Only do land.
      d[(k,k)] = 0

  u = d                               # dictionary of new paths. initialize it to d
                                      # so loop is entered. first d.update is
                                      # basically a NOP

  while u:                            # while there are new paths
    d.update(u)                       # add the new paths to the dict of old paths
    u={}                              #
    for k,i in d:                     # iterate over the known paths. k is the start, i is the end
      for j in{i+1,i+w,i-1,i-w}:      # iterate over squares 1 move to the E,S,W,N from i
        if'#'==s[j]and(k,j)not in d:  # if it's still land, and the path (k,j) isn't already in d,
          u[(k,j)] = d[(k,i)]+1       # then add the new path to u

  k,j=sorted(max(d,key=d.get))        # find the longest path

  return s[:k]+'X'+s[k+1:j]+'X'+s[j+1:]  # X marks the endpoints.

C#, 387 bytes
Let's get the ball rolling...
using C=System.Console;class P{static void Main(){string D="",L;int W=0,H=0,z,n,q,h,b=0,c,a,i=0,j=0;for(;(L=C.ReadLine())!=null;H+=W=L.Length)D+=L+="\n";for(z=H;z-->0;){int[]S=new int[H],Q=new int[H*8];for(Q[h=q=0]=z;q<=h;)if((c=S[n=Q[q++]]-1)<0&D[S[n]=n]==35)for(a=4;a-->0;b=c<b?c+(i=z)*(j=n)*0:b)S[Q[++h]=new[]{1,-1,W,-W}[a]+n]=S[Q[h]]<1?c:1;}for(;++z<H;)C.Write(z==i|z==j?'X':D[z]);}}

Try it Online
Complete program, reads from STDIN, writes to STDOUT. It simply goes over each cell, and runs a BFS to compute the farthest cell, recording both if it is the farthest on record. Nothing to it really, and frustratingly little I can find to golf.
Formatted and commented code:
using C=System.Console;

class P
{
    // \n 10
    // \r 13
    // . 46
    // # 35
    // x 88

    static void Main()
    {
        string D="", // map
            L; // line of input

        int W=0, // width
            H=0, // length
            z, // outer position
            n, // next position to expand
            q, // queue position pointer
            h, // queue head pointer
            b=0, // best
            c, // distance to this cell (negative)
            a, // counter
            i=0, // hermit 1 pos
            j=0; // hermit 2 pos

        for(;(L=C.ReadLine())!=null; // read a line, while we can
                H+=W=L.Length) // record the width, and add to length
            D+=L+="\n"; // add a newline, and add the line to the map

        for(z=H;z-->0;) // for each cell
        {
            int[]S=new int[H], // 'seen' >0 -> seen, else it is the distance we have found to it
                Q=new int[H*8]; // due queue (fewer than H*4 expantions, two ints each)

            // standard BFS
            for(Q[h=q=0] // reset currect
                =z; // expand z first
                q<=h;)
                if((c=S[n=Q[q++]]-1)<0& // record 'seen', and check we havn't been seen
                    D[S[n]=n]==35) // mark as seen, and check we are a hash #
                    // 'move'
                    for(a=4;a-->0; // for each of the 4 neighbours
                            b=c<b? // if we have beaten the best
                            c+(i=z)*(j=n)*0: // set new best, record hermit positions
                            b)
                        S[Q[++h]=new[]{1,-1,W,-W}[a]+n]= // queue it for expantion
                        S[Q[h]]<1? // not seen? (this is BFS, don't need to check c is less thatn S[l+n]
                        c: // distance
                        1; // mark as seen (means it won't actually be expanded)
        }

        // z = -1
        for(;++z<H;) // for each cell
            C.Write(z==i|z==j?'X':D[z]); // print either the original char, or X if it is a hermit's home
    }
}


text:
Output the missing integer
You will be given a string. It will contain 9 unique integers from 0-9. You must return the missing integer. The string will look like this:
123456789
 > 0

134567890
 > 2

867953120
 > 4

@riker That seems to be about finding a number missing in a sequence. This seems to be about finding a digit missing from a set.

@DJMcMayhem this is definitely a subset of that challenge though. It's not a superset, but most answers from the challenge can be trivially copied over.

@Riker I wouldn't think it's a duplicate, given that the linked challenge has a strictly incrementing sequence (of potentially multi-digit numbers), whereas here it's in arbitrary order.

Hi Josh! Since no one else has mentioned it so far, I'll direct you to the Sandbox where you can post future challenge ideas and get meaningful feedback before posting to main. That would have helped iron out any details (like STDIN/STDOUT) and resolved the duplicate dilemma before you received downvotes here.

It's such a shame that 9-x%9 works for any digit except 0. Maybe someone more clever than me will find a way to make it work.

Several answers take an integer as function input. Is that allowed?

I can't technically 'return' an integer in SInclair ZX80 or ZX81 BASIC, but would it be okay to store the missing integer in a variable and printing that once I have returned from a sub-routine that will determine the missing variable?

Can I print the number twice?

Can I take input as a newline-separated string?

Python 2, 18 16 bytes
+beauty thanks to @Sarge Borsch

`99066**2`.strip

Try it online!
99066**2 is just a shorter way to generate a string that contains 0~9

32043 can be changed to a more beautiful number. 99066 is center-symmetric (doesn't change if rotated 180 degrees around center) or maybe 97779 (palindrome, two distinct digits)

If the OP allows to print the number twice, 764**4 can save two bytes.

@Titus 764**4 is missing 5,8 and 9

Typo ... I meant 763**4 = 338920744561

Python, 22 bytes
lambda s:-int(s,16)%15

Try it online!
An arithmetic solution. Interprets the input string as hex, negates it, and takes the result modulo 15.

Can you explain why this works?

@KarlKastor, modulo 15 in base 16 works analogically to modulo 9 in base 10. Modulo base-1 is constant when taking sum of digits, just because 10 ≡ 1 (mod base-1). Sum of all possible digits is constant, so the missing digit is the difference of this constant and the input number (modulo base-1).

APL (Dyalog), 4 bytes
Derived function
⎕D∘~

⎕D Digits
∘ (ties a left argument to the following dyadic function to create a monadic function)
~ except [the argument]
Try it online!

Function train
⎕D~⊢

⎕D Digits
~ except
⊢ the right argument
Try it online!

Explicit program
⎕D~⍞

⎕D Digits
~ except
⍞ character input
Try it online!

Haskell, 24 23 bytes
(477-).sum.map fromEnum

Try it online! Usage: (477-).sum.map fromEnum $ "123456890". 477 is the sum of the character codes of the digits 1 to 9, excluding 0. This anonymous function computes 477 minus the sum of all digit character codes to find the missing one.
Turning the char digits to ints is one byte longer:
(45-).sum.map(read.pure)
foldl(\a b->a-read[b])45

Try it online!

Brain-Flak, 48 38 36 + 3 = 39 bytes
10 bytes saved thanks to DJMcMayhem!
((([]())[]{}){()()({}[()])}{}[{{}}])

Try it online!
Explanation
The sum of all the digits in Ascii is 525.  This program sums up the input and subtracts it from 525 to get the missing digit.
((([]())[]{}){()()({}[()])}{}      )

Will push 525.  This takes advantage of the fact that we know there will be 9 elements of input to begin with.  This means that [] evaluates to 9 which allows us to get to large numbers like 525 quickly.
Next we have the bit:
                             [{{}}]

which will sum up the inputs and subtract it from the total.

How does this work?

@ГригорийПерельман Explanation added!

If you move the negative(sum(input())) to the end, you can abuse the stack-height nilad to push 525 easier. (([][][]()()()){()()({}[()])}{}[{{}}]) should save you 10 bytes

30 bytes by subtracting 477 instead

Jelly, 3 bytes
ØDḟ

Simply filters (ḟ) the input string from “0123456789” (ØD).
Try it online!

I like the way that all the golfing languages (and even some non-golfing languages) are using the same algorithm, but Jelly manages to have the shortest names for the builtins it uses, and the least boilerplate for reversing the arguments to ḟ.

@ais523 APL is letter by letter the same (except that it would be an APL snippet rather than a function/program): Ø=⎕, D=D, ḟ=~, as in ⎕D~'867953120'.

Me, while scrolling through the answers: "I'm predicting 3 characters in Jelly." Bingo. :^D

JavaScript (ES6), 26
Edit 1 byte save thx @Neil, with a much more smarter trick
Xoring all the values from 1 to 9 gives 1. Xor 1 one more time and the result is 0. So, if any single value is missing, the result will be the missing value.
s=>eval([1,...s].join`^`)

Test

f=s=>eval([1,...s].join`^`)

function go() {

  var i=I.value;
  O.textContent = f(i)
}

go()
<input oninput='go()' value='012987653' id=I>

s=>eval([1,...s].join`^`) saves a byte.

@Neil ... and it's much more interesting too

I feel this tip came suspiciously short after my answer :D anyway nice golf +1.

@Christoph Well it sounded as if you wanted to spread the word...

@Neil absolutly :) Nice to see that it helped!

Ruby, 14
Sums the ascii codes and subtracts from 48*9+45
->s{477-s.sum}

Use like this
f=->s{477-s.sum}

puts f["123456789"]

Retina, 27 21 19 bytes
-6 Thanks to Basic Sunset
-2 Thanks to Martin Ender
.
$*_5$*
+`_1|1_

1

Try it online!
Replace every digit with that many _s and 5 1s:
.
$*_5$*

Remove all of the _s and a 1 for each:
+`_1|1_

Count the number of 1s left:
1

The first line of the second answer can be just ..

You can save a few bytes by using deduplication instead of replacement: Try it online

Oh well, and here was I just getting the second answer down to the old byte count of the first answer... ^ 5 ^. $*9¶ . $*_ +`_¶_ ¶ _

@Neil I got it to one less than the original.

(Huh, that looks suspiciously similar to my answer, the only difference is that you switched from _ to 1 to save a byte.)

@Neil It is. I forgot to up the amount of credit I gave you, my bad.

Thanks! (But I'm still impressed by the extra byte saving.)

@Neil I only knew of that because Martin Ender commented on my last Retina answer to tell me about it.

Here's a worse answer using a similar approach, but perhaps someone can see an opportunity I missed.

Brainfuck, 17 15 bytes
-[-[->-<],]>++.

Try it out here.
This solution works on standard Brainfuck (8-bit cells) only, as it relies on wrapping.
It's a rare day when Brainfuck can actually compete, but this challenge just happened to line up with the BF spec pretty well!
Instead of straight-up breaking down this answer, I'd like to step through the iterations I took, because I think it would be more understandable (and more interesting).
Note: this solution is inspired largely by Wheat Wizard's Brain-Flak answer.
Explanation
Step 1, 26 bytes
In his answer, Wheat Wizard pointed out that the sum of the ASCII values from 0-9 sum to 525. And since standard Brainfuck only has a notion of [0,255], this makes the value 525 % 256 = 13. That is to say, subtracting the ASCII values of the input from 13 nets you the missing digit.
The first version of this program was:
 1. Put 13 in the first cell
 2. Take inputs into the second cell
 3. Subtract the second cell from the first cell
 4. Jump to 2 if there are inputs remaining
 5. Print the first cell
And here's the code for the simple solution:
+++++++++++++ #Set the first cell to 13
>,            #Take inputs into the second cell
[[<->-],]     #Subtract the second cell from the first cell and repeat until inputs are over
<.            #Print the first cell

Step 2, 19 bytes
As pointed out in his answer, since we know the input will be exactly length 9, we can use that value as a constant, and eliminate that long string of +'s right at the beginning.
It also doesn't matter at what point we add 13 (thanks, commutative property!), so we'll mix it in with the subtraction and printing steps.
,        #Take input to enter the loop
[[->-<], #Subtract the first cell from the second cell
>+<]     #Add 1 for each input; totaling 9
>++++    #Add the missing 4 to make 13
.        #And print

This was my original answer to this problem, but we can do better.
Step 3, 17 bytes
Interestingly enough, the previous answer works even if we begin with a + instead of a ,
+[[->-<],>+<]>++++.

Brainfuck required something in a cell in order to begin a loop. We naively added that extra 4 in the end, when it could have gone in other places.
-[[->-<],>+<]>++.

With some totally intentional (read: trial and error) loop trickery, starting off the program with a - leads to two interesting results:

One gets added to the second cell (saving 1 byte at the end).
The loops runs one extra time, totaling 10 instead of 9 (saving another 1 byte).

1 + 10 + 2 = 13, and we end up with the original answer.
Looking back on it, this is probably an excessive write-up for such a simple Brainfuck program.
Step 4, 15 bytes
After thinking about this solution a bit more, I was able to cut off 2 bytes.
I wanted to clarify something about the previous step:
The minus to enter the loop effectively adds 1, but what it's actually doing is subtracting 255 from the second cell (resulting in 1).
It's obvious in retrospect, but subtracting 1 from the first cell is the same as adding 1 to the second cell (because everything in the first cell gets subtracted from the second cell.)
-[-[->-<],]>++.

I was able to remove the ">+<" by adding a "-" at the beginning of the first loop. It has to go there, and not where the ">+<" was, because the program will loop infinitely otherwise.

05AB1E, 6 bytes
45¹SO-

Try it online!
45     # Push 45
  ¹    # push input
   S   # Split
    O  # Sum
     - # Subtract (45 - sum)

JavaScript (ES6), 31 29 28 22 bytes
s=>(15-`0x${s}`%15)%15

Port of @xnor's Python answer, except that JavaScript only has a remainder operator rather than a modulo operator, so I can't do it in a single step. Edit: Saved 6 bytes thanks to @Arnauld.

s=>[...s].map(c=>r-=c,r=45)|r ;-)

You are too much in love with reduce. +1 anyway

@Arnauld I don't see that working when s[0]!='0', but there's already an answer that uses eval.

Could you do s=>(15-\0x${s}`%15)%15`?

@Arnauld Bah, and I'd already done that for the Batch port too...

Mathematica, 25 bytes
477-Tr@ToCharacterCode@#&

Pure function taking a string as input and returning an integer.
Mathematica has long command names and is reluctant to convert between strings and integers, which makes it particularly bad at this challenge. The best I could find was the algorithm from Level River St's Ruby answer, which does a computation based on the total of the ASCII codes of the input string; in Mathematica, this uses only one long command name.

PHP, 27
<?=trim(32043**2,$argv[1]);

uses the trick from Rod's answer to generate a string containing all digits then removes all digits except for the missing one.

PHP, 41
for($b=1;$i<9;$b^=$argv[1][$i++]);echo$b;

This one uses xor because I haven't seen it yet.

Nice I have not think about trim. Alternatives values 32043,32286,33144,35172,35337,35757,35853,37176,37905,38772,39147,39336,40545,42744,43902,44016,45567,45624,46587,48852,49314,49353,50706,53976,54918,55446,55524,55581,55626,56532,57321,58413,58455,58554,59403,60984,61575,61866,62679,62961,63051,63129,65634,65637,66105,66276,67677,68763,68781,69513,71433,72621,75759,76047,76182,77346,78072,78453,80361,80445,81222,81945,83919,84648,85353,85743,85803,86073,87639,88623,89079,89145,89355,89523,90144,90153,90198,91248,91605,92214,94695,95154,96702,97779,98055,98802,99066

Bash + coreutils, 19 bytes
I found a shorter bash solution, that uses an interesting checksum approach:
sum -s|dc -e524?--P

Try it online!
Explanation:
The sum command prints a checksum and a block count. I don't know many details, but using the option -s (System V algorithm) will make the checksum equal to the ASCII sum of each input character code. As such, the checksum remains constant when the order of the same input characters changes.
Given 867953120 as test case (last example), here is how the script works:

sum -s outputs 473 1. If no integer was missing, the checksum would have been 525.
dc -e524? pushes 524 and then the pipe input. The stack is: 1 473 524. The idea is to subtract the checksum from 525, but since sum outputs 1 as well, I need to work with it.
--P. After applying the two subtractions (524-(473-1)), the stack is: 52. With 'P' I print the character with that ASCII code: 4, the missing digit.

Octave, 22 bytes
@(x)setdiff('0':'9',x)

Try it online!

Google Sheets, 39 33 bytes

Input is entered into cell A1.

Code:
=REGEXEXTRACT(4&2^29,"[^"&A1&"]")

Saved 6 bytes thanks to Steve Kass.
Previous Code:
=REGEXEXTRACT("0123456789","[^"&A1&"]")

Result:

The number 2^29 has all the digits but 4, so 33 bytes: =REGEXEXTRACT(4&2^29,"[^"&A4&"]")

@SteveKass Nice. =REGEXEXTRACT(0&49^9,"[^"&A1&"]") is also a valid solution, given similar logic. Updated answer.

Bash (+utilities), 22, 19 bytes

Use seq instead of brace expansion, -3 bytes (Thx @Riley !)

seq 0 9|tr -d \\n$1

Test
$seq 0 9|tr -d \\n123456789
0

Try It Online!

If you moved the space before the $1 it would be more obvious...

@Neil, yep, that's a nice idea ! Thx !

You could use seq instead of echo:  seq 0 9|tr -d \\n$1

Bash, 36 30 bytes
(fold -1;seq 0 9)|sort|uniq -u

Try it online!
Posting to get golfing tips over this.
Thanks @DigitalTrauma, big fan ;)
fold -1 writes one char of input per line
seq 0 9 writes 0..9 one per line after this.
Those lines are fed to sort and filtered by uniq -u displaying only not duplicated lines.

Without changing the approach, a couple of things to make this shorter: 1) have fold take input directly from STDIN instead of the herestring, and 2) have the `(fold|seq) output pipe directly to sort, instead of the process substitution

One of my first posts, I was an addict for some time...

Fortran 95, 146 128 bytes
function m(s)
character(len=10)::s,t
t='0123456789'
do j=1,10
k=0
do i=1,9
if(s(i:i)==t(j:j))k=1
end do
if(k==0)m=j-1
end do
end

Not very short, I'm afraid.
Ungolfed:
integer function m(s)
    implicit none

    character(len=9)::s
    character(len=10)::t
    integer:: i, j, k

    t='0123456789'
    do j=1,10
        k=0
        do i=1,9
            if (s(i:i) == t(j:j)) k=1
        end do
        if (k==0) m=j-1
    end do

end function m

dc, 12 10 bytes
Cdi?B%-B%p

Try the dc version online!
This uses the fact that the sum of the digits from 0 to 9 is 45, which is 1 more than a multiple of 11.
The program works by viewing the input as a base 12 number, finding its remainder when divided by 11, and subtracting that from 12 (to find the missing digit).  The only catch is that if 0 or 1 is the missing digit, this would give an answer of 11 or 12, respectively, so I mod out by 11 one additional time at the end to take care of those cases.

This yields a short bash solution also:
Bash + Unix utilities, 17 15 bytes
dc -eCdi?B%-B%p

Try the bash version online!

PowerShell, 30 bytes
param($n)0..9|?{$n-notmatch$_}

Try it online!
Takes input $n, constructs a range 0..9 (i.e., 0, 1, 2 ... 9), then uses a Where-Object clause (the |?{...}) to pull out the number that does regex -notmatch. That's left on the pipeline, output is implicit.

CJam, 5 bytes
A,sq-

Try it online!
A,     e# The range from 0 to 9: [0 1 2 3 4 5 6 7 8 9]
  s    e# Cast to a string: "0123456789"
   q   e# The input
    -  e# Remove all characters from the range that are in the input
       e# Implicit output

GNU sed, 36 bytes
Includes +1 for -r
s/$/0123456789/
:
s/(.)(.*)\1/\2/
t

Try it online!
s/$/0123456789/ # Append 0123456789
:               # Start loop
s/(.)(.*)\1/\2/ # remove a duplicate character
t               # loop if something changed

05AB1E, 5 bytes
žhISK

Try it online!
Explanation
žh     # from the string "0123456789"
    K  # remove
  IS   # each digit of the input

I like it because you can say it out loud. '"žhISK", he cried, as he waved his wand over the top-hat and a small white rabbit appeared in a puff of smoke'.

SK can now be м to save a byte.

Brachylog (2), 5 bytes
ẹ:Ị↔x

Try it online!
Arguably should be shorter (I'm still confused as to why the ẹ is necessary), but this is the best I could do.
Explanation
ẹ:Ị↔x
ẹ      Split the input into a list of characters
 :Ị    Pair that list with the string "0123456789"
   ↔x  Remove all elements of the list from the string

x implementation is old and pretty buggy, which is why you need ẹ.

You can actually make an argument that something like ¬∋ℕ should work in only 3 characters – that's what I tried first – but there's multiple reasons why it doesn't, and I don't think there's any plausible way to change Brachylog so that it would.

Having ¬∋ℕ work like that is not even possible in Prolog, unless specifically programming what you mean by not not in. ¬ in Brachylog is equivalent to \+ in Prolog, and its meaning is that of "not provable under the closed-world assumption", rather than "give me choice points for everything that does not verify this" (which is almost always an infinite number of things)

The only way to do it in Prolog would be to "labelize" the ℕ in advance, but that would mean tinkering with Brachylog's evaluation order based on the content of the predicates. That's only one of the problems it has, though; there are a ton of others.

Japt, 6 bytes
¬x n45

Try it online!
Explanation:
¬x n45
   n45     // 45-
¬          //    Split the input into an array "123" → ["1","2","3"]
 x         //    Return the sum of all the items ["1","2","3"] → 6
           // 45 - 6 = output

Befunge 98, 14 12 bytes
I saved 1 byte by moving the program onto 1 line and 1 byte by doing some better math
~+;@.%a--7;#

Try it online!
Explanation
The sum of the ASCII values range from 477 to 468 depending on which number is missing. By subtracting this from 7, we get the range -470 to -461. By modding this number by 10, we get the range 0 - 9, which we can then print.
~+;       ;#    Sums the ASCII values of all characters to stdIn
~          #    The # doesn't skip over the ~ because it's on the end of a line
~               Once EOF is hit, the ~ reverses the IP's direction
          ;#    Jump the ; that was used before
       --7      Subtract the sum from 7 (really just 0 - (sum - 7))
     %a         Mod it by 10
   @.           Print and exit

The reason I use the ASCII values instead of taking integer input is because the & command in Try it Online halts on EOF (Even though it should reverse the IP). The ~ works correctly, though.
Old Program, 14 bytes
#v~+
@>'i5*--,

The sum of the ASCII values of all 10 digits is 525. By subtracting the sum of the given digits from 525, we get the ASCII value of the missing character.
#v~+         Sums the ASCII values of all characters on stdIn
             Moves to the next line when this is done
 >'i5*       Pushes 525 (105 * 5)
      --     Subtracts the sum from 525
@       ,    Prints and exits

Common Lisp, 47 bytes
(lambda(s)(- 45(reduce'+ s :key'digit-char-p)))

Ungolfed:
(lambda (s) (- 45 (reduce '+ s :key 'digit-char-p)))

Explaination:
(reduce '+ s :key 'digit-char-p)

This loops through the chars in s, converts them to digits, and adds them. Digit-char-p, conveniently, return the number of the char as its "true" value, so it can be used as a test or a conversion.
(- 45 ...)

Subtract from 45 gives back the digit that was missing from the input.

Cubix, 18 Bytes
5v&;52/ni?@.>!&oW+

Expanded
    5 v
    & ;
5 2 / n i ? @ .
> ! & o W + . .
    . .
    . .

Try it here
Uses the same sort of method as this brain-flak answer.
Create the value -525 on the stack by pushing 5, 2, concatenate, push 5, concatenate and negate.
Then repeatably get input and add until end of input is hit.
Remove the last input, negate(make positive) the last add result, output the character and halt.
The reason for working from -525 up is that the character output is hit for each input iteration.  Since the value is negative, nothing is output until the loop is exited and the negative value is made positive.

PHP, 37 bytes
<?=45-array_sum(str_split($argv[1]));

K (ngn/k), 5 bytes
477-/

Try it online!
Subtracts the ASCII character codes of the input string from 477.

Vyxal, 3 bytes
kd⊍

Try it Online!
Imagine not having set operations.
Explained
kd⊍
kd    # "0123456789"
  ⊍   # set(↑) ^ set(input)

Fig lol no set operations

Risky, 5 bytes
+0/+/-_?}*

Input and output are integers. Try it online!
Explanation
Here's a rough diagram of the program's parse tree:
    +
    -
  0   _
 +     }
/ /   ? *

It calculates the set difference between the list of numbers 0 through 9 and the list of digits in the input (example input 134567890):
  /         5
  /+/       5+5 = 10
 0/+/       range(10) = [0,1,2,3,4,5,6,7,8,9]
       ?    input number = 134567890
         *  10
       ?}*  to-base(134567890, 10) = [1,3,4,5,6,7,8,9,0]
      _?}*  no-op
 0/+/-_?}*  diff([0,1,2,3,4,5,6,7,8,9], [1,3,4,5,6,7,8,9,0]) = [2]
+0/+/-_?}*  sum([2]) = 2

If input as a list of digits is acceptable, here's a 3-byte solution:
+0*-_?

It's the same idea, just skips the base-conversion step.

Fig, \$4\log_{256}(96)\approx\$ 3.292 bytes
Fxcd

Try it online!
Fxcd
Fx   # Remove all elements of the input
  cd # From the string "0123456789"

Perl 5 -p, 12 bytes
$_=-hex()%15

Try it online!
Explanation:
Interprets input as hex string, negates it, and calculates modulo 15 (based on xnor's Python answer).

J, 9 bytes
Num_j_&-.

Try it online!

Pyth, 5 Bytes
-jkUT

try it!
explanation
-jkUT
    T   # 10
   U    # The unary range of ten: [0,1,..,9]
 jk     # join that on the empty string
-       # set minus

"-jUT" also kinda works but produces newlines for every int.

The interpreter at the provided link throws errors, this one works: Try it online!

Röda, 28 bytes
{(_/"")|ord _|sum|chr 525-_}

Try it online!

C (tcc), 36 31 bytes
f(long*s){s=9-(*s+s[1]%16)%15;}

Takes a string as input and returns an int. As written, this work only on little-endian architectures.
The lack of a return statement is undefined behavior, but this works with tcc and gcc.
Try it online!
Alternate version, 33 bytes, no UB
f(long*s){*s=57-(*s+s[1]%16)%15;}

Takes a string pointer as input and overwrites the string with the result (allowed by default).
While this is perfectly valid C, it will not work with compilers such as gcc, which store strings in read-only memory sections.
Try it online!

I like the use of longs to compress the information.

Wren, 31 bytes
Fn.new{|x|"0123456789".trim(x)}

Try it online!
Explanation
Fn.new{|x|                      // New anonymous function with parameter x
          "0123456789"          // Declare all the numbers
                      .trim(x)  // Trim out everything included in x
                              } // The remaining number is the result

Clojure, 28 bytes
#(- 477(apply +(map int %)))

Javascript, 18 17 bytes
-1B from tsh
s=>9-('0x9'+s)%15

F=
s=>9-('0x9'+s)%15
;
console.log(F('135792048'))

use 9-('0x9'+s)%15 save 1 bytes

Dash (POSIX shell with POSIX utility ), 50 47 27 bytes
$((1${1%0*}-1$1?9-9$1%9:0))

Try it online!
The code above evaluates to a string of digit.
Alternative
$((1${1#*0}-1$1?9-9$1%9:0))

How it works

${1%0*}. If $1 has 0, then remove digits from right up to 0; else unchanged.
${1#*0}. Similar but from left.
Why 1$1 and 9$9? Numbers begining from 0 is octal; but it would be syntax error if $1 has 8 and 9. They are for workarounding.

Excel, 28 bytes
=SUM(45,-MID(A2,ROW(1:9),1))

Julia 1.0, 22 bytes
~x=(w='0':'9')[w.∉x]

Try it online!

you can remove the parens around a[.!occursin.(a,x)] and [ and ;] around '0':'9' to save 5 bytes.

You can also save another two by defining the variable inline: ~x=(w='0':'9')[.!occursin.(w,x)][1]

22 bytes using ∉ and printing a single element array

Thanks, amelies. I've used your solution and changed this answer to a community wiki.

PHP, 53 bytes
There allready was a array_sum and regex solution, wanted to provide another:
print_r(array_diff(range(0,9),str_split($argvs[1])));

A few bytes more, but as bonus it will provide all missing numbers.

MATL, 6 bytes
4Y2jX-

Try it at MATL Online
Explanation
4Y2     % Pre-defined literal for '0123456789'
j       % Grab input as a string
X-      % Compute the set difference between the two, yields the characters in
        % '0123456789' that are missing in the input
        % Implicitly display the result

JavaScript, 26 bytes
v=>45-eval([...v].join`+`)

I'm not a big fan of eval, but it does the job.
The sum of all digits 0-9 is 45.  45 minus the sum of the passed-in digits is the value of the missing digit.
Test

f=v=>45-eval([...v].join`+`)

function test() {

  var i=I.value;
  O.textContent = f(i)
}

test()
<input oninput='test()' value='012987654' id=I>

Scala, 9 bytes
477-_.sum

To use it, assign it to a variable:
val f:(String=>Int)=477-_.sum

_ is syntactix sugar for the arguments of a function, so this expands to x  => 477 - x.sum, which will subtract the sum of the ascii codes of the input from 477.

J, 14 bytes
((i.10)-."."0)

Try it online!
J is always surprisingly inadequate for golfing :(
(                )  NB. Monadic fork: (f g h) x = (f x) g (h x)
  (i.10)            NB. Array of integers from 0 to 9
            "."0    NB. Digits of string (". = evaluate, "0 = each atom)
         -.         NB. Except

You can save 2 bytes by shortening (i.10)"_ to (i.10)

@TIkkanz thanks! I never remember the left verb of a fork can be a noun :(

Pure bash, 28
a=1234567890
echo ${a//[$1]}

Try it online.

AWK, 18 bytes
{$0=/0/?9-$0%9:0}1

AWK live editor
Explanation: If 0 exists in the input, return 9 - modulo 9 of the input, otherwise return 0. Implicit print.

TXR Lisp, 28 bytes:
This is 28 bytes. It reads a line of digits and yields a string of the missing ones as the result value;
(diff"0123456789"(get-line))

This uses the awk macro to do read every line of input and print the missing digits. It only adds one byte  to the length:
(awk((mf(diff"0123456789"))))

At the system prompt:
$ txr -P '(diff"0123456789"(get-line))'
135249
0678

$ txr -e '(awk((mf(diff"0123456789"))))'
123456789
0
234567890
1
012357698
4
13579
02468
^D

PHP, 50 39 Bytes
function x($y){echo(45-array_sum(str_split($y)));}
Jörg Hülsermann's answer prompted me to try the CLI method, Thanks.
echo 45-array_sum(str_split($argv[1]));

Test it at the command line with:
php -r 'echo 45-array_sum(str_split($argv[1]))."\n";' /'12346789'

Test it (The old version) here if you'd like.
Wheat Wizard's answer put me in the right direction and I got help from This Answer

Perl 5, 21 bytes
20 bytes of code + -p flag.
s/./+$&/g;$_=45-eval

Try it online!
Note that the input needs to be supplied without final newline (with echo -n for instance).

Some other (longer) approaches (all with -p flag):
$\=45;$\-=$_ for/./g}{

$_=9876543210=~s/[$_]//gr

for$@(0..9){$\=$@if!/$@/}}{

Batch, 83 76 52 bytes
@set/pn=
@cmd/cset/a(641670-0x%n:~,4%-0x%n:~4%)%%15

Takes input on STDIN. Uses @xnor's hex modulo 15 trick, except that a) Batch only has 32-bit integers, so I have to split the string into two b) Batch only does remainder, not modulo, so I have to subtrat the values from a large multiple of 15 first.

PHP, 43 Bytes
for(;strpos(_.$argv[1],48+$i++););echo$i-1;

PHP, 50 Bytes
<?=join(preg_grep("#[{$argv[1]}]#",range(0,9),1));

save 1 byte: for(;strpos(_.$argv[1],48+$i++););echo$i-1;

@Christoph I have the feeling that you forget the chr function

I have the feeling you should learn your tools ;) If needle is not a string, it is converted to an integer and applied as the ordinal value of a character see strpos on php.net.

@Christoph you are right

QBIC, 25 bytes
;{~instr(A,!a$)|a=a+1\_Xa

Explanation
;       Get the input as A$
{       Start an infinite DO loop
~instr  Test if A$ has an occurrence of a% cast to string
(A,!a$) a starts out as 0. !..$ casts to string.
|a=a+1  If we did find an instance, tets for the next a
\_Xa    Else, quit, printing our missing number.

C, 44 bytes
j;f(char*s){for(j=477;*s;)j-=*s++;return j;}

Try it online!

Keg, 14 8 bytes
?⅀ȍ$-

Try it online!
-6 bytes thanks to @A̲̲
Answer History
14 bytes
`0123456789`᠀-

Try it online!

You could have got this to 8 bytes; 8 bytes because this uses unicode characters.

W, 13 7 bytes
'0'9.St

Explanation
'0'9.   % Define the range of string 0 to 9
     S  % Swap so that instructions are in the right order
        % a[0], "0...9" -> "0...9", a[0]
      t % Trim out everything in 0...9 that appears in a[0]
        % The result is the remaining number

W, 8 bytes
CJ525S-C

Explanation
C         % Convert every character to its code point form
 J        % Sum the list
  525S-   % Minus 525 from the value
       C  % Convert to character form
          % Implicit output

TI BASIC, 23 bytes
45-sum(seq(expr(sub(Ans,I,1)),I,1,9

Turns the input string in Ans into a list containg the digits and then sums the list so that the number can be derived from subtracting the sum from 45. The byte count is affected by the 2 byte tokens expr(, sub(, and Str1. A full program could prompt for Str1 for 5 additional bytes.

BRASCA, 16 bytes
477SSm8[a+A{]x-n

Try it online!
Explanation
<implicit input>     - Push STDIN to stack
477SSm               - Push 477 (the sum of all digits' ASCII codes) to the bottom
      8[    ]        - Loop 9 times:
        a+A          -   Put loop counter in register, add the top two digits, then take it back out.
           {         -   Decrement the loop counter
             x-      - Remove the loop counter, then subtract the sum of all digits from 477
               n     - Output the result as a number

05AB1E, 4 bytes
žhsм

Try it online!
žhsм  # full program
   м  # remove all characters of...
  s   # implicit input...
   м  # from...
žh    # "0123456789"
      # implicit output

s can also be I or ¹ and h can be m with no change in functionality.

The APL answer wasn't #1... Dennis' jelly answer was

oof ok guess i didn't look far enough :/

Pxem, Filename: 28 bytes + Content: 0 bytes = 28 bytes.

Filename (Unprintables are escaped): \011.t.w0.i.-.+.m\001.-.c.t.a\055.-.n
Content: empty.

Try it online! (with pxem.posixism)
With comments
XX.z
# push 9; heap=pop
.a\011.tXX.z
# while empty || pop!=0; do
.a.wXX.z
  # push 48; push getchar
  .a0.iXX.z
  # push abs(pop-pop); if size>=2; then push pop+pop; fi
  .a.-.+XX.z
  # push heap; push 1; push abs(pop-pop)
  .a.m\001.-XX.z
  # dup; heap=pop
  .a.c.tXX.z
# done
.a.aXX.z
# push 48; push abs(pop-pop); printf "%d", pop
.a\055.-.n

CSASM v2.3, 129 bytes
func main:
lda 0
sta $1
in ""
conv ~arr:char
pop $a
push "0123456789"
.lbl a
push $a
ldelem $1
sub
inc $1
push $1
push 9
sub
brtrue a
print
ret
end

Commented and ungolfed:
func main:
    ; Initialize $1 to 0
    lda 0
    sta $1

    ; Get the input, convert it to an array of <char>s, then store it in $a
    in ""
    conv ~arr:char
    pop $a

    push "0123456789"
    .lbl loop
        ; Get the <char> in $a at index $1
        push $a
        ldelem $1

        ; Remove it from the <str> currently on the stack and push the updated <str>
        sub

        ; Increment $1 and stop looping if $1 == 9
        inc $1
        push $1
        push 9
        sub
        brtrue loop

    ; The string will now only contain the remaining digit.  Print it
    print
    ret
end

Mascarpone, 82 53 bytes
[9876543210]$v[v'$>,<]v*'#<^v'.>1#########^0123456789

Try It Online!
Explanation
[9876543210]$      // push the string '[9876543210' (we can ignore the '[')
v                  // push the current interpreter
 [      ]v*        // define an operation (under the current interpreter)
  v'$>,<           // "bind a symbol from stdin to 'Pop ToS'"
           '#<^    // bind this operation to '#' and install it to the environment
v'.>1              // push an interpreter that defaults to "Output ToS"
     #########     // bind 9 symbols from stdin to "Pop ToS"
              ^    // install this interpreter to the environment
0123456789         // one of these will output ToS, the rest will only pop
                   // the symbols to output are on the stack from line 1

Factor + math.unicode, 25 24 bytes
[ "0123456789"swap ∖ ]

Try it online!
Set difference (∖) with "0123456789".

x86‑64 assembly machine code, 17 B
input

address of string buffer in 64‑bit register rsi
string buffer consists of exactly 9 ASCII-encoded Western-Arabic digits

code listing
  1                      missing_integer:
  2 00000000 6A09           push 9          ; rsp ≔ rsp − 8  rsp↑ ≔ 9
  3 00000002 59             pop rcx         ; rcx ≔ rsp↑     rsp ≔ rsp + 8
  4 00000003 31C0           xor eax, eax    ; eax ≔ 0
  5 00000005 BADD010000     mov edx, 477    ; edx ≔ 477
  6                      .digit_sum:
  7 0000000A AC             lodsb           ;  al ≔ rsi↑     rsi ≔ rsi + 1
  8 0000000B 29C2           sub edx, eax    ; edx ≔ edx − eax
  9 0000000D E2FB           loop .digit_sum ; ecx ≔ ecx − 1   ZF ≔ ecx = 0
 10                                         ; if ¬ZF then goto digit_sum
 11 0000000F 92             xchg eax, edx   ; shorter than `mov eax, edx`
 12 00000010 C3             ret

output

the “missing” integer in ax

mov dl, 477%256

@l4m2 I don’t understand. The algorithm relies on the value 477, not 221.

You only need dl, or if you want to return whole eax, movzx eax, dl is only 2 bytes more, mov saves 3 bytes

@l4m2 I’m sorry, I don’t see it. Could you submit a full/complete answer/solution?

https://codegolf.stackexchange.com/a/256651/76323 Later found xor shorter

Was push 9/pop rcx/mov dl,221/lodsb/sub edx,eax/loop $-3/movzx eax,dl/ret

@l4m2 I now see what you’re doing. That’s neat.

jq -R, 15 bytes
explode|477-add

Try it online!

Nibbles, 2.5 bytes (5 nibbles)
`r-_$

`r-_$
`r      # get the first integer found in
        # the string of
  - $   # remove the command-line arg
   _    # from the string in STDIN
        # (but if there is no STDIN,
        # from all printable ASCII)

Input string is provided as a command-line argument.
If STDIN is empty, Nibbles assigns a default value of 'the list of printable ascii characters in a more useful order".
The first (and only) integer present in this list after the input string is removed should be the missing digit from the input string.

(Note that since Nibbles will check to see if there's anything in STDIN, in the screenshot above I've pressed 'ctrl-D' to terminate STDIN with no input)

x86‑64 assembly machine code, 13 B
f:      use64
6A09    push 9
59      pop rcx
6A01    push 1
5A      pop rdx
a:
AC      lodsb
30C2    xor dl, al
E2FB    loop a
92      xchg eax, edx
C3      ret

read string from [rsi] and return rax

Just to clarify: In contrast to my previous (longer) solution this function returns the ordinal value of the respective ASCII character. I understood You must return the missing integer. that necessarily an integer value was expected.

@KaiBurghardt Then change push 1 into push 49

GolfScript, 6 bytes
10,`^~

Try it online!
There's a shorter, 4-byte solution if input can be taken in the form of an array of integers:
10,^

Try it online!
Explanation
10,`^~

10,     # create an array of integers from 0-9
   `    # convert it into a string
    ^   # setwise difference
      ~ # dump array onto the stack

The 4-byter just removes the need for a string because it takes input as an array and the difference doesn't include any [ characters, removing the need for the ~

Java 7, 61 54 bytes
long d(int n){return(15-Long.valueOf(n+"",16)%15)%15;}

Based on @Neil's JavaScript (ES6) answer (just like JavaScript, Java uses remainder for negative-modulo. Original port is from @xnor's Python answer)
Old answer (61 bytes):
String c(int n){return"0123456789".replaceAll("["+n+"]","");}

Try it here.

REXX, 36 bytes
#=0123456789
arg n
say verify(#,n)-1

AHK, 39 bytes
i=[%1%]
Send % RegExReplace(99066**2,i)

Again, the inherent confusion between the input variable 1 and the actual number 1 causes confusion in AHK functions. At least it only cost 3 bytes this time.
99066**2 = 99066^2 = 9814072356 (a trick I copied from Rod's answer)

C#, 21 bytes
z=>45-z.Sum(v=>v-'0')

The expression v-'0' takes the char value such as '3' and subtracts the char value for '0', leaving the value 3, essentially converting the character 3 into the integer 3.
45 is the sum of all the numbers 0 through 9.  45 - the sum of the passed-in integers yields the missing integer.
Sample code
public static void Main()
{
    Func<string, int> X = z=>45-z.Sum(v=>v-'0');

    Console.WriteLine(X("123456789"));
    Console.WriteLine(X("134567890"));
    Console.WriteLine(X("867953120"));
}

Test Here:
https://dotnetfiddle.net/yanR5S

Chip, 64 bytes
Azv~a
##'Bzv~b
`^v##'Czv~c
*f|`^-##'Dzv~d
Z~'~e `^-##'
ZZZZZZZ~S

Try it online!
Chip is a 2D language that operates on individual bits in a byte stream. Each byte of input is broken down into its component bits for computation, then stitched back together for output.
This solution uses a rather simple algorithm, that is only a minor twist on that used by many of the other solutions:

Start with a value of 0x2:
 0+1+2+3+4+5+6+7+8+9 =  45 (0x2D)
                 ~45 = -46 (0xD2)    *
          -46 & 0x0F =   2  (0x2)

* I only do half of two's complement negation; I skip the increment at the end for a reason. I'll get back to this.
Add each code point in the string, masked with 0x0F, ignoring carries.
After the ninth addition, the current value will be equal to -1 minus the missing digit, masked with 0x0F:
Let's say we were missing the digit '4':
              -1 - 4 =  -5  (0xB)
               ~(-5) =   4  (0x4)    *

* Again, we only do half of negation. This instance cancels out the offset introduced by the previous negation.
Prefix the value with 0x3, giving the codepoint for the missing digit:
          0x30 | 0x4 =  52 (0x34)

What portions of the code do each bit? Well, they're a bit mixed together, but I'll try to cover the highlights:

The # elements do the addition described in step 2.
The z elements near the adders carry over the current value to the next cycle so that we can have a running sum.
The Z elements keep track of which digit of the input we are on, handling the condition in step 3. They also provide the signal used to initialize the adders to 0x2, as described in step 1.
The S element suppresses all output until the Z elements disable it on the final digit. (If you are looking at the TIO, try deleting this element to see all the intermediate values. Also, adding the flag -v will print the actual code points to stderr.)
The letters A through D are reading the 4 low bits of the input, and a through d write those same bits of the output.
The letters e and f provide the value 0x30 to the output as described in step 4.

D, 24 bytes
writeln(477-readln.sum);

Just add up all characters in the given string (not terminated by a newline).
The sum is s = 48 * 9 + (0 + 1 + 2 + ... + 9 - x) = 477 - x, therefore, x = 477 - s.
The calls make use of optional parentheses (-4 bytes), and .sum invocation uses uniform function call syntax (-1 more byte).
Try it online!

Q, 24 bytes
{1#iasc"0123456789"in x}

Gets a boolean vector between the expectation and input, then sorts the indices of the expectation by that boolean vector in ascending order, first value always being the missing element since boolean for it is set to 0 and we know that value=index in this case.

Noodel, 8 bytes
ɲdFḶṡạĖ⁻

Try it:)

How it works
ɲdFḶṡạĖ⁻
         # Input implicitly pushed onto the stack.
ɲd       # Pushes the string "0123456789" onto the stack.

  FḶṡạĖ⁻ # Loops nine times removing digits from the string "0123456789" producing the missing number.
  F      # Pushes the string "F" onto the stack.
   Ḷ     # Consumes the string "F" and converts to a base 98 number producing 9 then loops the following that many times.
    ṡ    # Swaps the string "0123456789" with the input on the stack.
     ạ   # Gets the ith element from the input and pushes it onto the top of the stack.
      Ė  # Grabs the string "0123456789" at the bottom of the stack and puts it at the top.
       ⁻ # Removes the element pulled out of the input from the string.
         # Implicit end of the loop.

         # Implicit push to the screen, outputting the missing digit.

Racket 106 bytes:
(filter-not(λ(x)(member x(string->list(number->string n))))
(for/list((i(range 48 58)))(integer->char i)))

Ungolfed:
(define (f n)
  (filter-not
   (λ(x)
     (member x
             (string->list
              (number->string n))))
   (for/list((i(range 48 58)))(integer->char i))))

Testing:
(f 867953120)

Output:
'(#\4)

Lambdabot Haskell, 14 bytes
(['0'..'9']\\)

After realizing I could just make a list with the String "0123456789" instead of the integers [0,1,2,3,4,5,6,7,8,9], the step for converting the string to integers could be skipped.
Type is now String -> String (takes a string and returns a string with the correct number). Call like:
(['0'..'9']\\)"149263708"         -- Outputs "5"

Previous:
([0..9]\\).map digitToInt

Uses set difference, unlike the other Haskell answer, type String -> Int
Call like
([0..9]\\).map digitToInt$"123467890"  -- Outputs 5

Ruby, 25 bytes
->x{'0123456789'.tr x,''}

Not terribly competitive, I'm afraid

Pip, 5 bytes
5 bytes seems to be the number for all golfing languages that aren't Jelly.
,tDCa

Takes input as a command-line argument. Try it online!
Explanation
,t     Range(10)
  DC   From each element, delete all characters...
    a  ...that are in 1st cmdline arg
       Concatenate and print (implicit)

The result is actually a list like ["";"";"";"";4;"";"";"";"";""] (which is what you get if you put RP at the front of the code). Lists by default are concatenated together before printing, so all you will see is 4.

C (clang), 31 bytes
f(x){return x?f(x/10)-x%10:45;}

Strictly speaking, f(x) returns the sum of the missing digits. This lets me knock off a digit, get the sum of the missing digits, then add it back on.
Try it online!

Octave, 20 19 14 bytes
@(a)477-a*~~a'

Try it online!
Developed independently but the same as some other answers.
a'          transpose of array `a`
~~a'        convert all elements of a' to 1
a*~~a'      matrix multiplication of `a` with a column vector of 1s
            that is equivalent to sum(a)
477-a*~~a'  subtract from [477=sum('0123456789')-48]

Pyt, 5 bytes
ɳą←ą\

Try it online!
Takes input as a string (with quotes)
ɳ          push "0123456789"
 ą         convert to array of characters
  ←ą       get input string; convert to array of characters
    \      set difference; implicit print

Pyt, 5 bytes
Ś9△-~

Try it online!
Takes input without quotes
Ś        implicit input; sum of digits
 9△      45 (9th triangle number)
   -     subtract
    ~    negate; implicit print

Thunno 2, 3 bytes
kDḍ

Attempt This Online!
Explanation
kDḍ  # Implicit input
  ḍ  # Symmetric set difference
kD   # with the string "0123456789"
     # Implicit output

Rust, 43 bytes
|s:&str|s.bytes().fold(477,|s,b|s-b as i32)

This is the same strategy as in Level River St's Ruby answer.
Attempt This Online!