text:
Mark My Mail! - ASCII Barcodes
4-state barcodes
Many postal services (Royal Mail UK, Canada Post, US Mail, etc) use a 4-state barcode to encode information about their mail. Rendered in ASCII, it may look something like this:

|   | |   | | | |   |     |   |
| | | | | | | | | | | | | | | | |
    | |   |   | | |   |     |

A 4-state barcode is a row of bars. Each bar can be extended upwards, downwards, or both, allowing 4 possibilities. This means that each bar essentially represents a base 4 digit:

            |       |
Bar:    |   |   |   |
                |   |

Digit:  0   1   2   3

The problem with this symbology is that it each barcode is a valid, different barcode upside down: drastically changing the meaning if the orientation is incorrect. Therefore, a start and stop sequence are normally implemented so the scanner can calculate which way it is supposed to be read.
For the purpose of this challenge, we will be using the start/stop sequence specified by Australia Post: each barcode begins and ends with a 1 0 sequence.

The Challenge
Your task is to write a program or function which, given a positive integer N, converts it to an ASCII 4-state barcode, where each bar (except for the start/stop sequences) represents a digit in the base-4 representation of N.
Example:
Given the integer 19623, we would first convert it to its base-4 representation, 10302213.
We would then map each digit to the corresponding bar:

1 0 3 0 2 2 1 3

|   |       | |
| | | | | | | |
    |   | |   |

Finally, we would add the start/stop sequences:

Start:              End:
1 0                 1 0

|   |   |       | | |
| | | | | | | | | | | |
        |   | |   |

The resulting barcode should be the program's output.

Rules:

The input will be a positive integer, within the range of your language's standard integer size.
The output:

May be either a list of lines, or a string containing newlines.
May contain leading or trailing newlines/spaces, as long as the shape remains intact.
Should show the barcode with the above format - it must use the pipe character (|) and space character () when drawing bars, and there should be 1 space in between each upright bar.

This is code-golf, so the shortest program (in bytes) wins!

Test Cases
4095:

|   | | | | | | |
| | | | | | | | | |
    | | | | | |

4096:

|   |             |
| | | | | | | | | | |

7313145:

|   |   | |   | |   | |   | |
| | | | | | | | | | | | | | | |
      | | | |     | | | |

Leading spaces allowed? ;)

@FlipTack The problem with this symbology - you haven't seen The Boondock Saints, have you?

@EriktheOutgolfer As long as the actual barcode, as a 2D matrix of characters, is intact, it can have as many spaces before or after it as necessary.

Other barcode related challenges: 1, 2, 3

Can the output have leading zeros?

@user230118 sorry, but the only leading/trailing characters should be spaces or newlines.

@FlipTack Are we allowed to output the barcode upside down? This comment seems to suggest that this would be acceptable.

@wizzwizz4 It should be the right way around, as in the test cases.

MATL, 34 30 29 28 bytes
TFiK_YAyhhH&\EQE+t~vB!P'|'*c

Try it online!
Explanation
TF      % Push array [1 0] (start sequence)
i       % Push input
K_YA    % Convert to base 4. Gives an array of 4-ary digits
y       % Duplicate from below: pushes [1 0] again (stop sequence)
hh      % Concatenate horizontally twice. Gives array of 4-ary digits
        % including start and stop sequences
H&\     % Two-output modulo 2: pushes array with remainders and array
        % with quotients of dividing by 2
EQE     % Times 2, plus 1, times 2, element-wise. This effectively
        % multiplies each entry by 4 and adds 2
+       % Add element-wise to the array of remainders. The stack now
        % contains an array of numbers 2, 3, 6 or 7. Each number
        % encodes, in binary form, a column of the output. The
        % previous multiplication of the quotients by 4 will have the
        % effect of shifting one row down (one binary digit upwards),
        % to make room for the central row. The addition of 2 will
        % create the central row, which is always full
t~      % Duplicate, logical negate. Gives an array of zeros of the
        % same length
v       % Concatenate vertically into a 2-row matrix
B       % Convert to binary. Gives a matrix, where each row is the
        % binary representation of one of the numbers of the input
        % matrix, read in column-major order
!P      % Transpose, flip vertically
'|'*    % Multiply by '|'. This transforms 1 into 124 (ASCII code of
        % '|') and leaves 0 as is
c       % Convert to char. Char 0 is shown as space. Implicitly display

Python 3, 103 99 96 bytes
def f(i,r=[]):
 while i:r=[' | |||||  ||'[i%4::4]]+r;i//=4
 k='|| ',' | ';[*map(print,*k,*r,*k)]

Try it online!

Jelly, 16 15 bytes
4;jƓb|ṃ⁾| ẎZṙ2G

Try it online!
How it works
4;jƓb|ṃ⁾| ẎZṙ2G  Main link. No arguments.

4                Set the argument and the return value to 4.
 ;               Concatenate the return value with the argument, yielding [4, 4].
   Ɠ             Read an integer n from STDIN.
  j              Join, yielding [4, n, 4].
    b            Convert 4, n, and 4 to base 4. Note that 4 is [1, 0] in base 4.
     |           Perform bitwise OR of each resulting quaternary digit and 4.
                 This pads the binary representation of a digit d to three digits:
                 [1, d:2, d%2]
      ṃ⁾|        Convert the results to base " |", i.e., binary where ' '
                 represents 0 and '|' represents 1.
          Ẏ      Concatenate the resulting arrays that correspond to 4, n, and 4.
           Z     Zip; transpose rows and columns.
            ṙ2   Rotate 2 units yo the left, correcting the order of [1, d:2, d%2]
                 to [d%2, 1, d:2].
              G  Grid; separate columns by spaces, rows by linefeeds.

This string is 15 unicode characters long, how can it be 15 bytes?

@jmster Jelly has its own codepage

@jmster These aren't the actual characters. The program is 15 specific bytes, which have these mnemonics. Compare it with Bubblegum, it  mostly looks like ....... but each dot stands for a different byte.

Why bitwise OR instead of adding?

@FrownyFrog Both would work. Since the next step is conversion to binary, I went with a bitwise operator.

JavaScript (ES6), 89 87 83 bytes
n=>`|  ${(g=(a,k=n)=>k?g(a,k>>2)+(k&a?'| ':'  '):' ')(1)}|
| |${g(~0)}| |
   `+g(2)

Test cases

let f =

n=>`|  ${(g=(a,k=n)=>k?g(a,k>>2)+(k&a?'| ':'  '):' ')(1)}|
| |${g(~0)}| |
   `+g(2)

console.log(f(4095))
console.log(f(4096))
console.log(f(7313145))

How?
NB: In the version below, template literals have been replaced with standard strings so that the code can be indented properly.
n =>                        // given the input n
  '|  ' +                   // append the top leading pattern
  (g = (a,                  // g is a recursive function taking a = mask
           k = n) =>        // and using k = value, initially set to n
    k ?                     //   if k is not zero:
      g(a, k >> 2) +        //     do a recursive call for the next group of 2 bits
      (k & a ? '| ' : '  ') //     append '| ' if the bit is set or '  ' otherwise
    :                       //   else:
      ' '                   //     append an extra leading space and stop the recursion
  )(1) +                    // invoke g() with mask = 0b01
  '|\n' +                   // append the top leading pattern and a linefeed
  '| |' +                   // append the middle leading pattern
  g(~0) +                   // invoke g() with all bits set in the mask
  '| |\n' +                 // append the middle trailing pattern and a linefeed
  '   ' +                   // append the bottom leading pattern
  g(2)                      // invoke g() with mask = 0b10

i'd love to see this answer explained, there's some weird stuff going on :P

@BrianH. I've added an explanation.

Jelly, 19 bytes
;4⁺;b4Fd2Uj€1Zị⁾| G

Try it online!
-1 thanks to Mr. Xcoder.

Octave, 78 77 75 74 70 69 bytes
@(x)' |'(dec2bin([2 6 3 7;~(1:4)](:,[2 1 dec2base(x,4)-47 2 1]))-47)'

Try it online!
Unlike the original approach, this one uses a simple lookup table to map the base-4 values onto their binary equivalent. The lookup table also adds the spacing between each bar by adding a zero in between each number (which maps to a bar of all spaces).
The lookup table directly maps to bars as:
   base4:  0 1 2 3 -

  lookup:  2 6 3 7 0

  binary:  0 1 0 1 0
           1 1 1 1 0
           0 0 1 1 0

Conversion from binary to | and   is now done by indexing into a string of those two characters - basically the same principle as the lookup table for binary conversion.

*Saved 1 byte, thanks @LuisMendo

Original:
@(x)['' circshift(dec2bin([a=[5 4 dec2base(x,4)-44 5 4];a*0](:))'*92,1)-4384]

Try it online!
Anonymous function which returns the barcode as a string.
This is based on the fact that if we add 4 to the base4 digits, then we can represent bar/space by the number converted to binary with bits 1 and 2 swapped:
   base4:  0 1 2 3

    add4:  4 5 6 7

  binary:  0 1 0 1
           0 0 1 1
           1 1 1 1

swap 2/1:  0 1 0 1
           1 1 1 1
           0 0 1 1

The tricky bit from a golfing perspective is adding the spaces between the bars and converting from 0/1 to '|'/' '.

R, 154 109 bytes
function(n,d=c(1,0,n%/%4^floor(log(n,4):0)%%4,1,0),o=c(" ","|"))cat("",o[1+d%%2],"
",o[2+0*d],"
",o[1+(d>1)])

Try it online!
Saved a whole bunch of bytes by indexing and using cat rather than constructing a matrix and using write, as well as 6 from a slightly different conversion to base 4. Prints with a leading space in each row and no trailing newlines.
The indexing takes place using some modular arithmetic, not unlike some other answers, but since R uses 1-based indexing, the arithmetic is somewhat different.
Explanation:
function(n,
 d=c(1,0,                         # d contains the padding and
   n%/%4^floor(log(n,4):0)%%4,   # the base 4 digits
   1,0),                         #
 o=c("|"," ")                    # the vector to index into
 cat("",                         # cat separates things with spaces by default
                                 # so the empty string will print a leading space
  o[1+d%%2],"                    # odds have a | above
",                               # literal newline, a space will follow it (hence leading spaces)
 o[2+0*d],"                      # array of 2s since the middle is always |
",                               # another literal newline
 o[1+(d>1)])                     # digits greater than 1 have a | below

Japt, 32 31 bytes
A¤i2Us4)¬®n s|iS)ù2 w i|1ÃqR² y

Test it online!
Not really satisfied with this yet, but it's a start...
Explanation
A¤  i2Us4)¬ ®   n s |iS)ù2 w i |1Ã qR²  y
As2 i2Us4)q mZ{Zn s'|iS)ù2 w i'|1} qRp2 y
                                           Implicit: U = input, A = 10, R = newline, S = space
As2                                        Convert 10 to a binary string.
    i2   )                                 At index 2, insert
      Us4                                    the input converted to base 4.
          q                                Split into chars.
            mZ{                  }         Map each char Z to
               Zn                            Z converted to a number,
                  s'|iS)                     converted to base " |" (binary using ' ' as 0 and '|' as 1),
                        ù2                   left-padded to length 2 with spaces,
                           w                 reversed,
                             i'|1            with another pipe inserted at index 1.
                                   q       Join the resulting list on
                                    Rp2      a newline repeated twice (adds in blank columns).
                                        y  Transpose the entire string.
                                           Implicit: output result of last expression

Your 32 bytes makes me feel a little better about this complete mess! I really shouldn't try to golf while both serving and drinking pints!

