Skip to main content
deleted 75 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

Java 8, 151 111 110 101101 98 bytes

n->{int r=0,x=10000,i;for(;x-->0;r-=i-n>>-1)for(i=x;i-->1;)if>1&&(x>=i*i&x%i<1){x<i*i|x%i>0||(i=x/i-i;break;}returni)>i););return r;}

-10 bytes thanks to @Nevay.
-3 bytes thanks to @ceilingcat.

Try it here.Try it here.

n->{                  // Method with integer as parameter and return-type
  int r=0,            //  Result-integer, starting at 0
      x=10000,        //  Index-integer `x` for the outer loop, starting at 10,000
      i;              //  Another indexIndex-integer `i` for the inner loop, uninitialized
  for(;x-->0;         //  Loop (1)`x` fromin 10,000the downrange to(10000, 00]:
      r-=i-n>>-1)     //   If the MaxMin-Divisor Pair's difference is lower than the input,
                      //    add 1 to the result (after every iteration)
    for(i=x,       //   Set `i` to `x`
        ii=x;i-->1;)>1     //   Inner loop (2)`i` fromin `i`the downwardsrange to(`x`, 11]:
      if  &&(x>=i*ix<i*i      //    If the current square-root of `x``i` is smaller than or equalequals to `i``x`,
         &x%i<1){  |x%i>0     //    and if the current `x` is divisible by `i`:
           ||(i=x/i-i;   i)//     Calculate the MaxMin-Division difference
        break;}    //     And leave the inner loop (2>i)
                ;);   //   End of inner loop (2)And (implicitstop /the single-lineinner body)loop
        return r;}          //  End of loop (1) (implicit / single-lineAfter body)
the loops, return r;        //  Return the result
}                  // End of method

Java 8, 151 111 110 101 bytes

n->{int r=0,x=10000,i;for(;x-->0;r-=i-n>>-1)for(i=x;i-->1;)if(x>=i*i&x%i<1){i=x/i-i;break;}return r;}

-10 bytes thanks to @Nevay.

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 (1) from 10,000 down to 0
      r-=i-n>>-1)  //   If the MaxMin-Divisor Pair's difference is lower than the input,
                   //    add 1 to the result (after every iteration)
    for(i=x,       //   Set `i` to `x`
        i-->1;)    //   Inner loop (2) from `i` downwards to 1
      if(x>=i*i    //    If the current square-root of `x` is smaller than or equal to `i`,
         &x%i<1){  //    and if the current `x` is divisible by `i`:
        i=x/i-i;   //     Calculate the MaxMin-Division difference
        break;}    //     And leave the inner loop (2)
                   //   End of inner loop (2) (implicit / single-line body)
                   //  End of loop (1) (implicit / single-line body)
  return r;        //  Return the result
}                  // End of method

Java 8, 151 111 110 101 98 bytes

n->{int r=0,x=10000,i;for(;x-->0;r-=i-n>>-1)for(i=x;i-->1&&(x<i*i|x%i>0||(i=x/i-i)>i););return r;}

-10 bytes thanks to @Nevay.
-3 bytes thanks to @ceilingcat.

Try it here.

n->{                  // Method with integer as parameter and return-type
  int r=0,            //  Result-integer, starting at 0
      x=10000,        //  Index-integer `x` for the outer loop, starting at 10,000
      i;              //  Index-integer `i` for the inner loop, uninitialized
  for(;x-->0;         //  Loop `x` in the range (10000, 0]:
      r-=i-n>>-1)     //   If the MaxMin-Divisor Pair's difference is lower than the input,
                      //    add 1 to the result (after every iteration)
    for(i=x;i-->1     //   Inner loop `i` in the range (`x`, 1]:
        &&(x<i*i      //    If the current square of `i` is smaller than or equals to `x`,
           |x%i>0     //    and the current `x` is divisible by `i`:
           ||(i=x/i-i)//     Calculate the MaxMin-Division difference
             >i););   //     And stop the inner loop
  return r;}          //  After the loops, return the result
Commonmark migration
Source Link

#Java 8, 151 111 110 101 bytes

Java 8, 151 111 110 101 bytes

n->{int r=0,x=10000,i;for(;x-->0;r-=i-n>>-1)for(i=x;i-->1;)if(x>=i*i&x%i<1){i=x/i-i;break;}return r;}

-10 bytes thanks to @Nevay.

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 (1) from 10,000 down to 0
      r-=i-n>>-1)  //   If the MaxMin-Divisor Pair's difference is lower than the input,
                   //    add 1 to the result (after every iteration)
    for(i=x,       //   Set `i` to `x`
        i-->1;)    //   Inner loop (2) from `i` downwards to 1
      if(x>=i*i    //    If the current square-root of `x` is smaller than or equal to `i`,
         &x%i<1){  //    and if the current `x` is divisible by `i`:
        i=x/i-i;   //     Calculate the MaxMin-Division difference
        break;}    //     And leave the inner loop (2)
                   //   End of inner loop (2) (implicit / single-line body)
                   //  End of loop (1) (implicit / single-line body)
  return r;        //  Return the result
}                  // End of method

#Java 8, 151 111 110 101 bytes

