# Spiking Neural P Systems for Basic Arithmetic Operations
## 3 Arithmetic Operation in Spiking Neural P Systems
### Binary Division in SNP Systems
[17; 31] used spike sequence encoding and two input neurons, meaning that the two operands do not need to be stored in the provided system, ensuring that the number of neurons used by addition and subtraction operations is constant and the calculation consumes a number of time slices k + 1 (or k + 2). The difference between the multiplication of [29] and [15] is that in [29] a multiplier is fixed to 26, while in [31] both multipliers can be input by input neurons, meaning that there is a significant number difference between the neurons and the time slices of consumption. Neither [29] nor [31] provide an SNPS for the division operation. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Article** & **Input Type** & **Encoding** & **Add** & **Sub** & **Mut** & **Div** & **Rule Types** \\ \hline
[28] & multiple inputs & time interval & **10/-** & **12/-** & **21/-** & **25/-** & 4/4/12/15 \\
[35] & multiple inputs & time-free & 2/- & 2/- & 11/- & 10/- & 2/6/15/16 \\
[29] & multiple inputs & spike train & 3/(k + 1) & 10/(k + 2) & 13/(k + 7) & -/-/ & 3/6/3/- \\
[31] & multiple inputs & spike train & 7/(k + 2) & 7/(k + 2) & (k2 + 5)/ & -/- & 6/6/6-/ \\
[30] & single input & spike train & (3k + 5)/(3k + 4) & -/- & (k2 + 5k + 3)/(4k + 2) & -/- & 9/-/-/10/- \\
[36] & single input & spike train & (2k + 4)/(3k + 1) & -/- & 5k/(3k + 5) & -/- & (5k + 1)/- \\ This & & single input & spike train & (k + 8)/(2k + 4) & (k + 13)/(2k + 3) & (3k + 8)/(3k + 5) & (4k + quotient + 4) & 6/11/9/29 \\ \hline \hline \end{tabular} Note: A/B, A represents the number of neurons used, B represents the number of time slices required for the operation. C/D/E/F, C represents the number of rules used for addition. Similarly, D, E, and F denote the number of rules used for subtraction, multiplication, and division, respectively.  
\end{table} 
Table 5: The number of neurons, time slices required, and number of rule types used for four arithmetic approaches. The work in [30; 36] and in this paper, all of which employ spike sequence encoding and one input neuron, are comparable. Because the SNPS in this paper only saves the first operand, the calculation starts when the second operand arrives, which time improves the parallelism of the relevant neurons in the calculation process. Thus, for the number of neurons used in this paper both the time and computation time are less than the results in [30; 36]. In addition, this paper presents SNPS for subtraction and division operations, which solves the open problem of how to design a divider based on the SNP system proposed in [30]. On the other hand, in the SNPS with one input neuron, the input of two k-bit operands requires 2k spikes; thus, considering the transmission of spikes and the output of calculation results, the basic arithmetic operation SNPS requires at least 2k + 2 time slices, meaning that the SNPS addition and multiplication designed in this paper have reached the optimum in terms of time consumption. Because the first operand of the input needs to be saved, and considering both the input neuron and the calculation neuron, the SNPS needs at least k + 2 neurons; thus, the SNPS addition and multiplication designed in this paper use a number of neurons that is close to optimum. From the above analysis, we can see that, under the same encoding and input approach, the basic arithmetic operation SNPS designed in this paper has obvious advantages.