J, 57 49 47 bytes
10 bytes thanks to FrownyFrog!
[:,.2{."0[:|:' |'{~#:@2 6 3 7{~1 0,4&#.inv,1,0:

How it works:
1 0,4&#.inv,1,0: - converts the number to a list of base-4 digits, adds 1 0 to the beginning and the end of the list
((#:2 6 3 7){' |') - lookup table for the encryption, binary 0 corresponds to space, 1 to '|'
{~ - encrypts the base 4 digit by selecting a string from the lookup table above (argument reversed)
|: - transposes the resulting array from 3 columns to 3 rows
[: - caps the fork
,.2{."0 - puts spaces between the bars
Try it online!

Haskell, 91 90 bytes
h s=[do a<-4%s++0%0;x!!a:" "|x<-[" | |","||||","  ||"]]
_%0=[1,0]
b%n=b%div n b++[mod n b]

Try it online! Returns a list of lines.

Same byte count alternative for first line:
h s=[do a<-4%s++0%0;" | |  ||||"!!(x+a):" "|x<-[0,6,4]]

Charcoal, 50 bytes
ＮθＦ²⊞υι¿θＷθ«⊞υ﹪θ⁴≧÷⁴θ»⊞υθＦ²⊞υιＥ⟦ |¦|¦  ||⟧⪫Ｅ⮌υ§ιλω

Try it online! Link is to verbose version of code. Explanation:
Ｎθ

Input a number.
Ｆ²⊞υι

Push the stop sequence to the predefined empty list.
¿θ

If the number is positive,
  Ｗθ«⊞υ﹪θ⁴≧÷⁴θ»

repeatedly apply divmod to convert it to reversed base 4,
  ⊞υθ

otherwise just push it.
Ｆ²⊞υι

Push the start sequence to the list.
Ｅ⟦ |¦|¦  ||⟧

Map over three strings. Each string represents barcode translation for the digits 0123 for each row.
⪫Ｅ⮌υ§ιλω

Map over the digits (reversed back into usual order), convert them to bars or spaces using the translation, then join the results into three strings which are then implicitly printed on separate lines.

Python 2, 116 114 bytes
-2 bytes thanks to notjagan

c=a=0,1
n=input()
while n:c+=n%4,;n/=4
for l in zip(*[' |'[n%2]+'|'+' |'[n/2]for n in c+a][::-1]):print' '.join(l)

Try it online!

114 bytes.

APL+WIN, 63 bytes
(⍉5 3⍴' | ||  |||||   ')[;,⍉(2 1,(1+((⌈4⍟n)⍴4)⊤n←⎕),2 1),[.1]5]

Explanation:
(⍉5 3⍴' | ||  |||||   ') create a matrix where columns represent bars plus one for separator spaces

(1+((⌈4⍟n)⍴4)⊤n←⎕) prompt for screen input and convert to base 4 and add 1 to convert to index origin 1

2 1,...,2 1 concatenate start stop

,[.1]5 concatenate separator space indices

(.....)[.....] index into bar matrix to display

J, 42 40 39 bytes
' |'{~[:#:4#.2|.0|:4#:@+1 0(,,[)4#.inv]

Shaved 2 bytes thanks to Dennis. 1 byte thanks to ngn.
Try it online!
How it works
                                4#.inv]      to base 4
                        1 0(,,[)             append (1 0) on both sides
                   4#:@+                     add 4 to each digit and convert to binary
                0|:                          transpose
             2|.                             rotate the rows
      [:#:4#.             from base 4 to base 2, it's supposed to separate the columns
' |'{~                                       to characters

05AB1E, 19 bytes
4BT.øS4~bT„| ‡øÁ€S»

Try it online!
This is a half-port of Dennis' approach, which is just one byte shorter than the method I used before (which I am quite happy with):
05AB1E, 20 bytes
4BT.øS2‰í1ýøT„| ‡€S»

Try it online!
How it works?

4BT.øS2‰í1ýøT„| ‡€S»  | Full program. Takes input from STDIN, outputs to STDOUT.

4B                    | Convert to base 4.
  T                   | Push a 10 to the stack.
   .ø                 | Surrond (prepend and append the 10 to the base 4 representation).
     S                | Split into individual characters/digits.
                      +---------------------------------------------------------------
                      | This part used to be ¸4.ø4в˜ in the previous version, which
                      | means: surround with 4's, convert each to base 4 (4 -> [1, 0])
                      | and finally deep-flatten the list.
                      +---------------------------------------------------------------
      2‰              | Divmod 2 ([N // 2, N % 2]).
        í             | Reverse (element-wise).
         1ý           | Add a 1 in the middle (element-wise).
           ø          | Transpose.
            T„| ‡     | Translate (‡) from "10" (T) to "| " („| ).
                 €S»  | Format as a grid.
                 €S   | Push the characters of each.
                   »  | Join by newlines, while joining inner lists by spaces.

I have asked Adnan (the creator of 05AB1E) about the grid thingy in chat, and they helped me save 2 bytes, by pointing out a feature of 05AB1E: when joining multi-dimenisional lists by newlines, the inner lists are joined using spaces too, so ðý is unnecessary.

APL (Dyalog Classic), 33 bytes
' |'[≠\2/2⊖1⍪2 2⊤1 0(,,⊣)4⊥⍣¯1⊢⎕]

Try it online!

Oh, that’s how you’re supposed to surround with 1 0...

So 2⊥⍣¯1 is how you’d get a binary list?

@FrownyFrog There's no one true way to surround. Yes, 2⊥⍣¯1 is the inverse ("obverse"?) of "two-decode". It encodes into binary with as many bits as necessary.

JavaScript (ES6) 79 bytes
Uses .toString to convert the number to base 4, and then casework with each line and bitwise OR to build the output line by line. Outputs a list of lines.
n=>[2,3,1].map(d=>[...'10'+n.toString(4)+'10'].map(q=>(q|d)>2?"|":" ").join` `)

f = n=>[2,3,1].map(d=>[...'10'+n.toString(4)+'10'].map(q=>(q|d)>2?"|":" ").join` `)

console.log(f(19623))
console.log(f(4095))
console.log(f(4096))
console.log(f(7313145))

Cool approach with map and bitwise OR! You can save a whole byte by using \10${n.toString(4)}10`` :)

Bash+coreutils, 71 67 bytes
dc -e4ddon?np|sed 's/./& /g;h;y/01/23/;G;y/12/21/;H;x;y/0123/ | |/'

Try it online!
Explanation
The dc bit converts to base 4, prepending and appending with a 4 (turns into 10 in the output) and using n to keep everything on one line.
The rest happens in sed:
s/./& /g;     Add a space after each digit
h;            Make a copy in hold space
y/01/23/;     Prepare up the second row (2/3 will turn to pipes)
G;y/12/21/;   Append what will be the third row and prep it (1/3 will turn to pipes)
H;x;          Prepend hold space
y/0123/ | |/  Make 1 and 3 pipes, 0 and 2 spaces

Converting the part after dc entirely to sed saves a few bytes, https://tio.run/##S0oszvj/PyVZQTfVJCUlP88@r6CmODVFQb1YX09fTUE/3TrDulLfwNDIWF@hRqFG39rdulg/ply/BijjDpdRqKnRV///39DSzMgYAA

Very nice! I tried something like that but I kept trying different ways of being clever with xing the hold/pattern spaces around to modify them and then do the s all at once, and nothing ended up shorter.

@Cowsquack I even managed to get another two bytes down based on your idea!

Nice idea of combining the transliterations, +1

Retina, 83 bytes
.+
$*
+`(1+)\1{3}
${1};
^
1;;
$
;1;;
1*;
$.&
.+
$&¶$&¶$&
T`13` `^.+
T`12` `.+$
\d
|

Try it online! Link includes the faster test cases. Explanation:
.+
$*

Convert to unary.
+`(1+)\1{3}
${1};

Convert to base 4 as unary numbers separated by ;s.
^
1;;

Prepend the start sequence.
$
;1;;

Append a ;, turning it into a digit terminator rather than a separator, and the stop sequence.
1*;
$.&

Convert to decimal, but adding 1 to each digit.
.+
$&¶$&¶$&

Triplicate it.
T`13` `^.+

On the first row, 1s and 3s (representing 0s and 2s) become spaces.
T`12` `.+$

On the last row, 1s and 2s (representing 0s and 1s) become spaces.
\d
|

All other digits become bars.

Pip, 33 31 29 27 26 bytes
25 bytes of code, +1 for -S flag.
Y^aTB4WRt" |"@[y%2oMyy/2]

Try it online!
Explanation
We observe a pattern in the four bar types:

The first row is a space if the digit is even, pipe if odd.
The second row is always a pipe.
The third row is a space if the digit is 0 or 1, pipe if 2 or 3.

So:
                           a is cmdline arg; o is 1; t is 10 (implicit)
  aTB4                     Convert a to base 4
      WRt                  Wrap it before and after with 10
 ^                         Split into a list of digits
Y                          and yank into y
              [         ]  List of:
               y%2          0 if even, 1 if odd for each item in y
                  oMy       1 mapped to y, i.e. constant 1 for each item in y
                     y/2    Each item in y divided by 2 (0, 0.5, 1, or 1.5)
         " |"@             Use the elements of that list as indices into this string
                           Note that indices are truncated to integers!
                           Autoprint, separating rows with newline and elements of
                           each row with space (-S flag)

SOGL V0.12, 28 bytes
4─10¹:h++{»1F2%¹{Ƨ| W}¹∑ā}⁰H

Try it Here!

PHP, 99+1 bytes
for($n=10 .base_convert($argn,10,4). 104;(~$c=$n[$i++])||3>$y+=$i=1;)echo" | ||  |||||

"[$c*3+$y];

requires PHP >= 5.5 for literal string indexing and < 7.1 for the indexing to not yield a warning.
Run as pipe with -nR or try it online.
Insert one more newline to get a trailing one.

Warning:  A non-numeric value encountered in [...][...] on line 7

@Soaku PHP version must be from 5.5 to 7.0

C (gcc), 176 bytes
#include<stdio.h>
int n,m;f(n,r){if(n)f(n>>2);printf("%c%c",n?32:10,(n&r||!r)&&n?'|':32);}main(){scanf("%d",&n);m=(n+(4<<(32-__builtin_clz(n)/2*2)))*16+4;f(m,1);f(m,0);f(m,2);}

Try it online!
Slightly less terribly formatted (less golfed):
#include<stdio.h>
int n,m;
f(n,r) {
    if(n)
        f(n>>2);
    printf("%c%c",n?32:10,(n&r||!r)&&n?'|':32);
}

main() {
    scanf("%d",&n);
    m=(n+(4<<2*(16-__builtin_clz(n)/2)))*16+4;
    f(m,1);
    f(m,0);
    f(m,2);
}

Explanation
First, consider the following code to read an integer and output the base 4 version:
#include <stdio.h>
int n;
f(n) {if(n)printf("%d\n",n&3,f(n>>2));}
main(){scanf("%d",&n);f(n);}

This uses tail recursion to reverse the order of the output.  Each recursive step bitshifts by 2 (lops off the last 2 bits and divides by 4).  It outputs the result bitmasked with 3 (0b11), which only shows the last two bits, which is the last digit base 4.
The function call is included in the printf as a trailing argument (it isn't printed, but it is evaluated) to avoid needing to use {} (+2 bytes) to group the printf and the function call.
The solution here extends this base-4 code.  First, m is defined as n, but such that in base 4 it will have 10 prepended and appended to it.  We then print m.
In printing base 4 regularly, we used a bitmask of 3 to get the digit.  In the mail code, the top line is that digit's low-order bit (a bitmask of 1) and the bottom line is the high order bit (a bitmask of 2).  Accordingly, the r in f(n,r) is the bitmask - our main function calls f(m,1) for the first line and f(m,2) for the last line.
To make the middle line work (always print "|"), we add ||!r to the conditional - if r is 0, it will always evaluate to true and print a "|".  Then we call f(m,0) for the middle line.
Finally, we want newlines to behave.  Including an extra printf is expensive as far as bytes of source code goes, so instead we add another %c specifier to the existing printf.  n?32:10 prints a newline if n is 0 (false), and a space otherwise.  32 and 10 are used instead of '\n' and ' ' to save bytes.

You can get it down to 146 if you don't mind warnings: f(n,r){n&&f(n>>2);printf("%c%c",n?32:10,(n&r|!r)&&n?'|':32);}main(n){scanf("%d",&n);f(n=(n+(4<<(32-__builtin_clz(n)/2*2)))*16+4,1);f(n,0);f(n,2);}

Common Lisp, 191 bytes
(lambda(n &aux(k`(1 0,@((lambda(n &aux r f)(do()((= n 0)f)(setf(values n r)(floor n 4))(push r f)))n)1 0)))(format t"~3{~{~:[  ~;| ~]~}~%~}"`(,(mapcar'oddp k),k,(mapcar(lambda(c)(> c 1))k))))

Try it online!

Python 2, 142 126 bytes
B=lambda n:n<4and`n`or B(n/4)+`n%4`
def F(i):
 for r in 0,1,2:print' '.join(" |"[(int(x)%2,1,x>'1')[r]]for x in'10'+B(i)+'10')

Big thanks to ovs!
I tried to not copy the other answers' methods and... yuck.

128 bytes

C# (.NET Core), 160 bytes
i=>{string s=$"10{B(i)}10",a="";for(int y=0;y<3;y++,a+="\n")foreach(var t in s)a+=t<51&y!=1&t-(y>>1)!=49?"  ":"| ";return a;string B(int n)=>n>0?B(n/4)+n%4:"";}

Try it online!
I'm sure I've missed some improvements.
DeGolfed
i=>{
    string s = $"10{B(i)}10", // prepend and append 10 to the base 4 number
           a="";

    for (int y=0; y<3; y++, a+="\n") // go through each row
        foreach (var t in s)         // go through each char digit
            a += t<51 & y != 1 & t-(y>>1) != 49 ? "  " : "| "; // check if bar or space occurs

    return a;

    string B(int n) => n>0? B(n/4) + n%4 : ""; // convert int to base 4
}

t<51 & y != 1 & t-(y>>1) != 49 checks that the char isn't '3', not the second row, and then some binary magic to see if the first or third row should contain the space.

Suggest y/2 instead of (y>>1)

Japt, 42 bytes
s4 +A iA)d1"|| "0" | "2" ||"3'|³ ò3 miR ·y

Try it online!

there should be 1 space in between each upright bar

Pyth, 32 bytes
jjL;CmXX1jk_d1`T"| ".DR2sj[4Q4)4

Try it here!

C, 120 bytes
Sadly only works on Windows, since itoa is too much of a convenience to be standard.
char*p,s[21]="10";g(a){for(p=s;*p;)printf(!a|*p++&a?" |":"  ");puts(p);}f(n){strcat(itoa(n,s+2,4),"10");g(1);g(0);g(2);}

Python 2, 135 133 131 bytes
i=input();r=[1,0];c="  ","| ";a=b=""
while i:r=[i%4]+r;i=i/4
for x in[1,0]+r:a+=c[x%2];b+=c[x>1]
print a+"\n"+c[1]*len(r)+"| |\n"+b

Try it online!
Alternative Python approach.

Perl 5, 102 + 1 (-n) = 103 bytes
do{unshift@a,($t=$_%4)%2?'|':$";unshift@b,$t>1?'|':$"}while$_>>=2;say"|   @a |
"."| "x(@a+4)."
    @b"

Try it online!

APL (Dyalog), 50 bytes
{↑,/(' |',¨' ')[⍉↑¯1⌽¨(3⍴2)∘⊤¨4+1 0,1 0,⍨4⊥⍣¯1⊢⍵]}

Try it online!

Vyxal, 40 bytes
4τk…t:„JpfDƛ∷`| `$i;Ṅ,ƛ\|;Ṅ,ƛ½⌊` |`$i;Ṅ,

Try it Online!

Japt -R, 27 bytes
3 and a half years later and I'm still not happy with this!
[4U4]cì4 Ës|ù2)ù2 Ô¬q|ÃÕË¬¸

Try it
[4U4]cì4 Ës|ù2)ù2 Ô¬q|ÃÕË¬¸     :Implicit input of integer U                   > 4095
[4U4]                           :Build the array [4,U,4]                       > [4,4095,4]
     c                          :Flat map                                      >
      ì4                        :  Convert to base 4 digit array               > [1,0,3,3,3,3,3,3,1,0]
         Ë                      :Map                                           >
          s                     :  Convert to string in custom base            >
           |ù2                  :    "|" left-padded with spaces to length 2   >
              )                 :  End base conversion                         > ["|","","||","||","||","||","||","||","|",""]
               ù2               :  Left pad with spaces to length 2            > [" |","  ","||","||","||","||","||","||"," |","  "]
                  Ô             :  Reverse                                     > ["| ","  ","||","||","||","||","||","||","| ","  "]
                   ¬            :  Split                                       > [["|"," "],[" "," "],["|","|"],["|","|"],["|","|"],["|","|"],["|","|"],["|","|"],["|"," "],[" "," "]]
                    q|          :  Join with "|"                               > ["|| "," | ","|||","|||","|||","|||","|||","|||","|| "," | "]
                      Ã         :End map                                       >
                       Õ        :Transpose                                     > ["| ||||||| ","||||||||||","  ||||||  "]
                        Ë       :Map                                           >
                         ¬      :  Split                                       > [["|"," ","|","|","|","|","|","|","|"," "],["|","|","|","|","|","|","|","|","|","|"],[" "," ","|","|","|","|","|","|"," "," "]]
                          ¸     :  Join with spaces                            > ["|   | | | | | | |  ","| | | | | | | | | |","    | | | | | |    "]
                                :Implicit output joined with newlines          > "|   | | | | | | |
                                                                                | | | | | | | | | |
                                                                                | | | | | |    "


text:
There's no such thing as a "half empty glass"
You probably know the rhetorical question of whether a glass is half full or half empty. I'm getting a little tired of the phrase, so I decided that it's time to eliminate this confusion about glass fullness or emptiness programmatically.
Your task is to write a program that takes an ASCII art representation of an ugly glass and outputs an ASCII art of a corresponding nice glass. It also has to decide whether the glass is full, mostly full, mostly empty or empty and output this as well (any 4 constant, distinct output values do).
TL;DR
Input is an ASCII art of a glass (# characters) and liquid (a-z) distributed randomly inside and outside of the glass. Liquid within the glass falls down and accumulates at its bottom, liquid outside of it gets discarded. Output an ASCII art of the glass after the liquid has settled at the bottom. Determine how full the glass is and output that as well.
Ugly and nice glasses
A glass in general is a container made out of # characters with a bottom, two side walls and no top.

Valid glasses do not have holes in them. (All of the # characters have to be connected.)
There will either be at least two # characters in each line of the input ASCII art, or none. There won't be a line with exactly one #.
The top line of the input ASCII art will always have exactly two #.
Valid glasses have exactly one local minimum in their delimiting wall of # characters. This means that liquid can't get trapped somewhere.
The delimiting wall of a glass will not have local maxima.
There won't be any # below the bottom of the glass.
The interior of the glass will always be a connected space.
There may be leading/trailing whitespace and newlines in the input.

Examples of valid and invalid glasses:
VALID (possible input to your program):

#  #
#  #
####

  #        #
   #      #
    #    #
    #    #
    #    #
     #  #
      ##

#      #
#      #
 ###   #
    #  #
    ####

#       #
 #      #
  #     #
 #      #
#       #
 ########

#   #
#   #
#   ###
#   ###
#   ###
#####

INVALID (you won't get one of those as input to your program):

#  #
   #  Has a hole.
####

#      #
   #  #  This is also considered a hole.
    ##

#   #
 # #  Less than two # on a line.
  #

## #
 # #  More than two # on the first line.
 ###

   #
 # #  Less than two # on the first line.
 ###

#               #
 #     #       #  More than one local minimum.
  #   # #     #   Liquid might get trapped.
   ###   #   #
          ###

#  #
#  #
####  Interior is not a connected space.
#  #
#  #
####

#   #
#   #######
#   ###   #
#   ##   #  Has a local maximum.
#   #   #
#      #
#     #
######

#    #
#    #
#     #
 #####
 #  #    <--- # below the bottom of the glass.

#     #
#  #  #  This is also a glass with a hole. The #'s aren't all connected.
#  #  #
#     #
#######

An ugly glass is a glass with liquid just floating around in its interior.

Liquid is represented by the lowercase letters a-z.
There will be no liquid above the first line of # characters. This means that it's not required to allow for liquid to fall into the glass.
There may be liquid outside of the glass. This liquid will get discarded when converting the ugly glass into a nice glass.

Examples of ugly glasses:
        # y    b #      i
   x   v#p  q   l#   l
  a     # a   zj # p   g
     g  #ppcg   c#
   u    #  r   n #   r
        ##########
Discard    Keep    Discard

                   <-- There will never be liquid above the glass
   #  tz  g#
    #y abc # d
 av z#ox s #  l
   c#y abth# b
   #vg y rm#   a
    ########
 e   a  b c  d     <-- Discard this as well (not within interior)

A nice glass is a glass where all liquid has accumulated at the bottom.

From the bottom up, the interior of a nice glass consists of a number of lines that are completely filled with letters, followed by at most one line that's not completely filled with letters, and then a number of lines that are empty.
There may not be any liquid outside of the interior of a nice glass.

Conversion of an ugly glass into a nice glass

The liquid inside the glass falls down and accumulates at the bottom.
Liquid outside of the glass gets discarded.
When converting an ugly glass into a nice glass, the exact letters in it have to be preserved. For example, if the ugly glass has three a's in it, the nice glass has to have three a's as well. (Soda doesn't suddenly turn into water.)
The letters within the nice glass do not have to be ordered.
The shape of the glass has to be preserved. No # characters may be added or removed.
Any amount of leading/trailing whitespace and newlines is allowed.

Determining glass fullness

A glass is full if its entire interior space is filled with letters.
It is mostly full if 50% or more of the interior space is filled.
It's mostly empty if less than 50% of the interior space is filled.
It's empty if there are no letters in the glass.
There may be any number of additional newlines and spaces between the ASCII art glass and the fullness output.
The program may output any distinct (but constant!) values for the 4 levels of glass fullness, it doesn't have to print the exact strings above. Please specify which value represents which fullness level.

I/O examples
Example 1 input:

        # y    b #      i
   x   v#p  q   l#   l
  a     # a   zj # p   g
     g  #ppcg   c#
   u    #  r   n #   r
        ##########

Example 1 output:

        #        #
        #        #
        #        #
        #ppcglqb #
        #yprazjnc#
        ##########
mostly empty

Example 2 input:

   #  tz  g#
    #y abc # d
 av z#ox s #  l
   c#y abth# b
   #vg y rm#   a
    ########
 e   a  b c  d

Example 2 output:

   #       #
    #   bc #
     #oxysa#
    #ygabth#
   #vgtyzrm#
    ########
mostly full

Example 3 input:

#      #
#  g   # f
 ###ih #  d
a c #  # e
 b  ####

Example 3 output:

#      #
#      #
 ###  g#
    #hi#
    ####
mostly empty

Example 4 input:

#ab#
#cd#
####

Example 4 output:

#cb#
#da#
####
full

Example 5 input:

  #        # h
   #      #
  a #    # g
   b#    #  f
 c  #    #
     #  #  e
   d  ##

Example 5 output:

  #        #
   #      #
    #    #
    #    #
    #    #
     #  #
      ##
empty

Example 6 input:

# b  az#
#y s ###
###### t
  l  u

Example 6 output:

#  z   #
#ybsa###
######
mostly full

Example 7 input:

#   # g
# b #f
#  c###
#da ### i
#  e###
##### h

Example 7 output:

#   #
#   #
#   ###
#de ###
#abc###
#####
mostly empty

Misc

This is code golf so the shortest answer wins.
If possible, please provide a link to an online interpreter that can be used to run your program on the provided example inputs, for example tio.run

Are these valid cups? http://paste.ubuntu.com/26097168/

May i suggest: "A glass is mostly full if more than 50% of the interior space is filled." - If you then consider exactly 50% as invalid input (without requiring the solutions to handle this case) theres really no such thing as a "half empty glass" (or a "half full glass") any more, matching the title even better. Without invalidating any solutions that actually handle this case.

@l4m2 Updated the challenge and restricted the input even further. First one of your examples is invalid, second one is valid, third one invalid.

@Anedar While it might make the challenge match the title better, this would take away too much from the challenge in my opinion and it already has enough invalid inputs anyway. I'll leave the 50% case in there.

Retina, 56 bytes
T%` l`!`^.*?#|[^#]+$
O` |\w
*`!

T`#!¶
*M` \w
+` \w

 +

Try it online!
The output encoding is 0\n0 for full, 0\n1 for empty, 1\n0 for mostly full and 1\n1 for mostly empty (in other words, the first bit indicates "mostly" and the second bit indicates "empty").
Explanation
T%` l`!`^.*?#|[^#]+$

We start by turning all spaces and letters outside the glass into !. This is done by matching either a line-beginning up to the first # or by matching a line-ending that doesn't contain a # and transliterating all spaces and letters in those matches.
O` |\w

Sort all spaces and letters. Since letters have higher code points than spaces, this sorts all the letters to the end, which means to the bottom of the glass. This also happens to sort the letters among themselves, but the order of the letters in the result is irrelevant.
*`!

Dry run: print the result of replacing all ! with spaces, but don't actually apply this change to the working string. This prints the nice glass.
T`#!¶

Discard all #, ! and linefeeds, so that we're only left with the spaces and letters inside the glass (still sorted).
*M` \w

Dry run: print the number of matches of a space followed by a letter. This will find at most one match, and that only if the there were both spaces and letters inside the glass, i.e. the glass is mostly (full/empty).
+` \w

Repeatedly remove a space followed by a letter. This "cancels" letters and spaces, so that we end up with only that type of character which appears more often inside the glass.
 +

Count the number of matches of this regex, which gives 1 if there are any spaces left (i.e. the glass was [mostly] empty) and 0 if there are non left (i.e. the glass was at exactly 50% or more and therefore [mostly] full).

C, 190 bytes
Thanks to @l4m2 for saving 17 bytes!
i,k,t,s;f(char*g){char*p=g,l[strlen(g)];for(s=t=0;*p;*p>35&&(t?l[i++]=*p:1)?*p=32:0,~*p++&t&&++s)t^=*p==35;for(k=i;i;t&*p==32?*p=l[--i]:0)t^=*--p==35;printf("%s\n%d",g,k?k-s?k*2<s?1:2:3:0);}

Outputs 0 for empty glass, 1 for mostly empty, 2 for mostly full, and 3 for full.
First loops through the input string counting the space inside the glass, marking down letters that are inside the glass, and changing all letters to spaces. Then loops through the string backwards placing all the letters that were in the glass at the bottom of the glass.
Try it online!
Unrolled:
i,k,t,s;
f(char*g)
{
    char l[strlen(g)], *p=g;
    for (s=t=0; *p; *p>35&&(t?l[i++]=*p:1)?*p=32:0, ~*p++&t&&++s)
        t ^= *p==35;
    for (k=i; i; t&*p==32?*p=l[--i]:0)
        t ^= *--p==35;
    printf("%s\n%d", g, k?k-s?k*2<s?1:2:3:0);
}

global variables are initally 0, so no need to reinit

@l4m2 Thanks, but functions need to be reusable, so I need to initialize the variables inside the function. Except i it seems, as the function always leaves its value at 0 in the end.

·char*malloc(strlen(g))· can be char l[strlen(g)] if C99 allowed, as it's shorter and don't make memory leak

t = *p-35 ? t : !t -> t ^= *p==35 if t is always 0 or 1

&&(*p=32) -> ?*p=32:0 char l[strlen(g)],*p=g -> char*p=g,l[strlen(g)]

Python 2, 342 bytes
import re
def f(g):
 g=[l for l in g if'#'in l];s,w,l,W=zip(*[re.findall(r'([^#]*)(#+)'*2,l)[0] for l in g[:-1]]);a=sorted(''.join(l));R=len(a);r=a.count(' ');L=[]
 for x in l:L+=[''.join(a[:len(x)])];a=a[len(x):]
 for l in zip([' '*len(x)for x in s],w,L,W)+[re.sub('[^#]',' ',g[-1]),'mostly '*(0<r<R)+['full','empty'][r>R/2]]:print''.join(l)

Try it online!

Perl 5, 197 bytes
map{/#([^#]+)#/;$l.=$1;y/#/ /c}@a=grep/#/,<>;$f=length$l;$_=$l=~y/ //d/$f;$a[--$i]=~s/#( +)#/'#'.(substr$l,0,($q=length$1),"").$"x($q-$p).'#'/e while$p=length$l;say for@a;say'm'x($_!=int),$_>.5?e:f

Try it online!
Outputs:
 e  empty
me  mostly empty
mf  mostly full
 f  full

source: Stack Exchange

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

sort: votes


text:
Calculate the lowest number where the sum of the sequence of numbers exceeds a given value
Given you have an infinite sequence of numbers defined as follows:
1: 1 = 1
2: 1 + 2 = 3
3: 1 + 3 = 4
4: 1 + 2 + 4 = 7
5: 1 + 5 = 6
6: 1 + 2 + 3 + 6 = 12
7: 1 + 7 = 8
...

The sequence is the sum of the divisors of n, including 1 and n.
Given a positive integer x as input, calculate the lowest number n which will produce a result greater than x.
Test cases
f(100) = 48, ∑ = 124
f(25000) = 7200, ∑ = 25389
f(5000000) = 1164240, ∑ = 5088960

Expected Output
Your program should return both n and the sum of its divisors, like so:
$ ./challenge 100
48,124

Rules
This is code-golf so the shortest code in bytes, in each language wins.

Is that sequence just the sum of ns divisors? You'll probably want to state that explicitly.

Also, judging by your "expected output" you want both n and f(n), but you don't say so anywhere in the specification.

@MartinEnder Thanks, hopefully its clearer now.

IS f(1,000) supposed to mean f(1000)? Is so, please remove the commas as it makes it harder to understand

Bonuses are bad, especially when they are vague. I decided to remove it, in  order to protect this from being downvoted.

Could you recheck f(1000) = 48? The divisor sum of 48 is 124

Oops, everything is multiplied by 10 (my bad), will edit now

Could you update to mention the expected output earlier in the spec. As it's not mentioned until after the test cases, some, like me, may miss it and just output n.

Would it be acceptable to include the original value of x with our output?

Can the outputs be in reverse order, i.e. 124,48?

Can you check f(500000)? I believe the 126000th number in the sequence is 502944.

Same as @duckmayr, I get  f(500000) = 126000, 502944.

Ah it should be f(5,000,000), not f(500,000). It's missing a 0. @duckmayr

It's good to wait at least a week before accepting an answer, otherwise you might discourage new solutions.

Brachylog, 9 bytes
∧;S?hf+S>

This program takes input from the "output variable" ., and outputs to the "input variable" ?.
Try it online!
Explanation
∧;S?hf+S>
∧;S        There is a pair [N,S]
   ?       which equals the output
    h      such that its first element's
     f     factors'
      +    sum
       S   equals S,
        >  and is greater than the input.

The implicit variable N is enumerated in increasing order, so its lowest legal value is used for the output.

Jelly, 18 12 11 10 bytes
1Æs>¥#ḢṄÆs

Try it online!
-1 byte thanks to Mr. Xcoder!
How it works
1Æs>¥#ḢṄÆs - Main link. Argument: n (integer)
1   ¥#     - Find the first n integers where...
 Æs        -   the divisor sum
   >       -   is greater than the input
       Ṅ   - Print...
      Ḣ    -   the first element
        Æs - then print the divisor sum

Could you explain why the 1 is necessary and how the ¥ acts?

@dylnan The 1 tells # to start counting from 1 and the ¥ takes the previous two links (Æs and >) and applies them as a dyad (i.e. with two arguments), with the left argument being the iteration, and the right argument being the input.

Oh, that makes sense now. # had been a bit confusing to me before in some cases.

Japt, 15 bytes
[@<(V=Xâ x}a V]

Try it

Explanation
Implicit input of integer U. [] is our array wrapper. For the first element, @        }a is a function that run continuously until it returns a truthy value, passing itself an incrementing integer (starting at 0) each time, and outputting the final value of that integer. â gets the divisors of the current integer (X), x sums them and that result is assigned to variable V. < checks if U is less than V. The second element in the array is then just V.

Wolfram Language (Mathematica), 53 bytes
{#,f@#}&@@Select[Range[x=#]+1,(f=Tr@*Divisors)@#>x&]&

Try it online!
Tries all values between 2 and x+1, where x is the input.
(The Select returns a list of all values that work, but the function {#,f@#}& takes all of these as inputs, and then ignores all its inputs but the first.)

Husk, 12 11 bytes
§eVḟ>⁰moΣḊN

-1 byte, thanks to @Zgarb!
Try it online!

Clever! Weird though how , doesn't work (or inference takes too long?).

It does infer a type, but outputs an infinite list. It may be caused by the overloading of ḟ that takes an integer as the second argument, but that's just a guess.

R, 73 bytes
n=scan();while(1){d=(x=1:T)[!T%%x];if(sum(d)>n)break;T=T+1};cat(T,sum(d))

Try it online!
Outgolfed by duckmayr.

71 bytes https://codegolf.stackexchange.com/a/149747/76266

R, 71 bytes
function(x)for(n in 1:x){z=sum(which(n%%1:n==0));if(z>x)return(c(n,z))}

Try it online!

59 bytes but it will stack overflow for large x.

Clojure, 127 bytes
(defn f[n](reduce +(filter #(zero?(rem n %))(range 1(inc n)))))
(defn e[n](loop[i 1 n n](if(>(f i)n){i,(f i)}(recur(inc i)n))))

Try it online!
thanks to @steadybox for -4 bytes!

Welcome to the site!

Some whitespace can be removed to save a few bytes. Try it online!

In this case reduce can be replaced by apply, also the function e could be expressed as an anonymous function via the #(...) syntax, you don't need to name it at Code Golf. #(=(rem n %)0) is shorter than #(zero?(rem n %)). And remember that , is whitespace, and can be removed in this case as it is followed by (, so it will be parsed correctly.

@NikoNyrh nice to meet a fellow clojurist, i'll edit this post soon

05AB1E, 11 bytes
>LʒÑO‹}нDÑO

Try it online!
Leaves the output on the stack, as allowed per meta consensus. I added ) for the sake of visualization, but the program also implicitly prints the top of the stack.

JavaScript (ES6), 61 58 bytes

f=(n,i=1,s=j=0)=>j++<i?f(n,i,i%j?s:s+j):s>n?[i,s]:f(n,++i)
<input type=number min=0 oninput=o.textContent=f(this.value)><pre id=o>

Edit: Saved 3 bytes thanks to @Arnauld.

I get "Script error." when inputting a value over 545

Try using Safari; apparently it supports Tail Call Optimisation. (Or if you can find them, some versions of Chrome enable it via the "Experimental JavaScript features".)

Ruby, 58 bytes
Full program because I'm not sure if lambdas are allowed. /shrug
gets
$.+=1until$_.to_i.<v=(1..$.).sum{|n|$.%n<1?n:0}
p$.,v

Try it online!
Explanation
gets     # read line ($_ is used instead of v= because it cuts a space)
$.+=1    # $. is "lines read" variable which starts at 1 because we read 1 line
    until     # repeat as long as the next part is not true
$_.to_i  # input, as numeric
  .<v=   # is <, but invoked as function to lower operator prescedence
  (1..$.)        # Range of 1 to n
  .sum{|n|       # .sum maps values into new ones and adds them together
     $.%n<1?n:0  # Factor -> add to sum, non-factor -> 0
  }
p$.,v    # output n and sum

Lambdas are certainly allowed.

APL (Dyalog), 32 bytes
{⍺<o←+/o/⍨0=⍵|⍨o←⍳⍵:⍵,o⋄⍺∇⍵+1}∘0

Try it online!
⍵o⍺⍵.

C,  79  78 bytes
i,n,s;f(x){for(i=n=s=0;x>s;s+=n%++i?0:i)i-n||(++n,i=s=0);printf("%d %d",n,s);}

Try it online!

Suggest i=s=!++n instead of ++n,i=s=0

SOGL V0.12, 14 bytes
1[:Λ∑:A.>?ao←I

Try it Here!
Explanation:
1               push 1
 [              while ToS != 0
  :Λ              get the divisors
    ∑             sum
     :A           save on variable A without popping
       .>?  ←     if greater than the input
          ao        output the variable A
            ←       and stop the program, implicitly outputting ToS - the counter
             I    increment the counter

MATL, 12 bytes
`@Z\sG>~}@6M

Try it online!
Explanation
`      % Do...while
  @    %   Push iteration index (1-based)
  Z\   %   Array of divisors
  s    %   Sum of array
  G    %   Push input
  >~   %   Greater than; logical negate. This is the loop condition
}      % Finally (execute on loop exit)
  @    %   Push latest iteration index
  6M   %   Push latest sum of divisors again
       % End (implicit). Run new iteration if top of the stack is true
       % Display stack (implicit)

Gaia, 11 bytes
dΣ@>
↑#(:dΣ

Try it online!
Leaves the output on the stack, as allowed per meta consensus. I added €. for the sake of visualization, but the program also implicitly prints the top of the stack.

Haskell, 59 bytes
f x=[(i,s)|i<-[1..],s<-[sum[d|d<-[1..i],i`mod`d<1]],s>x]!!0

-1 byte, thanks to @nimi!
Try it online!

Ohm v2, 11 bytes
£^DVΣD³>‽;«

Try it online!

Python 3, 163 bytes
def f(x):
    def d(x):return[i for i in range(1,x+1) if x%i==0]
    return min(i for i in range(x) if sum(d(i)) >x),sum(d(min(i for i in range(x) if sum(d(i)) >x)))

Hello and welcome to PPCG; nice first post! From a golfing aspect, you could save some bytes by removing whitespace, using lambda functions, collapsing everything onto one line and not repeating yourself. We also usually link to an online testing environment, like for example TIO (105 bytes, using the techniques described above.)

@JonathanFrech: Excellent comment. Thanks for your patience with noobies in general and noob in particular ;)

Factor, 88
USE: math.primes.factors [ 0 0 [ drop 1 + dup divisors sum pick over > ] loop rot drop ]

Brute-force search. It's a quotation (lambda), call it with x on the stack, leaves n and f(n) on the stack.
As a word:
: f(n)>x ( x -- n f(n) )
  0 0 [ drop 1 + dup divisors sum pick over > ] loop rot drop ;

Python 3, 100 bytes
d=lambda y:sum(i+1for i in range(y)if y%-~i<1)
f=lambda x:min((j,d(j))for j in range(x+1)if x<=d(j))

Try it online!
Thanks to Jonathan Frech's comment on the previous python 3 attempt, I have just greatly expanded my knowledge of python syntax.  I'd never have thought of the -~i for i+1 trick, which saves two characters.
However, that answer is 1) not minimal and 2) doesn't work for x=1 (due to an off-by-one error which is easy to make while going for brevity; I suggest everyone else check their answers for this edge case!).
Quick explanation:
sum(i+1for i in range(y)if y%-~i<1) is equivalent to sum(i for i in range(1,y+1)if y%i<1) but saves two characters.  Thanks again to Mr. Frech.
d=lambda y:sum(i+1for i in range(y)if y%-~i<1) therefore returns the divisors of y.
f=lambda x:min((j,d(j))for j in range(x+1)if x<=d(j)) is where I really did work.  Since comparing a tuple works in dictionary order, we can compare j,d(j) as easily as we can compare j, and this lets us not have to find the minimal j, store it in a variable, and /then/ compute the tuple in a separate operation.  Also, we have to have the <=, not <, in x<=d(j), because d(1) is 1 so if x is 1 you get nothing.  This is also why we need range(x+1) and not range(x).
I'd previously had d return the tuple, but then I have to subscript it in f, so that takes three more characters.

Welcome to the site and nice first post. You can get to 98 bytes by removing the f= as anonymous functions are perfectly acceptable here!

You can't call an anonymous function from another line of code, is the problem -- I have a separate print(f(100)) statement to test that the function works.

That's not a problem here. It's perfectly acceptable and works to not include the f= in your byte count, and is a good way to golf in Python. Check this for more golfing tips in Python!

Hm.  I can equal, but not better, my submission by appending q=range and replacing range with q in both existing instances.  Sadly, this doesn't improve it and since lambda is a keyword I can't use it for that, I'd have to do exec() tricks wasting too many characters.

@MichaelBoger Well, you can call an anonymous function in Python; lambda expressions do not have to be assigned to a variable.

@JonathanFrech I personally feel that should require counting the print statement as part of the code because otherwise it doesn't output anything and cannot be called subsequently to output anything -- but I realize this is not the community standard, so I'll have to get used to it.

Python 2, 81 bytes
def f(n):
 a=b=0
 while b<n:
	a+=1;i=b=0
	while i<a:i+=1;b+=i*(a%i<1)
 return a,b

Try it online!

77 bytes.

Replacing the tabs with two spaces makes this work in python 3 at 83 bytes, although to try it I had to put parentheses in the print statement. You can also replace the return statement with a print statement and not need an auxiliary function to print it; the bytes stay the same.

Java (OpenJDK 8), 91 bytes
i->{for(int j=0;j++<i;)for(int k=0,l=0;k++<j;)if((l+=j%k<1?k:0)>i)return k+","+l;return"";}

Try it online! (timeout on third test case)

89 bytes

Perl 5, 60 + 1 (-p) = 61 bytes
$"=$_;until($_>$"){$_=$/=0;$\--;$_+=$\%$/?0:$/until++$/>-$\}

Try it online!
Output format:
sum-n

Clojure, 102 bytes
#(loop[i 1](let[s(apply +(for[j(range 1(inc i)):when(=(mod i j)0)]j))](if(> s %)[i s](recur(inc i)))))

PHP, 69 bytes
for(;$argv[1]>=$t;)for($t=$j=++$i;--$j;)$t+=$i%$j?0:$j;echo$i,',',$t;

Perl 6, 48 bytes
{first :kv,*>$_,map {sum grep $_%%*,1..$_},0..*}

Try it online!

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


text:
The Microwave Challenge
Inspired by this comment.
Input
The number of seconds on the timer.
Output
Here's our basic microwave:
 _____________________________________________________________
|                                             |  ___________  |
|                                             | | [display] | |
|     ___________________________________     | |___________| |
|    |                                   |    | |   |   |   | |
|    |                                   |    | | 1 | 2 | 3 | |
|    |                                   |    | |___|___|___| |
|    |                                   |    | |   |   |   | |
|    |                                   |    | | 4 | 5 | 6 | |
|    |                                   |    | |___|___|___| |
|    |                                   |    | |   |   |   | |
|    |                                   |    | | 7 | 8 | 9 | |
|    |                                   |    | |___|___|___| |
|    |                                   |    | |   |       | |
|    |                                   |    | | 0 | Start | |
|    |                                   |    | |___|_______| |
|    |                                   |    |  ___________  |
|    |___________________________________|    | |           | |
|                                             | |           | |
|                                             | |___________| |
|_____________________________________________|_______________|

You should replace [display] with:

The time left to cook in the format minutes:seconds if there is any time left.
The system time in hours:minutes if the time left is 0.

Rules

The display can be aligned in either direction, but the vertical bars need to align with the ones above them.
You may assume that the input will never be negative and never exceed 59,999,999.
No leading zeroes before a cook time. Remove the minutes and the colon for inputs less than 60.
Use 12-hour time UTC with no leading zeroes for the system time.
Trailing whitespace is allowed.
Since this is code-golf, the shortest answer in bytes wins.

Display test cases
You should, of course, print the entire microwave along with the display, and it should work for any input within the boundaries, but here are some test cases for the display:
Input     Display
100       1:40
59        59
60        1:00
120       2:00
59999999  999999:59
1         1
0         [show system time]

UTC Time  Display
00:00     12:00
01:00     1:00
13:04     1:04

I was hoping to see this in the Sandbox where I was going to suggest that the display be "animated", taking input as seconds, starting the display in minutes & seconds and then counting down to 0 seconds.

@Shaggy It was posted in the sandbox yesterday.

Ah, nuts, I missed it :(

Can we center the display time rather than just leaving 1 space between it and |? I.e is |<equal number of spaces>8:35<equal number of spaces>| acceptable in place of | 8:35<more spaces>|? Moreover, it's nicer :-)

@Mr.Xcoder The display should be padded with spaces on either side you want (or even a combination of the two) to make it 9 characters. I thought the rules made that clear.

Here is a draft for whomever is interested to solve this in Python (you can use that bit of code however you want)

SOGL V0.12, 151 150 bytes
╔*:@ΚG┐∙+;┐Κ+Γ╬5□
‽uS9w'+*;5wι+}:'+÷;'+%lH⁵!+‽ 0Κ}⁴‽ι}⁰ :∑ā;'!3ž"∑⅓/«juΒ  v←>k─z“M»─4n{_□}4Δ№{' ;3*I:A26□'$a22□}'(7«■  _čž'&'¹"<Ξ‘⁾žL∫L%F3‰4*'℮+f3÷⁽3*ž

Try it Here!
Explanation:
                □  a function which draws a rectangle
                   uses of the stack [xPos, yPos, height-1, (width+1)/2]
                   the width everywhere luckily is an odd number
╔*                 repeat "_" width times
  :                create a duplicate of that
   @Κ              prepend a space to it
     G             get the height on top of the stack
      ┐∙           repeat "|" vertically that many times
        +          add that below the " ___..."
         ;         get the other copy of the underscores
          ┐Κ       prepend "|" to it
            +      and add that below the rest
             Γ     palindromize horizontally with 1 overlap
              ╬5   place that at the coords [xPos; yPos], without overwriting spaces

system time
‽            }  if the input isn't 0
 uS               push date & time stuff — [year, month, day, hour, minute, second, milliscond, weekday, hours in 12-hour time, am(= 0)/pm(= 1)]
   9w             get the 9th element — hours in 12-hour time
     '+*          multiply by 60
        ;         get the array on top again
         5w       get the 5th item — minutes
           ι      pop the array
            +     add the minutes to hours*60

time formatting
:                           duplicate the time (result of above or input)
 '+÷                        divide by 60
    ;                       get the other time copy
     '+%                    mod by 60
        l                   get the length of the minutes
         H                  decrease it — truthy if the minutes are a single digit
          ⁵!                negate the hours — truthy if the hours aren't 0
            +               add those — acts like OR — truthy if minutes are a single digit or hours aren't 0
             ‽   }          if not that
               0Κ             prepend 0 to the minutes
                  ⁴         get a copy of the hours
                   ‽ }      if equal to 0
                    ι         pop the hours
                      ⁰     wrap the stack in an array
                       :∑   join with ":"

ā;      push an empty array below the time — the main canvas
  '!    push 51
    3   push 3
     ž  at [51; 3] in the canvas insert the time

main microwave body
 "...“           push 196046633463872206014875356167606
      M»─        base 50 decode — [1,1,19,31,6,4,13,18,1,1,19,23,49,2,1,6,49,17,2,6]
         4n      group 4 items — [1,1,19,31],[6,4,13,18],[1,1,19,23],[49,2,1,6],[49,17,2,6]
           {  }  for each group
            _      put the arrays contents on the stack
             □     execute the rectangle making function

boxes for the numbers
4Δ                      push [1,2,3,4]
  №                     reverse — [4,3,2,1]
   {                 }  for each
    ' ;                   push 49 below the current number — X pos
       3*                 multiply the current number by 3
         I                and increment it — Y pos
          :A              save a copy of that on variable A (for the next rectangle)
            26□           create a rectangle at [49; cnum*3+1] with width 11 and height 3
               '$         push 53 — X pos
                 a        push A — Y pos
                  22□     create a rectangle at [53; cnum*3+1] with width 3 and height 3
'(7«■  _              push 57, 14 and "  _"
        č             chop the string into chars (aka make it vertical)
         ž            insert that at [57; 14] in the canvas
          '&'¹"..‘    push 55, 15, "start"
                  ⁾   uppercase the first letter of "start"
                   ž  insert that at [55; 15] in the canvas

number inserting
L∫                   for each in 1..10, pushing counter
  L%                   push counter % 10 — the drawn digit
    F3‰                push (counter-1)%3 + 1
       4*              multiply that by 4
         '℮+           and add 47 — X position
            f3÷        floor divide the 0-based counter by 3
               ⁽       increment by 2
                3*     multiply by 3
                  ž    insert it in the main canvas

JavaScript (ES6), 345 342 bytes
Saved 2 bytes thanks to @StephenLeppik
n=>[...'lmnopqsuvwxyz{}~'].reduce((s,c)=>(x=s.split(c)).join(x.pop()),` p{{yyvu{ xvs${(n&&n<60?n+'':(k=n||new Date/6e4|0,k/60%(n?k:12)|0||(n?0:12))+':'+('0'+k%60).slice(-2)).padEnd(9)}xoup__uuxx{~zzn1s2s3wn4s5s6wn7s8s9wuuq 0sStartmy_~ { oxp__zxllx{|x
|p{_|{y_|qox}}}uzs}uuuuu {yyy__z|u y___s|wm|y~zzv
|}}}}xu  sx q~|p{{{ox
znzq m qy|ylx}|xv`)

Test cases

let f =

n=>[...'lmnopqsuvwxyz{}~'].reduce((s,c)=>(x=s.split(c)).join(x.pop()),` p{{yyvu{ xvs${(n&&n<60?n+'':(k=n||new Date/6e4|0,k/60%(n?k:12)|0||(n?0:12))+':'+('0'+k%60).slice(-2)).padEnd(9)}xoup__uuxx{~zzn1s2s3wn4s5s6wn7s8s9wuuq 0sStartmy_~ { oxp__zxllx{|x
|p{_|{y_|qox}}}uzs}uuuuu {yyy__z|u y___s|wm|y~zzv
|}}}}xu  sx q~|p{{{ox
znzq m qy|ylx}|xv`)

O.innerText = [100, 59, 60, 120, 59999999, 1, 0].map(f).join('\n');

Python 3, 319 bytes
Hide a %9s into compressed string, then use time.strftime to get time, %-I to strip the leading zero.
import lzma,base64,time
lambda a:lzma.decompress(base64.b85decode('T>t=p0RR90|NsC0{{Rpd^C|@(1X`TL^f`u<KIrh0p%HYiiZbvoDPNw6<V^!O(Lz{boq`zUBx6K?Tsnl5A-wX&%GXCq@<%4wDjJcoz5VNNSc<>}9i|2|i)oHsC6Kg`@30<`nrg{=G5%W0xn9J;m-hJXY%|G!|Limu^8')).decode()%[time.strftime('%-I:%M',time.gmtime()),a,'%d:%02d'%(a/60,a%60)][a and~(a<60)]

Try it online!

Did this use Mr. XCoder's template? I'd like to know whether to flag the comment.

@StephenLeppik Oh, I didn't notice that there was a template.

PHP, 416 bytes
if(is_numeric($a=$argv[1])&&$a&&-1<$s=$a%60){$m=(int)($a==$s?'':$a/60);$s=$m||$s>9?substr("0$s",-2,2):$s;$e=$m?"$m:$s":"$s";}elseif(!$a){$e=date("g:i");}else{$e=date("g:i",strtotime($a));}$e=str_pad($e,9);eval(gzinflate(base64_decode('S03OyFdQUIqnBPBy1SiQAoCqkXQD+aQbUKOgkgqiYDqJcCVMJ5IQwgBi7K+BWa2AhMkywBCIjYDYmEwDQE6H4QHyggkQmwKx2dD1gjkQWwCx5QB7QYF8LxgAcXBJYlEJZV4gOy9gz8fIWQwXQAoDhJlkFQSUGoBRHhDheiQt6HwlawA=')));

More readable:
if(is_numeric($a=$argv[1])&&$a&&-1<$s=$a%60){
    $m=(int)($a==$s?'':$a/60);
    $s=$m||$s>9?substr("0$s",-2,2):$s;
    $e=$m?"$m:$s":"$s";
}elseif(!$a){
    $e=date("g:i");
}else{
    $e=date("g:i",strtotime($a));
}
$e=str_pad($e,9);
eval(gzinflate(base64_decode('S03OyFdQUIqnBPBy1SiQAoCqkXQD+aQbUKOgkgqiYDqJcCVMJ5IQwgBi7K+BWa2AhMkywBCIjYDYmEwDQE6H4QHyggkQmwKx2dD1gjkQWwCx5QB7QYF8LxgAcXBJYlEJZV4gOy9gz8fIWQwXQAoDhJlkFQSUGoBRHhDheiQt6HwlawA=')));

$e is placed within the zipped microwave which also includes the echo like this (the double space after the echo is to get a more optimal b64 encoded string, it saves a byte here):
echo base64_encode(gzdeflate('echo  "_____________________________________________________________
|                                             |  ___________  |
|                                             | | $e | |

Batch, 833 bytes
@echo off
set t=%time%
set/ah=(%t:~,2%+11)%%12+1,s=%1+0,s+=s/60*40
if %s%==0 set s=%h%%t:~3,2%
set s=   %s%
set s=%s:~-4,2%:%s:~-2%
set s=%s:  :=   %
set u=_______
set p=
set "v=|    |
for %%l in (" %u%%u%%u%%u%%u%%u%%u%%u%_____" "|%p%%p%%p%%p% |  %u%____  |" "|%p%%p%%p%%p% | |   %s%   | |" "|     %u%%u%%u%%u%%u%     | |%u%____| |") do echo %%~l
call:c 1 2 3
call:c 4 5 6
call:c 7 8 9
for %%l in ("%v%%p%%p%%p% %v%|   |%p:~4%| |" "%v%%p%%p%%p% %v%| 0 | Start | |" "%v%%p%%p%%p% %v%|___|%u%| |" "%v%%p%%p%%p% %v% %u%____  |" "|    |%u%%u%%u%%u%%u%%v%|%p%| |" "|%p%%p%%p%%p% | |%p%| |" "|%p%%p%%p%%p% | |%u%____| |" "|%u%%u%%u%%u%%u%%u%___|%u%%u%_|") do echo %%~l
exit/b
:c
for %%l in ("%v%%p%%p%%p% %v%|   |   |   | |" "%v%%p%%p%%p% %v%| %1 | %2 | %3 | |" "%v%%p%%p%%p% %v%|___|___|___| |") do echo %%~l

Python 2, 481 bytes
from datetime import*
def f(t,r=range):
	d=datetime.utcnow();g=[[' ']*63 for _ in" "*21]
	for i in r(1,62):
		for j in[0,-1]+[3,-4]*(5<i<41)+[1,3,6,9,12,15,16,19]*(48<i<60):g[j][i]="_"
	for i in r(1,21):
		for j in[0,-1,46]+[5,41]*(3<i<18)+[48,60]*(1<i<20)*(i!=16)+[52]*(3<i<16)+[56]*(3<i<13):g[i][j]="|"
	for i in r(10):g[i/3*3+5][i%3*4+50]=`-~i%10`
	g[14][54:59]="Start";g[2][49:60]=(t and(`t/60`+":")*(t>59)+`t%60`.zfill(2)or`d.hour`+":"+`d.minute`.zfill(2)).center(11);return g

Try it online!

C#, 701 bytes
Try it Online!
(a)=>{int j=0;Func<int,string>b=(c)=>new string(new[]{1,0,1,0,1,1,0,1,0,0,1,1}[j++]>0?'_':' ',c);string e="|    |                                   |    | |",f=e+"___|___|___| |";Func<int,string>g=h=>e+$" {h} | {h+1} | {h+2} | |";return$@" {b(61)}
|{b(45)}|  {b(11)}  |
|{b(45)}| | {new DateTime(0).AddSeconds(a).ToString("mm:ss").PadRight(10)}| |
|     {b(35)}     | |{b( 11)}| |
{e}   |   |   | |
{g(1)}
{f}
{e}   |   |   | |
{g(4)}
{f}
{e}   |   |   | |
{g(7)}
{f}
{e}   |       | |
{e} 0 | Start | |
{e}___|_______| |
|    |{b( 35)}|    |  ___________  |
|    |{b( 35)}|    | |           | |
|     {b(35)}     | |           | |
|     {b(35)}     | |___________| |
|{b(45)}|{b(15)}|";}


text:
How to improve Ruby code under some restrictions
I'm (still) trying to make another submission to the Largest Number Printable question, and I've got the following bit of code:
f=->a{b,c,d=a;b ?a==b ?~-a:a==a-[c-c]?[[b,c,f[d]],~-c,b]:b:$n}
h=[],$n=?~.ord,[]
h=f[h]until h==p($n+=$n)-$n

Ungolfed:
f=->{b,c,d=a
if b
  if a==b # a is not an array
    return a-1
  elsif a==a-[0] # a does not contain 0
    t = [b,c,f[d]]
    return [t,c-1,b]
  else # a is an array containing 0
    return b
  end
else # if a == []
  return $n
end}

$n = 126
h = [[],n,[]]

until h==0 do
  $n += $n
  p $n
  h = f[h]
end

The conditions I'm working with:

Maximum 100 bytes.
No digits allowed in my code.

My code is currently at 108 bytes, but I can't figure out how to golf it further.
The h==p($n+=$n)-$n may be replaced with h==0, but I can't use digits and I still need to print $n and apply $n+=$n in the until loop.
I'm also satisfied with code that replaces $n+=$n with $n+=1, but I can't use digits unfortunately.
Any suggestions?

It would be helpful if you could include in your question a version of the code with whitespace and comments so we don’t have to figure every bit out on our own.

@Jordan Updated, sorry.

100 bytes
For my purposes, this is good enough.
h=[],n=?~.ord,n
f=->a{b,c,d=a;b ?a==b ?~-a:a==a-[c-c]?[[b,c,f[d]],~-c,b]:b:p(n+=n)}
h=f[h]until h==n

Replacing h==0 with h==n will not cause the program to fail to terminate, which is what I needed.
Also improves on Jordan's answer by declaring h and n in the same line.

105
You can save three bytes by declaring n as a local variable (instead of a global) before f:
n=?~.ord
f=->a{b,c,d=a;b ?a==b ?~-a:a==a-[c-c]?[[b,c,f[d]],~-c,b]:b:n}
h=[],n,[]
h=f[h]until h==p(n+=n)-n

Thanks! For my purposes, this can be written like so, making it 103 bytes.

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


text:
Advent Challenge 2: The Present Vault Raid!
<< Prev Next >>
Challenge
Now that Santa has finally figured out how to get into his present vault, he realises that somehow the elves got in there before him and stole some of his presents! They haven't figured out how to leave the vault yet though, so Santa has to try and catch them all. Santa and the elves both have infinite energy to run around but unfortunately the elves have a higher infinity of energy, so if they end up running in loops everywhere, the elves have gotten free.
Given a graph of n nodes and e edges with a walk existing between any two nodes, and the positions of the elves and Santa, determine how many elves Santa can catch before he gets tired.
The chase is turn-based. Each cycle, the elves first all move simultaneously (they can move through each other and onto the same node as well), and then Santa will move. If Santa moves onto the same node as an elf, then he has caught that elf. Each elf may only move from one node to its neighbour in one step. The same goes for Santa in the beginning, but for every elf he has caught, Santa can take one extra step. So, if Santa has caught an elf, then he can move from a node to its neighbour's neighbour. This means he could move to a node and then back. However, since Santa is running too quickly during this time period, he will not catch any elves that passes in the intermediate steps (so if he is on A, A is connected to B, B is connected to C, there is an elf on B, and Santa moves from A -> B -> C, the elf has not yet been caught). However, Santa doesn't have to move that many steps at once; he moves up to 1 + (number of elves caught) each turn.
Note that all of the elves must move each turn, and if an elf moves onto Santa's node, they get caught.
All entities (elves, Santa) will be on distinct nodes in the beginning.
Specifications and Rules
Your program should theoretically work for input of any size. The input will be given as a graph, the positions of the elves, and the position of Santa. You may take the graph in any reasonable format (list of nodes + list of edges, list of edges, adjacency matrix, cycle notation, etc), and you may take the positions in any reasonable format that works with your graph input format (index in the list of nodes, etc). The output should be a single positive integer indicating the maximum number of elves that Santa can catch.
Test Cases
These are given as lists of edges and node numbers for positions.
Input -> Output
[(0, 1), (1, 2)], [0, 2], 1 -> 2 # Easy win for Santa, the elves get themselves caught :P
[(0, 1), (1, 2), (2, 3), (3, 0)], [0, 1], 2 -> 2 # The elf opposite of Santa cannot escape but the other one can always just run away each turn, until Santa catches the first elf. Then he can easily just catch the rest.
[(0, 1), (1, 2), (2, 3), (3, 0)], [1], 0 -> 0 # Santa will never catch up
[(0, 1), (1, 2), (2, 3), (3, 0), (1, 4), (4, 5), ..., (10, 11), (11, 3)], [2, 6], 0 -> 2 # The first elf moves to either 1 or 3 and then gets caught. Then, Santa can use his 2-step move to catch up to the second elf no matter what.

I think Santa can catch either no elves or all the elves, so this challenge might just be "can he catch an elf" hint hint
Rules

Standard Loopholes Apply
This is a code-golf challenge, so the shortest answer in bytes wins
No answers will be accepted

Happy Golfing!
Note: I drew inspiration for this challenge series from Advent Of Code. I have no affiliation with this site
You can see a list of all challenges in the series by looking at the 'Linked' section of the first challenge here.

I wish I knew Santa's elves were that wicked before...

The approach to solve this would probably be: 1 Prove some mathematical statements. 2 Post a Jelly (/...) answer in less than 10 bytes.

Well, it is possible that Santa can catch some but not all elves (is it possible that some elves starts at the Santa's position; and is it possible that the elves voluntarily let Santa catch them?)

Edit: No for the first question, but probably for the second question.

@user202729 No, all entities start at different locations. For the second question, yes; if an elf moves onto Santa's node, then it is considered caught. Also, as soon as Santa catches an elf, then to catch any remaining elf, draw a path from Santa to the elf (which must exist), and then move along it; whenever the elf moves, add its movement to the end of the path. Santa will catch up because he has step size larger than the elf.

So the elves may sacrifice themselves to make the challenge harder. For example: Graph 0-1, 1-2, 2-3, 3-0 (cyclic 4, bipartite) with Santa step size = 3 (because of two self-sacrifice elves) and the other elf escape - in that case, Santa can catch 2 out of 3 elves.

@user202729 Note that Santa doesn't have to move 3 spaces; he can move anywhere from 1 to 3 spaces. That might be the source of confusion here.

Tool to generate adjacency list from edge list, because I'm going to post an answer that take adjacency list as input: Try it online!

Wolfram Language (Mathematica), 129 bytes
Block[{a=#},Clear@f;s_~f~e_:=If[s==e,1,s~f~e=0;s~f~e=Min[(hMax[#~f~h&/@a@s,Boole[h==s]])/@a@e]];Tr[Max[(e#3~f~e)/@#2]^#2]]&

Try it online!
Similar approach to my answer to this question.
The function takes 3 arguments as input: adjacency list represented as an association (tool to generate adjacency list from edge list), elves position and santa position.
Note that Clear[f] is necessary, because function submissions must be reusable.
The code below is ungolfed code with partial explanation. More explanation later.
reverseBoole = # != 0 &

(* Or@@{a, b} === reverseBoole[booleOr[Boole[{a, b}]]] *)
booleOr = Max

booleAnd = Min

(* Boole@f[s, e] = Santa can catch Elf ? *)

mainfunc = Block[{adjlist = #},
  Clear[f];
  f[s_, e_] := If[ s == e, f[s, e] = 1,
    f[s, e] = Boole[False];
    f[s, e] = booleAnd[
      (e1  booleOr[
        ( s1  f[s1, e1] ) /@ adjlist[s],
        Boole[e1 == s]
      ]) /@ adjlist[e]
    ]
  ];
  If [ 0 == booleOr[ ( e  f[#3, e] ) /@ #2 ] , 0, Length[#2] ]
]&

Python3, 691 bytes
R=range
def T(g,s):
 q=[[s]]
 while q:A=q.pop(0);yield(l:={b for i in A for a,b in g if a==i});q+=[l]
def f(g,e,s):
 q,a,D,v=[(e,0,s,0)],[(e,s)],{},[]
 while q:
  E,c,S,B=q.pop(0);v+=[B]
  if c<len(E):
   if E[c]==-1:q+=[(E,c+1,s,B)];continue
   J=1
   for i in next(T(g,E[c])):
    O=[*E];J=0
    if i!=S:
     O[c]=i
     if(O,S)not in a:J=0;q+=[(O,c+1,S,B)]
    else:O[c]=-1;q+=[(O,c+1,S,B+1)]
   if J:q+=[(O,c+1,S,B)]
  else:
   t,L=T(g,S),0
   for i in R(max(sum(k==-1for k in E)+1,1)):
    for I in R(L,i+1):M=next(t)
    L=i+1
    for I in M:
     O=[*E];x=B
     for y in R(len(E)):G=O[y]==I;O[y]=[O[y],-1][G];x+=G;v+=[x]
     if(O,I)not in a:q+=[(O,0,I,x)];a+=[(O,I)]
 return max(v)

Try it online!
Also, a 808 byte solution that uses caching for faster execution: try it online


text:
2 factors factorization
Given a natural number n write a program or function to get a list of all the possible two factors multiplications that can be used to achieve n. To understand better what is pretended you can go to http://factornumber.com/?page=16777216 to see when n is 16777216 we get the following list:
   2 × 8388608
   4 × 4194304
   8 × 2097152
  16 × 1048576
  32 ×  524288
  64 ×  262144
 128 ×  131072
 256 ×   65536
 512 ×   32768
1024 ×   16384
2048 ×    8192
4096 ×    4096

No need to pretty print things like here. The requirement is that each entry (pair of factors) is well distinguished from each other and inside each pair, the first factor is also well distinguished from the other. If you choose to return a list/array, the inside element can be a list/array with two elements, or some structure of your language that supports a pair of things like C++ std::pair.
Do not print the multiplication by 1 entry, nor repeat entries with the first factor commuted by the second, as they are pretty useless.
No winner; it will be a per language basis code golf.

Could you possibly add a smaller test case, such as 30?

@cairdcoinheringaahing You can use factornumber.com to generate more test cases.

I've seen this "per language" competition recently. What's the point? Most Qs don't get more than 1 or 2 As per language, and you still can select just one A as correct.

@fedes. It's usually because there's no point in comparing between languages (i.e. Java vs. Jelly).

@totallyhuman yeah, I know. Most of my answers are in Factor, or even Smalltalk. No chance against the golfing languages. Maybe there could be some way of ranking languages by verbosity and boilerplatery

Related https://codegolf.stackexchange.com/q/141004/73398

Java (OpenJDK 8), 81 66 65 bytes

-15 Bytes thanks to Olivier Grégoire.
-1 Byte: ++j<=i/j -> j++<i/j.

i->{for(int j=1;j++<i/j;)if(i%j<1)System.out.println(j+" "+i/j);}

Try it online!

Old one (for reference)
Java (OpenJDK 8), 126 bytes
i->{java.util.stream.IntStream.range(2,i).filter(d->d<=i/d&&i%d==0).forEach(e->System.out.println(""+e+"x"+i/e));return null;}

Try it online!
First codegolf submit and first lambda usage. Future self, please forgive me for the code.

Nice first entry! Welcome to PPCG! Here is it golfed down to 66 bytes by removing all the superfluous: I couldn't golf your algorithm though.

Python 2, 51 bytes
f=lambda n,k=2:n/k/k*[f]and[(k,n/k)][n%k:]+f(n,k+1)

Try it online!

51 bytes (thanks to Luis Mendo for a byte)
lambda n:[(n/k,k)for k in range(1,n)if(k*k<=n)>n%k]

Try it online!

51 bytes
lambda n:[(n/k,k)for k in range(1,n)if n/k/k>n%k*n]

Try it online!

I like the use of [f].

You can save 1 byte in the second version with lambda n:[(n/k,k)for k in range(1,n)if(k*k<=n)>n%k]

MemoryError on all approaches for 1512518520

C (gcc), 58 54 53 bytes

Saved a byte thanks to Steadybox.

f(N,j){for(j=1;j++*j<N;)N%j||printf("|%d,%d",j,N/j);}

Try it online!

05AB1E, 8 bytes
ÑÂ‚ø2äн¦

Try it online!

+1 from me we have nearly the same solutions. I thought of this 8-byter

@Mr.Xcoder: Ah yes, nice :) It's too bad that the map is required there.

Haskell, 38 bytes
f x=[(a,b)|a<-[2..x],b<-[2..a],a*b==x]

Try it online!

Time out for 1512518520

APL (Dyalog), 28 bytes
{(⊢,⍵÷⊢)¨o/⍨0=⍵|⍨o←1↓⍳⌊⍵*.5}

Try it online!

Perl 6, 38 bytes
{map {$^a,$_/$a},grep $_%%*,2.. .sqrt}

Try it
Expanded:
{   # bare block lambda with implicit parameter ｢$_｣

  map
    { $^a, $_ / $a },  # map the number with the other factor

    grep
      $_ %% *,         # is the input divisible by *
      2 .. .sqrt       # from 2 to the square root of the input
}

Brachylog, 8 bytes
{~×≜Ċo}ᵘ

Try it online!
Explanation
{~×≜Ċo}ᵘ
{     }ᵘ  List the unique outputs of this predicate.
 ~×       Pick a list of integers whose product is the input.
   ≜      Force concrete values for its elements.
    Ċ     Force its length to be 2.
     o    Sort it and output the result.

The ~× part does not include 1s in its output, so for input N it gives [N] instead of [1,N], which is later culled by Ċ.
I'm not entirely sure why ≜ is needed...

The ≜ is needed because otherwise there are no choice points for ᵘ: a length-2 list whose product is the input is the only answer if you don't actually ask for the values of the list.

Jelly, 12 7 bytes
ḊŒċP=¥Ƈ

Try it online!

Japt, 9 bytes
â¬Å£[XZo]

Test it online! Returns an array of arrays, with some nulls at the end; -R flag added to show output more clearly.

So I think the  -R should be considered for the byte count...

@sergiol, no, in this case it's just for formatting the output for better readability.

Exactly the solution I had, except I filtered the nulls out at the end.

JavaScript (ES6), 55 bytes
n=>eval('for(k=1,a=[];k*++k<n;n%k||a.push([k,n/k]));a')

Demo

let f =

n=>eval('for(k=1,a=[];k*++k<n;n%k||a.push([k,n/k]));a')

console.log(JSON.stringify(f(6)))
console.log(JSON.stringify(f(7)))
console.log(JSON.stringify(f(16777216)))

Try It Online!

Is it me or does this fail for 6?

@Neil "We can fix it." (Thanks for reporting!)

How can I supply a number to test?

You can Try it online!

Jelly, 8 bytes
½ḊpP⁼¥Ðf

A monadic link taking a number and returning a list of lists (pairs) of numbers.
Try it online! (times out on TIO for the 16777216 example since it would create a list of 68.7 billion pairs and filter down to those with the correct product!)
How?
½ḊpP⁼¥Ðf - Link: number, n     e.g. 144
½        - square root of n          12
 Ḋ       - dequeue*                 [2,3,4,5,6,7,8,9,10,11,12]
  p      - Cartesian product**      [[2,1],[2,2],...[2,144],[3,1],...,[3,144],...,[12,144]
      Ðf - filter keep if:
     ¥   -   last two links as a dyad (n is on the right):
   P     -     product
    ⁼    -     equals
         -                          [[2,72],[3,48],[4,36],[6,24],[8,18],[9,16],[12,12]]

* Ḋ, dequeue, implicitly makes a range of a numeric input prior to acting, and the range function implicitly floors its input, so with, say, n=24 the result of ½ is 4.898...; the range becomes [1,2,3,4]; and the dequeued result is [2,3,4]
** Similarly to above, p, Cartesian product, makes ranges for numeric input - here the right argument is n hence the right argument becomes [1,2,3,...,n] prior to the actual Cartisian product taking place.

Husk, 8 bytes
tüOSze↔Ḋ

Try it online!
Explanation
tüOSze↔Ḋ  Implicit input, say n=30.
       Ḋ  List of divisors: [1,2,3,5,6,10,15,30]
      ↔   Reverse: [30,15,10,6,5,3,2,1]
   Sze    Zip with original: [[1,30],[2,15],[3,10],[5,6],[6,5],[10,3],[15,2],[30,1]]
 üO       Deduplicate by sort: [[1,30],[2,15],[3,10],[5,6]]
t         Drop first pair: [[2,15],[3,10],[5,6]]

Pari/GP, 49 34 38 bytes
n->[[d,n/d]|d<-divisors(n),d>1&d<=n/d]

Try it online!
Set builder notation for all pairs [d, n/d] where d runs through all divisors d of n subject to d > 1 and d <= n/d.
Huge improvement by alephalpha.

n->[[d,n/d]|d<-divisors(n),d<=n/d]

@alephalpha Good one. But had to change it a bit because it output also the factorization with 1.

Python 2, 59 bytes
lambda N:{(n,N/n,n)[n>N/n:][:2]for n in range(2,N)if N%n<1}

Try it online!

https://tio.run/##FcnRCoMgFAbgVzk3AwVh84AQsu0RfIHqwig3YfsNk2BEz27r7oNv/pV3Atfw6OrHf4fRk7ObgHJXKMgWzz9s31ruQ8oEiqDs8ZoEKydjIHfBXe/1zPXMJeUyjSIIbTQb3Ri@SWnnHFForQc — Memory error?

@sergiol Yes, a MemoryError, since Python tries to evaluate range(2,N) and store it as a list, yet the allocated memory does not suffice. One could try replace range with xrange (Python 2's range generator), though this exceeds TIO's one minute of maximum runtime. On a machine with enough memory and time, this program should terminate and return the correct answer.

Jelly, 9 bytes
ÆḌḊµżUṢ€Q

Try it online!

Octave, 42 bytes
@(n)[y=find(~mod(n,x=2:n)&x.^2<=n)+1;n./y]

Try it online!

PHP, 70 bytes
As string (70 bytes):
$i++;while($i++<sqrt($a=$argv[1])){echo !($a%$i)?" {$i}x".($a/$i):'';}

As array dump (71 bytes):
$i++;while($i++<sqrt($a=$argv[1]))!($a%$i)?$b[$i]=$a/$i:'';print_r($b);

(im not sure if i can use return $b; instead of print_r since it no longer outputs the array, otherwise i can save 2 bytes here. )
The array gives the results like:
Array
(
    [2] => 8388608
    [4] => 4194304
    [8] => 2097152
    [16] => 1048576

"If you choose to return a list/array" To me it means you can print or return as you see fit.

On second thought, returning should be valid for a function, and printing for a program. You seem to have a snippet/program, not a function, so I'd say in this case you should be printing.

Wolfram Language (Mathematica), 41 bytes
nRest@Union[Sort@{#,n/#}&/@Divisors@n]

Try it online!
 is the Function operator, which introduces an unnamed function with named parameter n.

Factor, 58
Well, there has to be some Factor in this question!
[ divisors dup reverse zip dup length 1 + 2 /i head rest ]

It's a quotation. call it with the number on the stack, leaves an assoc (an array of pairs) on the stack.
I'm never sure if all the imports count or not, as they're part of the language.
This one uses:
USING: math.prime.factors sequences assocs math ;

(If they count, I should look for a longer solution with shorter imports, which is kind of silly)
As a word:
: 2-factors ( x -- a ) divisors dup reverse zip dup length 1 + 2 /i head rest ;

50 2-factors .
 --> { { 2 25 } { 5 10 } }

Ruby, 43 bytes
->n{(2..n**0.5).map{|x|[[x,n/x]][n%x]}-[p]}

Try it online!
How it works:
For every number up to sqrt(n), generate the pair [[x, n/x]], then take the n%xth element of this array. If n%x==0 this is [x, n/x], otherwise it's nil. when done, remove all nil from the list.

Perl 5, 53 + 2 (-p flag) = 55 bytes
$_="@{[map{$_,$n/$_.$/}grep!($n%$_),2..sqrt($n=$_)]}"

Ungolfed:
while (defined $_ = <>) {
    $n = $_;
    $_ = qq(@{[
        map{ ($_, ($n / $_) . "\n") } grep { !($n % $_) } (2 .. sqrt($n))
    ]});
    print($_);
}

Try it online.

Vyxal, 7 bytes
K~/Z's⁼

Try it Online!
(not anymore) messy.

7 bytes

@AaronMiller Nice use of ~ :)

Husk, 14 12 bytes
tumoOSe`/⁰Ḋ⁰

Try it online!
Explanation
tum(OSe`/⁰)Ḋ⁰  -- input ⁰, eg. 30
           Ḋ⁰  -- divisors [1..⁰]: [1,2,3,5,6,10,15,30]
  m(      )    -- map the following function (example on 10):
     Se        --   create list with 10 and ..
       `/⁰     --   .. flipped division by ⁰ (30/10): [10,3]
    O          --   sort: [3,10]
               -- [[1,30],[2,15],[3,10],[5,6],[5,6],[3,10],[2,15],[1,30]]
 u             -- remove duplicates: [[1,30],[2,15],[3,10],[5,6]]
t              -- tail: [[2,15],[3,10],[5,6]]

APL+WIN, 32 bytes
m,[.1]n÷m←(0=m|n)/m←1↓⍳⌊(n←⎕)*.5

Explanation:
(n←⎕) Prompts for screen input

m←(0=m|n)/m←1↓⍳⌊(n←⎕)*.5 Calculates the factors dropping the first

m,[.1]n÷ Identifies the pairs and concatenates into a list.

Add++, 18 15 bytes
L,F@pB]dBRBcE#S

Try it online!
How it works
L,   - Create a lambda function
     - Example argument:     30
  F  - Factors;     STACK = [1 2 3 5 6 10 15]
  @  - Reverse;     STACK = [15 10 6 5 3 2 1]
  p  - Pop;         STACK = [15 10 6 5 3 2]
  B] - Wrap;        STACK = [[15 10 6 5 3 2]]
  d  - Duplicate;   STACK = [[15 10 6 5 3 2] [15 10 6 5 3 2]]
  BR - Reverse;     STACK = [[15 10 6 5 3 2] [2 3 5 6 10 15]]
  Bc - Zip;         STACK = [[15 2] [10 3] [6 5] [5 6] [3 10] [2 15]]
  E# - Sort each;   STACK = [[2 15] [3 10] [5 6] [5 6] [3 10] [2 15]]
  S  - Deduplicate; STACK = [[[2 15] [3 10] [5 6]]]

Befunge-93, 56 bytes
&1vg00,+55./.:   <
+1< v`\g00/g00:p00
_ ^@_::00g%!00g\#v

Try It Online

Mathematica, 53 bytes
Array[s[[{#,-#}]]&,⌈Length[s=Divisors@#]/2⌉-1,2]&

Try it online!

Julia 0.6, 41 bytes
~x=[(y,div(x,y))for y=2:x if x%y<1>y^2-x]

Try it online!
Redefines the inbuild unary operator ~ and uses an array comprehension to build the output.

div(x,y) is neccessary for integer division. x/y saves 5 bytes but the output is ~4=(2,2.0).
Julia allows chaining the comparisons, saving one byte.
Looping all the way to x avoids Int(floor(√x)).

APL NARS 99 chars
r←f w;i;h
r←⍬⋄i←1⋄→0×⍳0≠⍴⍴w⋄→0×⍳''≡0↑w⋄→0×⍳w≠⌊w⋄→0×⍳w≠+w
A:i+←1⋄→A×⍳∼0=i∣w⋄→0×⍳i>h←w÷i⋄r←r,⊂i h⋄→A

9+46+41+3=99 Test: (where not print nothing, it return something it return ⍬ the list null one has to consider as "no solution")
  f 101

  f 1 2 3

  f '1'

  f '123'

  f 33 1.23

  f 1.23

  ⎕←⊃f 16777216
   2 8388608
   4 4194304
   8 2097152
  16 1048576
  32  524288
  64  262144
 128  131072
 256   65536
 512   32768
1024   16384
2048    8192
4096    4096
  f 123
3 41

Pyt, 67 65 bytes
←ĐðĐ0↔/⅟ƖŽĐŁ₂20`ŕ3ȘĐ05Ș↔ŕ↔Đ4Ș⇹3Ș⦋ƥ⇹⁺Ɩ3ȘĐ05Ș↔ŕ↔Đ4Ș⇹3Ș⦋ƤĐ3Ș⁺ƖĐ3Ș<łĉ

I'm pretty sure this can be golfed.
Basically, the algorithm generates a list of all of the divisors of the input (let's call it n), makes the same list, but flipped, interleaves the two (e.g., if n=24, then, at this point, it has [1,24,2,12,3,8,4,6,6,4,8,3,12,2,24,1]), and prints out the elements from index 2 until half the array length, printing each number on a new line, and with an extra new line in between every pair.
Most of the work is done in actually managing the stack.

Saved 2 bytes by using increment function.

Perl 5, 50 bytes
sub{map[$_,$_[0]/$_],grep!($_[0]%$_),2..sqrt$_[0]}

Ungolfed:
sub {
    return map  { [$_, $_[0] / $_] }
           grep { !($_[0] % $_) }
           (2 .. sqrt($_[0]));
}

Try it online.

Japt, 9 bytes
Outputs a 2D array.
â ¤ò
£ÎîX

Try it


text:
Mod-balanced lists
Introduction
Suppose I have a list of integers, say L = [-1,2,2,1,2,7,1,4].
I like having balance in my life, so I'm happy to see it has as many odd elements as even elements.
What's more, it also has an equal number of elements in all modulo classes of 3 that it has elements in:
         [-1,2,2,1,2,7,1,4]
0 mod 3:
1 mod 3:         1   7 1 4
2 mod 3:  -1 2 2   2

Sadly, for the modulo classes of 4 this no longer holds.
In general, we say a non-empty list is balanced modulo N if it has an equal number of elements in all modulo classes of N for which this number is not 0.
The above list L is balanced modulo 2 and 3, but unbalanced modulo 4.
The task
Your input is a non-empty list L of integers taken in any reasonable format.
Your output is the list of those integers N ≥ 2 such that L is balanced modulo N, again in any reasonable format.
The order of the output does not matter, but it should not contain duplicates.
It is guaranteed that there are only finitely many numbers in the output, which means precisely that not all elements of L occur an equal number of times in it.
Examples of invalid inputs are [3], [1,2] and [0,4,4,0,3,3].
Notice that the largest number in the output is at most max(L) - min(L).
The lowest byte count in each language wins, and standard code-golf rules apply.
Test cases
[1,1,2] -> []
[1,1,5] -> [2,4]
[1,1,24] -> [23]
[1,2,3,2] -> [2]
[12,12,-4,20] -> [2,3,4,6,8,12,24]
[1,1,12,12,-3,7] -> [3,10]
[-1,2,2,1,2,7,1,4] -> [2,3]
[4,-17,-14,-18,-18,3,5,8] -> []
[-18,0,-6,20,-13,-13,-19,13] -> [2,4,19]
[-11,-19,-19,3,10,-17,13,7,-5,16,-20,20] -> []
[3,0,1,5,3,-6,-16,-20,10,-6,-11,11] -> [2,4]
[-18,-20,14,13,12,-3,14,6,7,-19,17,19] -> [2,3]
[-16,-9,6,13,0,-17,-5,1,-12,-4,-16,-4] -> [3,9]
[-97,-144,3,53,73,23,37,81,-104,41,-125,70,0,111,-88,-2,25,-112,54,-76,136,-39,-138,22,56,-137,-40,41,-141,-126] -> [2,3,6]

Some languages which automatically calculate the upper bound (Brachylog perhaps?) will have an advantage...

Wolfram Language (Mathematica), 56 52 bytes
Thanks to Not a tree for saving 4 bytes.
Cases[Range[2,#.#],n_/;Equal@@Last/@Tally[#~Mod~n]]&

Try it online!
The main golfing trick is to use the sum of absolute values (or the 1-norm) sum of squared values, computed as a dot product with itself, as the upper bound instead of Max@#-Min@#. Otherwise, it just implements the spec very literally.

05AB1E, 11 bytes
ÄOL¦ʒ%{γ€gË

Try it online!
ÄOL¦ʒ%{γ€gË  | Full program.

Ä            | Absolute value (element-wise).
 O           | Sum.
  L          | 1-based inclusive range.
   ¦         | Remove the first element (generates the range [2 ... ^^]).
    ʒ        | Filter / Select.
     %       | Modulo of the input with the current integer (element-wise).
      {      | Sort.
       γ     | Group into runs of adjacent elements.
        €g   | Get the length of each.
          Ë  | Are all equal?

Perl 6,  52  48 bytes
{grep {[==] .classify(*X%$^a).values},2.. .max-.min}

Test it
{grep {[==] bag($_ X%$^a).values},2.. .max-.min}

Test it
Expanded:
{  # bare block lambda with implicit parameter ｢$_｣

  grep

    {  # bare block lambda with placeholder parameter ｢$a｣

      [==]           # reduce with &infix:«==» (are the counts equal to each other)

        bag(         # group moduluses together

          $_ X% $^a  # find all the moduluses using the current divisor ｢$a｣

        ).values     # the count of each of the moduluses
    },

    2 .. .max - .min # all possible divisors
}

Haskell, 85 84 bytes
f l=[n|n<-[2..sum$abs<$>l],all.(==)=<<head$[r|m<-[0..n],_:r<-[[0|x<-l,mod x n==m]]]]

Try it online! Uses the sum of absolute values as maximum from Martin Ender's answer.
Edit: -1 byte thanks to Ørjan Johansen.
Explanation:
f l=                             -- Given a list of numbers l,
  [n|n<-                       ] -- return a list of all numbers n of the range
    [2..sum$abs<$>l],            -- from 2 to the sum of the absolute values of l
      all.(==)=<<head$           -- for which all elements of the following list are equal:
        [r|m<-[0..n],         ]  -- A list r for each number m from 0 to n, where
          _:r<-[             ]   -- r is the tail of a list (to filter out empty lists)
          [0|x<-l,mod x n==m]    -- of as many zeros as elements of l mod n equal m.

Clean, 121 bytes
Uses the sum-of-absolutes trick from Martin Ender's answer.
Golfed:
import StdEnv
f l=[n\\n<-[2..sum(map abs l)]|length(removeDup[length[m\\m<-[(e rem n+n)rem n\\e<-l]|m==c]\\c<-[0..n]])<3]

Readable:
import StdEnv
maximum_modulus l = sum (map abs l)
// mod, then add the base, then mod again (to fix issues with negative numbers)
list_modulus l n = [((el rem n) + n) rem n \\ el <- l]
// count the number of elements with each mod equivalency
equiv_class_count l n = [length [m \\ m <- list_modulus l n | m == c] \\ c <- [0..n]]
// for every modulus, take where there are only two quantities of mod class members
f l=[n \\ n <- [2..maximum_modulus l] | length (removeDup (equiv_class_count l n)) < 3]

Try it online!

Husk, 13 bytes
f₅⁰…2ṁa⁰
Λ≈k%

Try it online!

R, 75 72 bytes
function(L){for(x in 2:(max(L)-min(L)))F=c(F,!sd(table(L%%x)))
which(F)}

Try it online!
Uses table to compute the counts of each integer modulo x. The standard deviation sd of a set of numbers is zero iff they are all equal, and positive otherwise. Hence !sd(table(L%%x)) is TRUE wherever L is mod-balanced mod x and false otherwise. These values are then concatenated into F.
which then returns the indices of true values from the function. Since R uses 1-based indexing and F is initially a length-one vector with value FALSE, this will correctly return values beginning with 2.
One might expect the builtin function range to compute the range of a dataset, i.e., max(D)-min(D), but sadly it computes and returns the vector c(min(D), max(D)).

MATL,  19 bytes
-4 bytes thanks to Luis Mendo!
S5L)d:Q"G@\8#uZs~?@

Try it online!
Port of my answer in R.
Suppose we have input [12,12,-4,20]
         # (implicit input), stack: [12,12,-4,20]
S        # sort the list, stack: [-4, 12, 12, 20]
5L       # push [1 0], stack: [[-4, 12, 12, 20]; [1 0]]
)        # 1-based modular index, stack: [-4, 20]
d        # successive differences, stack: [24]
:        # generate 1:(max(data)-min(data)), stack: [[1...24]]
Q        # increment to start at 2, stack: [[2...25]]
"        # for each element in [2...25]
 G       # push input, stack: [[12,12,-4,20]]
 @       # push loop index, stack: [[12,12,-4,20], 2]
 \       # compute modulo, stack: [[0,0,0,0]]
 8#      # use alternate output spec, unique has 4 outputs, so 8 keeps only the 4th
 u       # unique. 4th output is the counts of each unique value, stack: [4]
 Zs      # compute standard deviation, stack: [0]
 ~       # logical negate, stack: [T]
 ?       # if true,
  @      # push loop index
         # (implicit end of if)
         # (implicit end of for loop)
         # (implicit output of stack as column vector

You can shorten a little using S5L)d instead of X>GX<- and 8#u instead of FFFT#u

@LuisMendo I couldn't figure out how to push [1 0] (but I knew it was possible) so 5L is handy, and I*still* really need to go and properly read the docs for #` :( but thank you!

For #, specifying a number greater than the maximum number of outputs just selects individual outputs. With function u the maximum is 4,  so 5#u is T#u, 6#u is FT#u etc.

Jelly, 12 bytes
⁹%LƙE
ASḊçÐf

Try it online!
Thanks to user202729 for saving a byte and to Martin Ender (indirectly) for saving a byte.
How it works
⁹%LƙE ~ Helper link. Let's call the argument N.

⁹%    ~ Modulo the input by N (element-wise).
  Lƙ  ~ Map with length over groups formed by consecutive elements.
    E ~ All equal?

ASḊçÐf ~ Main link.

AS     ~ Absolute value of each, sum.
  Ḋ    ~ Dequeue (create the range [2 ... ^]).
   çÐf ~ Filter by the last link called dyadically.

A one-liner alternative 12-byter can be tried online!

I delete my answer because it's redundant now. Thanks Martin for AS (Sum of Absolutes) too.

As a reference for future readers, I clarified why ḟ0 is not needed in chat.

Python 3, 120 102 bytes
Not pretty golfy.
-18 bytes thanks to Mr. Xcoder.
f=lambda a,i=2:[]if i>max(a)-min(a)else(len({*map([k%i for k in a].count,range(i)),0})<3)*[i]+f(a,i+1)

Try it online!

APL (Dyalog), 43 41 38 30 bytes
The ⍨s in the code tells the whole story.
8 bytes saved thanks to @Adám
∊x⊆⍨1=⊂(≢∘∪1⊥|∘.=|)¨⍨x←1+∘⍳1⊥|

Try it online!

Train + Depth→Rank, 30 bytes: ∊x⊆⍨1=⊂(≢∘∪1⊥|∘.=|)¨⍨x←1+∘⍳1⊥|

JavaScript (ES6), 117 bytes
Outputs a space-separated list of values.
a=>(g=m=>a.map(n=>x[k=(z|=m/2<n|m/2<-n,n%m+m)%m]=-~x[k],y=z=0,x=[])|z?(x.some(x=>x-(y?y:y=x))?'':m+' ')+g(m+1):'')(2)

Test cases

let f =

a=>(g=m=>a.map(n=>x[k=(z|=m/2<n|m/2<-n,n%m+m)%m]=-~x[k],y=z=0,x=[])|z?(x.some(x=>x-(y?y:y=x))?'':m+' ')+g(m+1):'')(2)

console.log(f([1,1,2])) // []
console.log(f([1,1,5])) // [2,4]
console.log(f([1,1,24])) // [23]
console.log(f([1,2,3,2])) // [2]
console.log(f([12,12,-4,20])) // [2,3,4,6,8,12,24]
console.log(f([1,1,12,12,-3,7])) // [3,10]
console.log(f([-1,2,2,1,2,7,1,4])) // [2,3]
console.log(f([4,-17,-14,-18,-18,3,5,8])) // []
console.log(f([-18,0,-6,20,-13,-13,-19,13])) // [2,4,19]
console.log(f([-11,-19,-19,3,10,-17,13,7,-5,16,-20,20])) // []
console.log(f([3,0,1,5,3,-6,-16,-20,10,-6,-11,11])) // [2,4]
console.log(f([-18,-20,14,13,12,-3,14,6,7,-19,17,19])) // [2,3]
console.log(f([-16,-9,6,13,0,-17,-5,1,-12,-4,-16,-4])) // [3,9]
console.log(f([-97,-144,3,53,73,23,37,81,-104,41,-125,70,0,111,-88,-2,25,-112,54,-76,136,-39,-138,22,56,-137,-40,41,-141,-126])) // [2,3,6]

Clojure, 91 bytes
#(for[i(range 2(apply +(map * % %))):when(apply =(vals(frequencies(for[j %](mod j i)))))]i)

Using frequencies isn't ideal in code golf.

J, 38 bytes
[:}.@I.([:i.1#.|)(1=1#.[:~:|#/.])"0 1]

Credit goes to Mr. Xcoder for the sum of absolute values trick.
Edit in a TIO link if you want -- I've golfed this in a bit of a hurry.
Explanation and TIO link coming soon(ish).