[Question]
  [
A [superabundant number](https://en.wikipedia.org/wiki/Superabundant_number) is an integer *n* that sets a new upper bound for its ratio with the [divisor sum function](https://en.wikipedia.org/wiki/Divisor_function) σ. In other words, *n* is superabundant if and only if, for all positive integers *x* that are less than *n*:
$$\frac{\sigma(n)}n>\frac{\sigma(x)}x$$
For a few of the values:
```
n   σ(n)   σ(n)/n   superabundant
1   1      1.0000   yes
2   3      1.5000   yes
3   4      1.3333   no
4   7      1.7500   yes
5   6      1.2000   no
6   12     2.0000   yes
7   8      1.1429   no
8   15     1.8750   no
9   13     1.4444   no
```
A longer list of these (for test cases) can be found at [OEIS A004394](https://oeis.org/A004394).
One *highly recommended* negative test case (if your interpreter can handle it) is 360360, because it ties with the last superabundant number.
# Challenge
Your program should take in a single positive integer, and output a truthy or falsey value representing whether that integer is superabundant.
As this is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), the shortest answer in bytes wins.
  
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 7 bytes
```
Æs÷$ÞṪ=
```
[Try it online!](https://tio.run/##AS8A0P9qZWxsef//w4Zzw7ckw57huao9/zEwMMK1LMOHJGrigJwgLT4g4oCdwrXigqxZ/w "Jelly – Try It Online")
# [Jelly](https://github.com/DennisMitchell/jelly), 8 bytes
```
Æs÷$ÐṀ⁼W
```
[Try it online!](https://tio.run/##y0rNyan8//9wW/Hh7SqHJzzc2fCocU/4////jUwA "Jelly – Try It Online")
[Test Suite!](https://tio.run/##ATIAzf9qZWxsef//w4Zzw7ckw5DhuYDigbxX/zEwMMK1LMOHJGrigJwgLT4g4oCdwrXigqxZ/w "Jelly – Try It Online")
### Explanation
```
Æs÷$ÐṀ⁼W ~ Full program (monadic).
    ÐṀ   ~ Keep the elements with maximal link value (auto-rangifies).
Æs       ~ Divisor sum.
  ÷$     ~ Divide by the current element.
      ⁼W ~ Check equality with the input wrapped into a singleton.
         ~ (for integers like 360360)
```
[Answer]
# [Haskell](https://www.haskell.org/), 73 bytes
*-1 byte thanks to Mr. Xcoder. -7 bytes thanks to Laikoni.*
```
r=read.show
s n=sum[r i|i<-[1..n],n`mod`i<1]/r n
f n=all((s n>=).s)[1..n]
```
[Try it online!](https://tio.run/##JcqxDkAwEADQvV9xg4GEE4tJ/YhINEFctFe5Ixb/XhJvfpvTffE@JbGyuBl1i7dRYKtXGATooa4aGkQeS55CnCfqmrEWYLN@yXmf59/ubYFa/C8FRwwWDiE@IYMV2vQC "Haskell – Try It Online")
Haskell's type system isn't very golfy...
[Answer]
# [Haskell](https://www.haskell.org/), ~~64~~ ~~63~~ 61 bytes
**-1** byte thanks to [Mr. Xcoder](https://codegolf.stackexchange.com/users/59487/mr-xcoder).
**-2** bytes thanks to [Lynn](https://codegolf.stackexchange.com/users/3852/lynn).
```
a!x=a*sum[y|y<-[1..x],mod x y<1]
f n=and[x!n>n!x|x<-[1..n-1]]
```
[Try it online!](https://tio.run/##JcpBCoMwEAXQfU/xA11JlWRveoOeIAxlQIOhyVTUwgS8e0rpW7@F99ecc2ts1HO3f0qoZx374IZB6VbeExR1dHSJEM8yBTVyF6On/pP0jqgVTgKPwuvjiXVLcuCKmPIxb4j4PWetpfYF "Haskell – Try It Online")
[Answer]
# [Octave](https://www.gnu.org/software/octave/), 41 bytes
```
@(n)([~,p]=max((x=1:n)*~mod(x,x')./x))==n
```
[**Try it online!**](https://tio.run/##y08uSSxL/Z9mq6en999BI09TI7pOpyDWNjexQkOjwtbQKk9Tqy43P0WjQqdCXVNPv0JT09Y2739afpFCHlDWkksBCNKA@rhS81L@AwA)
### Explanation
```
@(n)                                       % Define anonymous function of n
                x=1:n                      % Range from 1 to n. Call that x
                        mod(x,x')          % n×n matrix of all pair-wise moduli
                       ~                   % Logical negate. True means it's a divisor
               (     )*                    % Matrix-multiply x times the above matrix
                                           % (gives the dot product of vector x times
                                           % each column of the matrix)
                                 ./x       % Divide each column by each entry in x
     [~,p]=max(                     )      % Index of first occurrence of maximum
    (                                )==n  % Does it equal n?
```
[Answer]
# [J](http://jsoftware.com/), 35 bytes
Thanks to Mr.Xcoder for finding the problem and to cole for fixing it!
```
[:([:*/{:>}:)@(%~>:@#.~/.~&.q:)1+i.
```
[Try it online!](https://tio.run/##NYc7CoAwEAX7nOKh@InKukaIsKB4D0vx24i1mKtHm8AMzJx@6wWMXz9JPklRPzK8osc8cYOMMbmaXEq36KY8yGsVEbK1pwwVXsGm1DLvF1bYEI2xjDCm6wxzuNbyj/8A "J – Try It Online")
[Answer]
# [Julia 0.6](http://julialang.org/), 52 bytes
```
n->indmax(sum(x for x=1:m if m%x<1)//m for m=1:n)==n
```
[Try it online!](https://tio.run/##HchBCoMwEAXQvaf4iIWZRZFshErjXQQNjDi/ohVy@9S6fG85Vxu7kmLhczBOPmY5TpeM9NmRY@gdluCP/A7atn63X02NkeUvwojQvypg243flVI3RCNJqFprNXMqPw "Julia 0.6 – Try It Online")
This solution uses rational numbers to ensure correctness in case of equality. 
(Testing 360360 took almost 10 minutes.)
Using floating point, 2 bytes can be saved with the left divide:
```
n->indmax(m\sum(x for x=1:m if m%x<1)for m=1:n)==n
```
[Answer]
# [Pyth](https://pyth.readthedocs.io), 14 bytes
([FryAmTheEggman](https://codegolf.stackexchange.com/users/31625/fryamtheeggman) saved 1 byte)
```
qh.Mcs*M{yPZZS
```
**[Try it here!](https://pyth.herokuapp.com/?code=qh.Mcs%2aM%7ByPZZS&input=20&test_suite=0&test_suite_input=1%0A2%0A3%0A4%0A5%0A6%0A20%0A24&debug=0)** or **[see more test cases.](https://pyth.herokuapp.com/?code=qh.Mcs%2aM%7ByPZZS&input=20&test_suite=1&test_suite_input=1%0A2%0A3%0A4%0A5%0A6%0A20%0A24&debug=0)**
Just my mandatory Pyth submission which is most likely golfable.
### How?
```
qh.Mcs*M{yPZZS ~ Full program. Q = input.
             S ~ The integers in the range [1, Q].
  .M           ~ Get the elements with maximal function value.
    cs*M{yPZZ  ~ Key function: uses a variable Z.
         yPZ      ~ The powerset of the prime factors of Z.
        {         ~ Deduplicated.
      *M          ~ Product of each.
     s            ~ And summed.
    c       Z     ~ Divided by Z.
 h             ~ First element.
q              ~ Check equality with the input. Outputs either True or False.
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 10 bytes
```
LÑOā/ZQ¨_P
```
[Try it online!](https://tio.run/##MzBNTDJM/f/f5/BE/yON@lGBh1bEB/z/bwYA "05AB1E – Try It Online")
or as a [Test suite](https://tio.run/##MzBNTDJM/W/pU1b53@fwRP8jjfpRgYdWxAf8r1Q6vN9K4fB@JR3NmP8A)
**Explanation**
```
L            # push range [1 ... input]
 Ñ           # divisors of each
  O          # sum of each
   ā/        # divide each by its 1-based index
     Z       # get max
      Q      # compare to each
       ¨     # remove the last element
        _    # logical negation
         P   # product
```
[Answer]
# [Python 3](https://docs.python.org/3/), 77 bytes
*-1 byte thanks to Rod. -3 bytes thanks to Dennis.*
```
lambda n:max(range(1,n+1),key=lambda k:sum((k%i<1)/i for i in range(1,k)))==n
```
[Try it online!](https://tio.run/##NctBCoAgEADAr@wl2CUhJOgg@ZMuRlmLuYUV5OvtUudhjnytu7TF26FsLo6TAzHRPZicLDNqJbUmFeZsPw3mvCNiqLjX1DD4PQEDC/whEJG1Uo7EcqHHjqi8 "Python 3 – Try It Online")
[Answer]
# R using `numbers`, 59 bytes
```
f=function(n)which.max(sapply(1:n,numbers::Sigma)/(1:n))==n
```
[Answer]
# Mathematica, ~~53~~ 50 bytes
```
a=Tr@Divisors@#/#&;AllTrue[a@#-Array[a,#-1],#>0&]&
```
Pure function. Takes an integer as input and returns `True` or `False` as output.
[Answer]
# [APL (Dyalog)](https://www.dyalog.com/), 33 bytes
```
{⍵=⊃⌽+⌿∘.≤⍨((+/⍳(/⍨)0=⍳|⊢)÷⊢)¨⍳⍵}
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///P@1R24TqR71bbR91NT/q2av9qGf/o44Zeo86lzzqXaGhoa3/qHezBpBYoWlgC2TWPOpapHl4O4g8tALIB@qs/f8/XwGkQiFN4dAKhXwFoIkKQCkLEwMA)
[Answer]
# [Husk](https://github.com/barbuz/Husk), 9 bytes
```
εü<m§ṁ/Ḋṫ
```
[Try it online!](https://tio.run/##AUQAu/9odXNr/yBtKHPigoFyKcK2/861w7w8bcKn4bmBL@G4iuG5q////zEKMgozCjQKNQo2CjcKOAo5CjEwCjYwCjgwCjM2MA "Husk – Try It Online")
Too slow for the 360360 test case.
## Explanation
```
εü<m§ṁ/Ḋṫ  Implicit input, say n=6.
        ṫ  Decreasing range: [6,5,4,3,2,1]
   m       Map this function (example argument k=4):
       Ḋ    Divisors of k: [1,2,4]
    §ṁ      Map and sum
      /     division by k: 7/4
           Result: [2,6/5,7/4,4/3,3/2,1]
 ü         Remove duplicates by
  <        strict comparison. This greedily extracts a non-decreasing subsequence: [2]
ε          Is it a singleton list? Yes.
```
[Answer]
# Japt v2.0a0, ~~12~~ 16 bytes
Sleep deprived brain can't seem to improve on this any further!
Returns `1` for truthy or `0` for falsey.
```
Æâ x÷U >Xâ x÷XÃ×
```
[Try it](https://ethproductions.github.io/japt/?v=2.0a0&code=xuIgePdVID5Y4iB491jD1w==&input=OA==)
Sacrificed 4 bytes to handle `360360`.
---
## Explanation
* Implicit input of integer `U`.
* `Æ Ã` creates an array of integers from `0` to `U-1` and passes each through the following function as `X`.
* `â` gets the divisors of `U`.
* `÷U` divides each of those by `U`.
* `x` sums the results.
* `Xâ` gets the divisors of `X`.
* `÷X` divides each of those by `X`.
* `x` sums the results.
* `>` checks if the first result is greater than the second.
* `×` reduces the resulting array of booleans by multiplcation.
[Answer]
# APL+WIN, 37 bytes
```
 ↑1=⍒⌽(+/¨((0=(⍳¨n)|¨n)×⍳¨n)~¨⊂0)÷n←⍳⎕
```
Prompts for screen input.
[Answer]
# C (gcc), 99 bytes
```
s(n,j,k){for(j=k=0;j++<n;)k+=n%j?0:j;n=k;}f(n,i,r){for(i=r=0;++i<n;)r=1.*s(n)/n<1.*s(i)/i?:r;r=!r;}
```
[Try it online!](https://tio.run/##JY7BDoJADETvfEUlIdm6q8CV0vAjXgwEs0uspnojfPtacE7NzJtJx8tjHHP@OAkpLLjOL3WJF24oed8L4eJZqjQ0XSLhhbbZyBj0T0ZWI72PO6ncXs82hLX0xxWxjkOnpHxS2nKULzzvURwWawEmWwC3u8ItgZUaAu8Fj3DXWy2dXVlNHVTTTcoAEsA@QKRiyz8)
# C, 108 bytes
```
float s(n,j,k){for(j=k=0;j++<n;)k+=n%j?0:j;return k;}f(n,i,r){for(i=r=0;++i<n;)s(n)/n<s(i)/i&&++r;return!r;}
```
[Try it online!](https://tio.run/##LY3BDoIwEETvfMVKAulma4CrS@OPeCFgTVtcTMET4duxqHOceTPTn/uxk8e@23HqFpiVaK8DrnaKyptgavZErTAGMlL4a33xHO/LOwoE3mzCnY4/3JmYcCJ34GkIK2ln5bByZUkU/7VT5G13ssCzc6IwWzNISn1QhyumYZC2qRmIBL/hoVdMqVV5MVygGG6SaxAN6R@Rs23/AA)
[Answer]
# [Swift](https://swift.org), ~~120~~ 118 bytes
```
let s={n in Float((1...n).reduce(0){n%$1>0 ?$0:$0+$1})}
{n in(1..<n).reduce(0){max($0,s($1)/Float($1))}<s(n)/Float(n)}
```
Takes some time (around 6 seconds on TIO) to compile because of the implicit type declarations in Swift.
[Try it online!](https://tio.run/##Vc3BCsIwEATQu1@xlAi7WGMCnmqtN/8jaAKBui1JRKHk26OhePA2DLyZ@PIuHUsZbYJ4Xhg8w3WcTELUUkomGez9ebOoaOGt0IOCi1CdUDuhM@VNdW51FfR/4GHeKFQbUWg6rKvfRLmPyL@CKRc3BfD1uV5qtczBc0LfOvTURjubYNIUugb2AzR0yuUD)
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 12 bytes
```
RÆs©Ṫ×R>®×$Ạ
```
[Try it online!](https://tio.run/##ASIA3f9qZWxsef//UsOGc8Kp4bmqw5dSPsKuw5ck4bqg////MTIw) or [Find all superabundant numbers below 1000.](https://tio.run/##ASUA2v9qZWxsef//UsOGc8Kp4bmqw5dSPsKuw5ck4bqg/8i3w4fDkGb/ "Jelly – Try It Online")
because I hate floating points.
[Answer]
# [Funky](https://github.com/TehFlaminTaco/Funky), 79 bytes
```
d=n=>fors=i=0i<=n i++s+=i*!n%i
f=n=>{forc=1c<n c++if(d(n)/n)<=d(c)/c return0 1}
```
## Explained
This first defines the function `d` which is the `σ` function, and this is the golfed version of
```
function d(n){
    var s = 0;
    for(var i=0; i<n; i++){
        if(n%i == 0){
            s += i;
        }
    }
    return s;
}
```
We can set i to 0, because `i*n%0` will always equal `0*...`, thus `0`.
The next half of this defines the function `f`, which is the Superabandunce function, and it is just the golfed form of
```
function f(n){
    for(var c=1; c<n; c++){
        if( (d(n)/n) <= (d(c)/c) ){
            return 0;
        }
    }
    return 1;
}
```
And this just checks, as the challenge spec suggests, that all integers from 1 to n-1 have a `d(n)/n` of less than the input.
[Try it online!](https://tio.run/##FcrBCsIwDADQs/2KOBBaM1h7b/wSL5JaSIUoXTeQsW@v8/xeXvT17T2R0i2/60xCXiIpCOKMJNezXsTkP2@HMwWOCowo2SarblIXKVl2E0N9tqWqh7D3o8L6qFAoQInBQ0HczOlTRZstIwz3NoyQbXHO7P0H "Funky – Try It Online")
[Answer]
# Perl 5, 84 bytes
```
say!grep$a[-1]<=$a[$_],0..(@a=map{$i=$_;my$j;map{$i%$_ or$j+=$_/$i}1..$i;$j}1..<>)-2
```
requires `-E` (free)
a straightforward implementation of the specification, golfed
[Answer]
# APL(NARS), 61 chars, 122 bytes
```
r←f w;m;k
r←m←0
r+←1⋄k←r÷⍨11πr⋄→3×⍳r≥w⋄→2×⍳∼m<k⋄m←k⋄→2
r←k>m
```
11π is the function sum of factors
```
  (⍳9),¨ f¨1..9
1 1  2 1  3 0  4 1  5 0  6 1  7 0  8 0  9 0 
  f 360360
0
```
]