# Validate integer

• Value

## Outputs

• Is it integer? (1/0)

## Neuron type

Best algorithm has been found - locked

## Patterns

Pattern Input Output
1.
 Value: 3
 Is it integer? (1/0): 1
2.
 Value: 0
 Is it integer? (1/0): 1
3.
 Value: -5
 Is it integer? (1/0): 1
4.
 Value: a
 Is it integer? (1/0): 0
5.
 Value: 3.5
 Is it integer? (1/0): 0
6.
 Value: 0.9
 Is it integer? (1/0): 0
7.
 Value: 1200
 Is it integer? (1/0): 1
8.
 Value: -561
 Is it integer? (1/0): 1

## Applicable neurons

• 0
• 1
• 2
• 3
• 4
• 5
• 6
• 7
• 8
• 9
• a > b
• a = b
• a < b
• IF a=b THEN c ELSE d
• Contains string substring?
• Half (0.5)
• square/rhombus - Perimeter
• Connect - four inputs
• AND

## Algorithm

### Test

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

/**
* 1:
*
* @return {Array}
*/
function neuron501()
{
return [1];
}

/**
* 4:
*
* @return {Array}
*/
function neuron504()
{
return [4];
}

/**
* 6:
*
* @return {Array}
*/
function neuron506()
{
return [6];
}

/**
* 7:
*
* @return {Array}
*/
function neuron507()
{
return [7];
}

/**
* 8:
*
* @return {Array}
*/
function neuron508()
{
return [8];
}

/**
* 9:
*
* @return {Array}
*/
function neuron509()
{
return [9];
}

/**
* Plus (x + y): The addition of two whole numbers is the total amount of those quantities combined.
*
* @param x1 first number
* @param x2 second number
* @return {Array}
*/
function neuron1(x1, x2)
{
math.config({number: 'BigNumber', precision: 64}); return [math.eval(Number(x1) + '+'+Number(x2)).toString()];
}

/**
* Rectangle - circuit:
*
* @param x1 Side a
* @param x2 Side b
* @return {Array}
*/
function neuron16(x1, x2)
{
var outputs = [];
outputs[0] = x1;
outputs[1] = x2;

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

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

return[outputs[3]];
}

/**
* 2:
*
* @return {Array}
*/
function neuron502()
{
return [2];
}

/**
* 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()];
}

/**
* 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 even?:
*
* @param x1 Number
* @return {Array}
*/
function neuron848(x1)
{
var outputs = [];
outputs[0] = x1;

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

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

arr = neuron620(outputs[2]);
outputs[3] = arr[0];

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

return[outputs[4]];
}

/**
* Validate integer:
*
* @param x1 Value
* @return {Array}
*/
function neuron878(x1)
{
var outputs = [];
outputs[0] = x1;

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

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

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

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

arr = neuron507();
outputs[5] = arr[0];

arr = neuron508();
outputs[6] = arr[0];

arr = neuron509();
outputs[7] = arr[0];

arr = neuron16(outputs[4], outputs[0]);
outputs[8] = arr[0];

arr = neuron848(outputs[8]);
outputs[9] = arr[0];

return[outputs[9]];
}