Is X divisible by Y...

Inputs

  • X
  • Y

Outputs

  • Is X divisible by Y.

Neuron type

Best algorithm has been found - locked

Patterns

Pattern Input Output
1.
X: 12
Y: 3
Is X divisible by Y.: 1
2.
X: 15
Y: 5
Is X divisible by Y.: 1
3.
X: 10
Y: 2
Is X divisible by Y.: 1
4.
X: 3
Y: 2
Is X divisible by Y.: 0
5.
X: 5
Y: 6
Is X divisible by Y.: 0
6.
X: 7
Y: 2
Is X divisible by Y.: 0
7.
X: 30
Y: 10
Is X divisible by Y.: 1

Applicable neurons

  • Division (x ÷ y)
  • 0
  • IF
  • a = b
  • IF a=b THEN c ELSE d
  • Decimal part of a number
  • Validate integer
  • Is it integer?
  • character l
  • Price with VAT
  • Price without VAT
  • Width of persons

Algorithm

Test

Code made by AI:
/**
 * Division (x ÷ y): X / Y
 *
 * @param x1 first number
 * @param x2 second number
 * @return {Array}
 */
function neuron17(x1, x2)
{
math.config({number: 'BigNumber', precision: 64}); return [math.eval(Number(x1) + '/'+Number(x2)).toString()];
}

/**
 * character .: 
 *
 * @return {Array}
 */
function neuron510()
{
return['.'];
}

/**
 * character .: 
 *
 * @return {Array}
 */
function neuron510()
{
return['.'];
}

/**
 * Connect - two inputs: 
 *
 * @param x1 Variable A
 * @param x2 Variable B
 * @return {Array}
 */
function neuron520(x1, x2)
{
return [x1.toString()+x2.toString()];
}

/**
 * Connect - three inputs: Connect stringA + stringB + stringC
 * 
 * @param x1 string A
 * @param x2 string B
 * @param x3 string C
 * @return {Array}
 */
function neuron564(x1, x2, x3)
{
  var outputs = [];
  outputs[0] = x1;
  outputs[1] = x2;
  outputs[2] = x3;

  arr = neuron520(outputs[1], outputs[2]);
  outputs[3] = arr[0];

  arr = neuron520(outputs[0], outputs[3]);
  outputs[4] = arr[0];

  return[outputs[4]];
}


/**
 * Length of string: 
 *
 * @param x1 String
 * @return {Array}
 */
function neuron528(x1)
{
return[x1.toString().length];
}

/**
 * Length of string: 
 *
 * @param x1 String
 * @return {Array}
 */
function neuron528(x1)
{
return[x1.toString().length];
}

/**
 * Substring (startPosition, endPosition): Get substring from string - from position - to pos
 *
 * @param x1 MyString
 * @param x2 start position
 * @param x3 end position
 * @return {Array}
 */
function neuron525(x1, x2, x3)
{
return[x1.toString().substring(x2, x3)];
}

/**
 * Substring (from position to end): 
 * 
 * @param x1 MyString
 * @param x2 start position
 * @return {Array}
 */
function neuron529(x1, x2)
{
  var outputs = [];
  outputs[0] = x1;
  outputs[1] = x2;

  arr = neuron528(outputs[0]);
  outputs[2] = arr[0];

  arr = neuron525(outputs[0], outputs[1], outputs[2]);
  outputs[3] = arr[0];

  return[outputs[3]];
}


/**
 * Position: Search position substring of string
 *
 * @param x1 MyString
 * @param x2 FindMe
 * @return {Array}
 */
function neuron523(x1, x2)
{
return [x1.toString().indexOf(x2.toString())];
}

/**
 * Get after substring: 
 * 
 * @param x1 MyString
 * @param x2 Substring
 * @return {Array}
 */
function neuron531(x1, x2)
{
  var outputs = [];
  outputs[0] = x1;
  outputs[1] = x2;

  arr = neuron528(outputs[1]);
  outputs[2] = arr[0];

  arr = neuron529(outputs[0], outputs[2]);
  outputs[3] = arr[0];

  arr = neuron523(outputs[0], outputs[1]);
  outputs[4] = arr[0];

  arr = neuron529(outputs[3], outputs[4]);
  outputs[5] = arr[0];

  return[outputs[5]];
}


/**
 * Position: Search position substring of string
 *
 * @param x1 MyString
 * @param x2 FindMe
 * @return {Array}
 */
function neuron523(x1, x2)
{
return [x1.toString().indexOf(x2.toString())];
}

/**
 * 0: 
 *
 * @return {Array}
 */
function neuron500()
{
return [0];
}

/**
 * Substring (startPosition, endPosition): Get substring from string - from position - to pos
 *
 * @param x1 MyString
 * @param x2 start position
 * @param x3 end position
 * @return {Array}
 */
function neuron525(x1, x2, x3)
{
return[x1.toString().substring(x2, x3)];
}

/**
 * Get before substring: 
 * 
 * @param x1 MyString
 * @param x2 Substring
 * @return {Array}
 */
