Skip to main content
2 of 8
deleted 552 characters in body
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

#Java 8, 151 111 bytes

n->{int r=0,x=10000,i;for(;x-->0;r+=i<n?1:0)for(i=(int)Math.sqrt(x);i>0;i--)if(x%i<1){i=x/i-i;break;}return r;}

Explanation:

Try it here.

n->{              // Method with integer as parameter and return-type
  int r=0,        //  Result-integer
      x=10000,    //  Index-integer starting at 10,000
      i;          //  Another index-integer for the inner loop
  for(;x-->0;     //  Loop from 10,000 down to 0
      r+=i<n?     //   If the MaxMin-Divisor Pair's difference is lower than the input:
        1         //    Add 1 to the result
       :          //   Else:
        0)        //    Leave the result the same
    for(i=(int)Math.sqrt(x);
                  //   Set `i` to the square-root of the current `x`
        i>0;i--)  //   Inner loop from `i` downwards to 1
      if(x%i<1){  //    If the current `x` is divisible by `i`:
        i=x/i-i;  //     Calculate the MaxMin-Division difference
        break;    //     And leave the inner loop
      }
                  //  End of loop (implicit / single-line body)
  return r;       //  Return the result
}                 // End of method
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384