# Spiking Neural P Systems for Basic Arithmetic Operations
## 3 Arithmetic Operation in Spiking Neural P Systems
### Binary Division in SNP Systems  
Division is a basic method of arithmetic operation. The basic idea of division operations is to subtract the divisor from the dividend until the remainder is less than the divisor. At present, nobody has proposed an SNPS which encodes numbers as spike sequences for division. The basic idea of the binary division SPNS designed in this paper is as follows:  
1. Through the input neuron, input the binary string of the dividend from the lowest bit to the highest bit. When the \(i\)-th bit (\(0\leq i\leq k-1\)) in the input string is 1, the neuron input gets one spike; otherwise, it does not get one spike. 2. After each digit of the dividend is input, it will be cached in the system. When all digits of the dividend are input, the dividend is stored in the dividend neuron group. Wait for the input of the divisor. Input the divisor immediately after the highest digit of the dividend is input. 3. After the divisor input is completed, save the divisor in the divisor neuron group. After the highest digit of the divisor is input, the control neuron group immediately sends the divisor to the dividend neuron group for subtraction. The stored dividend information in the dividend neuron group will be changed due to the subtraction operation. 4. For each subtraction operation, send a spike to the resulting neuron group. 5. Continue to carry out (4) in parallel until the highest bit of the dividend neuron group sends a borrow message to the control neuron group. Therefore, the binary SNPS \(\mathbf{\Pi}_{\text{BDSNP}}\) for division designed in this paper includes input neurons, result neuron groups, auxiliary neuron groups, dividend input auxiliary neuron groups, divisor input auxiliary neuron groups, and dividend cache neuron groups, along with a divisor neuron group, divisor cache neuron group, and divisor neuron group. The structure of \(\mathbf{\Pi}_{\text{BDSNP}}\) is shown in Figure 11, and its formal definition is shown in Formula (6). \[\mathbf{\Pi}_{\text{BDSNP}}=(\text{O},\,\sigma_{\text{max1}},\,\sigma_{\text{ max2}}\cdots,\,\sigma_{\text{max11}},\,\sigma_{i,1},\,\sigma_{i,2}\cdots,\,\sigma_{i,k},\,\sigma_{\text{ disk2}}\cdots,\,\sigma  
1. \(syn=\{(Inputaux_{5})|\cup(aux_{1},aux_{3})|\,i\in\{2,6\}\}\cup[(aux_{2},aux_{i}) \,|\,i\in\{1,3\}]\cup[(aux_{3},aux_{3})\,|\,i\in\{4,6\}]\cup[(aux_{4}, aux_{5})|\cup((aux_{5},s_{k}))\,|\,i\in\{1,5,7\}]\cup[(aux_{6},s_{i})\,|\,i\in\{1,2, \ldots,k\}]\cup[(aux_{7},aux_{3})\,|\,i\in\{9,10\}]\cup[(aux_{8},aux_{9}) \cup[(aux_{8},ctr_{1})\,|\,i\in\{1,2,\ldots,k-1\}]\cup[(aux_{9},aux_{8})]\cup[ (aux_{10},aux_{11})\cup[(aux_{11},ans_{10})]\cup[(s_{1},aux_{9})]\cup(s_{1+1},s_{i})\,|\,i\in\{1,2,\ldots,k-1\}]\cup[(s_{i},dird_{i})\,|\,i\in\{1,2, \ldots,k\}]\cup[(s_{i},dird_{i})\,|\,i\in\{1,2,\ldots,k\}]\cup[(s_{i},dirs_{ i+1})\,|\,i\in\{1,2,\ldots,k-1\}]\cup[(dirs_{i},dird_{i})\,|\,i\in\{1,2,\ldots,k\}]\cup[( ctr_{i},dird_{i})\,|\,i\in\{1,2,\ldots,k-1\}]\cup[(ctr_{i},dird_{i})\,|\,i\in\{1,2, \ldots,k\}]\cup[(ctr_{i},aux_{11})\cup[(dird_{i},dird_{i+1})\,|\,i\in\{1,2, \ldots,k-1\}]\cup[(dird_{k},ctr_{i})\,|\,i\in\{1,2,\ldots,k\}]\cup[(dird_{k},ctr_{i })\,|\,i\in\{1,2,\ldots,k\}]\cup[(dird_{k},ctr_{i})\,|\,i\in\{1,2,\ldots,k\}] \cup[(dird_{k},ctr_{i})\,|\,i\in\{1,2,\ldots,k\}]\cup[(dird_{k},ctr_{i})\,|\,i \in\{1,2,\ldots,k-1\}]\cup[(dird_{k},ctr_{i})\,|\,i\in\{1,2,\ldots,k\}]\cup[(dird_{k},ctr_{i})\,|\,i\in\{1,2, \ldots,k\}]\cup[(dird_{k},ctr_{i})\,|\,i\in\{1,2,\ldots,k-1\}];\]
2. in = _input_;
3. out = \(ans_{1}\,|\,i\in\{1,2,\cdots,k\}\);  
In \(\Pi_{\mbox{\boldmath{$B$}}\mbox{\boldmath{$S$}}\mbox{\boldmath{$P$}}}\), the functions of each neuron (neuron group) are as follows:  
* Input neuron _Input_. _Input_ receives binary strings from the environment and converts them to spikes in \(\Pi_{\mbox{\boldmath{$B$}}\mbox{\boldmath{$S$}}\mbox{\boldmath{$P$}}}\). * Cache groups of neurons. Temporarily cache the dividend and the divisor.