function neuron532(x1, x2)
{
  var outputs = [];
  outputs[0] = x1;
  outputs[1] = x2;

  arr = neuron523(outputs[0], outputs[1]);
  outputs[2] = arr[0];

  arr = neuron500();
  outputs[3] = arr[0];

  arr = neuron525(outputs[0], outputs[2], outputs[3]);
  outputs[4] = arr[0];

  return[outputs[4]];
}


/**
 * 0: 
 *
 * @return {Array}
 */
function neuron500()
{
return [0];
}

/**
 * a = b: IF a=b THEN 1 ELSE 0;
 *
 * @param x1 a
 * @param x2 b
 * @return {Array}
 */
function neuron591(x1, x2)
{
return [(x1 == x2) ? 1 : 0];
}

/**
 * IF: IF a THEN b ELSE c;
 *
 * @param x1 condition (1/0)
 * @param x2 variable for 1
 * @param x3 variable for 0
 * @return {Array}
 */
function neuron579(x1, x2, x3)
{
return [(x1) ? x2 : x3];
}

/**
 * IF a=b THEN c ELSE d: 
 * 
 * @param x1 a
 * @param x2 b
 * @param x3 c
 * @param x4 d
 * @return {Array}
 */
function neuron724(x1, x2, x3, x4)
{
  var outputs = [];
  outputs[0] = x1;
  outputs[1] = x2;
  outputs[2] = x3;
  outputs[3] = x4;

  arr = neuron591(outputs[1], outputs[0]);
  outputs[4] = arr[0];

  arr = neuron579(outputs[4], outputs[2], outputs[3]);
  outputs[5] = arr[0];

  return[outputs[5]];
}


/**
 * empty string change into zero: 
 * 
 * @param x1 any string
 * @return {Array}
 */
function neuron743(x1)
{
  var outputs = [];
  outputs[0] = x1;

  arr = neuron500();
  outputs[1] = arr[0];

  arr = neuron724(outputs[0], outputs[1], outputs[1], outputs[0]);
  outputs[2] = arr[0];

  return[outputs[2]];
}


/**
 * after decimal point: 
 * 
 * @param x1 number with decimal point
 * @return {Array}
 */
function neuron741(x1)
{
  var outputs = [];
  outputs[0] = x1;

  arr = neuron510();
  outputs[1] = arr[0];

  arr = neuron564(outputs[0], outputs[1], outputs[1]);
  outputs[2] = arr[0];

  arr = neuron531(outputs[2], outputs[1]);
  outputs[3] = arr[0];

  arr = neuron510();
  outputs[4] = arr[0];

  arr = neuron532(outputs[3], outputs[1]);
  outputs[5] = arr[0];

  arr = neuron743(outputs[5]);
  outputs[6] = arr[0];

  return[outputs[6]];
}


/**
 * Connect - two inputs: 
 *
 * @param x1 Variable A
 * @param x2 Variable B
 * @return {Array}
 */
function neuron520(x1, x2)
{
return [x1.toString()+x2.toString()];
}

/**
 * decimal part of a number: 
 * 
 * @param x1 number with decimal point
 * @return {Array}
 */
function neuron748(x1)
{
  var outputs = [];
  outputs[0] = x1;

  arr = neuron510();
  outputs[1] = arr[0];

  arr = neuron741(outputs[0]);
  outputs[2] = arr[0];

  arr = neuron520(outputs[1], outputs[2]);
  outputs[3] = arr[0];

  return[outputs[3]];
}


/**
 * Decimal part of a number: 
 * 
 * @param x1 number with decimal point
 * @return {Array}
 */
function neuron750(x1)
{
  var outputs = [];
  outputs[0] = x1;

  arr = neuron748(outputs[0]);
  outputs[1] = arr[0];

  return[outputs[1]];
}


/**
 * Round to an integer: round(x)
 *
 * @param x1 Value
 * @return {Array}
 */
function neuron620(x1)
{
return[Math.round(Number(x1))]
}

/**
 * a = b: IF a=b THEN 1 ELSE 0;
 *
 * @param x1 a
 * @param x2 b
 * @return {Array}
 */
function neuron591(x1, x2)
{
return [(x1 == x2) ? 1 : 0];
}

/**
 * Is it integer?: 
 * 
 * @param x1 Number
 * @return {Array}
 */
function neuron914(x1)
{
  var outputs = [];
  outputs[0] = x1;

  arr = neuron620(outputs[0]);
  outputs[1] = arr[0];

  arr = neuron591(outputs[1], outputs[0]);
  outputs[2] = arr[0];

  return[outputs[2]];
}


/**
 * Is X divisible by Y...: 
 * 
 * @param x1 X
 * @param x2 Y
 * @return {Array}
 */
function neuron911(x1, x2)
{
  var outputs = [];
  outputs[0] = x1;
  outputs[1] = x2;

  arr = neuron17(outputs[0], outputs[1]);
  outputs[2] = arr[0];

  arr = neuron750(outputs[1]);
  outputs[3] = arr[0];

  arr = neuron914(outputs[2]);
  outputs[4] = arr[0];

  arr = neuron750(outputs[3]);
  outputs[5] = arr[0];

  return[outputs[4]];
}


Code made by AI:

Create your family tree for free