# A New Hybrid Prime Code for OCDMA Network Multimedia Applications
## 3 Code Construction
### Code Construction Procedure  
1. Arrange the code sequences in the first tree, row by row in one column, as shown in Table 3, column 1. 2. Merge the code sequences in column 1 with the code sequences in the right side of the second tree in Table 2, column by column, as shown in Table 3, column 2. 3. Rotate the final code sequences in column 2 horizontally from right to left until the first code word in this sequence becomes the last one, as shown in Table 3, column 3. After these operations, the final code sequence can generally be expressed as: \[c_{m}=\left[ \begin{array}{cccc}\mathrm{X}_{0i}\mathrm{X}_{0j}\mathrm{X}_{1i }\mathrm{X}_{1j}&&\mathrm{X}_{0j}\mathrm{X}_{1i}\mathrm{X}_{1j}\mathrm{X}_{0i }\\ \vdots&&\vdots\\ \mathrm{X}_{0i}\mathrm{X}_{(d_{j})j}\mathrm{X}_{(d_{j})j}\mathrm{X}_{(d_{j}) j}&rotat\;(P_{i}-2)times&\mathrm{X}_{(d_{j})j}\mathrm{X}_{(d_{j})j}\mathrm{X}_{(0_{i})} \\ \vdots&&\vdots\\ \mathrm{X}_{0i}\mathrm{X}_{(P_{i}-2)j}\mathrm{X}_{(P_{i}-1)j}\mathrm{X}_{(P_{i} -1)j}&&\mathrm{X}_{(P_{i}-2)j}\mathrm{X}_{(P_{i}-1)j}\mathrm{X}_{(P_{i}-1)j} \mathrm{X}_{(0_{i})}\\ \vdots&&\vdots\\ \vdots&&\vdots\\ \vdots&&\vdots\\ \vdots&&rotat\;(P_{i}-2)times&\vdots\\ \mathrm{X}_{(P_{i}-1)i}\mathrm{X}_{1j}\mathrm{X}_{(P_{i}-2)i}\mathrm{X}_{(P_{j} -1)j}&&\mathrm{X}_{1j}\mathrm{X}_{(P_{i}-2)j}\mathrm{X}_{(P_{i}-1)j}\mathrm{X }_{(P_{i}-1)i}\end{array} \right]\] (1)  
The total number of code sequences in Table 3 is equal to \(K\), where \(K=K_{1}\times\) number of merged code words (i.e., equals four in column 2, Table 3) and the total number of code sequences can be generated equal to \(2\)\(K\) if the left half code sequences (the folded tree) in Table 2 have been used. \begin{table}
\begin{tabular}{c c c c c c c c c c c c} \hline \multicolumn{10}{c}{**Folded Code Sequences**} & \multicolumn{6}{c}{**Code Sequences**} \\ \hline \(X_{41}X_{01}\) & \(X_{31}X_{01}\) & \(X_{21}X_{01}\) & \(X_{11}X_{01}\) & \(X_{01}X_{11}\) & \(X_{01}X_{21}\) & \(X_{01}X_{31}\) & \(X_{01}X_{41}\) & \(X_{01}X_{41}\) & \(X_{01}X_{41}\) & \(X_{01}X_{41}\) \\  & \(X_{41}X_{11}\) & \(X_{31}X_{11}\) & \(X_{21}X_{11}\) & \(X_{11}X  
In comparison with the other orthogonal codes used in the OCDMA networks, such as the OOCs and the MPCs, the proposed code achieved the following advantages:  
1. Limited cross-correlation \"0\" or \"1\";
2. Very large number of code sequences can provide a large number of simultaneous users without sacrificing performance;
3. Shorter code length for the same higher bit rate transmission. Table 4 summarizes the comparison between the HPC and the other orthogonal codes used in the OCDMA networks. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Code-Family** & **Code-Length** & **Code-Weight** & **Auto-Corr.** &
\begin{tabular}{c} **Number of Code** \\ **Sequences** \\ \end{tabular} & **Cross-Corr.** \\ \hline OOC [13] & \(F\) & \(W\) & \(W\) & \((F-1)/W(W-1)\) & 0 or 1 \\ MPC [14] & \(p^{2}\) & \(p\) & \(p\) & \(p^{2}\) & 0 or 1 \\ HPC [Present work] & \(n\) (\(P_{1}+P_{2}\)) & \(2n\) & \(2n\) & \(2(2 nP_{1}(P_{1}-1))\) & 0 or 1 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Codes comparison. \begin{table}
\begin{tabular}{c c c c c} \hline \hline  & \multicolumn{2}{c}{**Column 1**} & \multicolumn{2}{c}{**Column 2**} & \multicolumn{2}{c}{**Column 3**} \\ \hline \ \begin{tabular}{c} **Code** \\ **Index m** \\ \end{tabular}  & **First Tree Code Sequences** & \begin{tabular}{c} **Merged Code** \\ **Sequences** \\ \end{tabular}