n->{int r=0,x=10000,i;for(;x-->0;r-=i-n>>-1)for(i=x;i-->1;)if(x>=i*i&x%i<1){i=x/i-i;break;}return r;}

-10 bytes thanks to @Nevay.

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 (1) from 10,000 down to 0
      r-=i-n>>-1)  //   If the MaxMin-Divisor Pair's difference is lower than the input,
                   //    add 1 to the result (after every iteration)
    for(i=x,       //   Set `i` to `x`
        i-->1;)    //   Inner loop (2) from `i` downwards to 1
      if(x>=i*i    //    If the current square-root of `x` is smaller than or equal to `i`,
         &x%i<1){  //    and if the current `x` is divisible by `i`:
        i=x/i-i;   //     Calculate the MaxMin-Division difference
        break;}    //     And leave the inner loop (2)
                   //   End of inner loop (2) (implicit / single-line body)
                   //  End of loop (1) (implicit / single-line body)
  return r;        //  Return the result
}                  // End of method

Java 8, 151 111 110 101 bytes

n->{int r=0,x=10000,i;for(;x-->0;r-=i-n>>-1)for(i=x;i-->1;)if(x>=i*i&x%i<1){i=x/i-i;break;}return r;}

-10 bytes thanks to @Nevay.

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 (1) from 10,000 down to 0
      r-=i-n>>-1)  //   If the MaxMin-Divisor Pair's difference is lower than the input,
                   //    add 1 to the result (after every iteration)
    for(i=x,       //   Set `i` to `x`
        i-->1;)    //   Inner loop (2) from `i` downwards to 1
      if(x>=i*i    //    If the current square-root of `x` is smaller than or equal to `i`,
         &x%i<1){  //    and if the current `x` is divisible by `i`:
        i=x/i-i;   //     Calculate the MaxMin-Division difference
        break;}    //     And leave the inner loop (2)
                   //   End of inner loop (2) (implicit / single-line body)
                   //  End of loop (1) (implicit / single-line body)
  return r;        //  Return the result
}                  // End of method
added 5 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

#Java 8, 151 111 110 101 bytes

n->{int r=0,x=10000,i;for(;x-->0;r-=i-n>>-1)for(i=x;i-->1;)if(x>=i*i&x%i<1){i=x/i-i;break;}return r;}

-10 bytes thanks to @Nevay.

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 (1) from 10,000 down to 0
      r-=i-n>>-1)  //   If the MaxMin-Divisor Pair's difference is lower than the input,
                   //    add 1 to the result (after every iteration)
    for(i=x,       //   Set `i` to `x`
        i-->1;)    //   Inner loop (2) from `i` downwards to 1
      if(x>=i*i    //    If the current square-root of `x` is largersmaller than or equal thanto `i`,
         &x%i<1){  //    and if the current `x` is divisible by `i`:
        i=x/i-i;   //     Calculate the MaxMin-Division difference
        break;}    //     And leave the inner loop (2)
                   //   End of inner loop (2) (implicit / single-line body)
                   //  End of loop (1) (implicit / single-line body)
  return r;        //  Return the result
}                  // End of method

#Java 8, 151 111 110 101 bytes

n->{int r=0,x=10000,i;for(;x-->0;r-=i-n>>-1)for(i=x;i-->1;)if(x>=i*i&x%i<1){i=x/i-i;break;}return r;}

-10 bytes thanks to @Nevay.

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 (1) from 10,000 down to 0
      r-=i-n>>-1)  //   If the MaxMin-Divisor Pair's difference is lower than the input,
                   //    add 1 to the result (after every iteration)
    for(i=x,       //   Set `i` to `x`
        i-->1;)    //   Inner loop (2) from `i` downwards to 1
      if(x>=i*i    //    If the current square-root of `x` is larger or equal than `i`,
         &x%i<1){  //    and if the current `x` is divisible by `i`:
        i=x/i-i;   //     Calculate the MaxMin-Division difference
        break;}    //     And leave the inner loop (2)
                   //   End of inner loop (2) (implicit / single-line body)
                   //  End of loop (1) (implicit / single-line body)
  return r;        //  Return the result
}                  // End of method

#Java 8, 151 111 110 101 bytes

n->{int r=0,x=10000,i;for(;x-->0;r-=i-n>>-1)for(i=x;i-->1;)if(x>=i*i&x%i<1){i=x/i-i;break;}return r;}

-10 bytes thanks to @Nevay.

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 (1) from 10,000 down to 0
      r-=i-n>>-1)  //   If the MaxMin-Divisor Pair's difference is lower than the input,
                   //    add 1 to the result (after every iteration)
    for(i=x,       //   Set `i` to `x`
        i-->1;)    //   Inner loop (2) from `i` downwards to 1
      if(x>=i*i    //    If the current square-root of `x` is smaller than or equal to `i`,
         &x%i<1){  //    and if the current `x` is divisible by `i`:
        i=x/i-i;   //     Calculate the MaxMin-Division difference
        break;}    //     And leave the inner loop (2)
                   //   End of inner loop (2) (implicit / single-line body)
                   //  End of loop (1) (implicit / single-line body)
  return r;        //  Return the result
}                  // End of method
-9 bytes
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384
Loading
added 41 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384
Loading
added 63 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384
Loading
deleted 552 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384
Loading
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384
Loading