# A Hybrid Key Generator Model Based on Multiscale Prime Sieve and Quantum-Inspired Approaches
## 4 Multiscale Prime Generator Subkey  
Remember that the purpose of this research is to construct hybrid keys with one component driven by quantum numbers and a second component driven by prime numbers. In this section, we consider the subkey based on prime numbers. The second subkey that we offer as input to the QPIF algorithm is a product of prime numbers that we calculate by generating two prime numbers, each generated using a multiscale sieve, subject to the rules presented in detail in [4], where the authors achieved the fastest sieve for prime number generation last year, which has not yet been surpassed. Here we have only summarised the main results relevant to the present work. We have a randomly chosen number \(\mathsf{n}\in\mathsf{N}\), and the sieving algorithm will return \(\mathsf{n}\) if it is prime or the closest prime number to \(\mathsf{n}\). The sieving algorithm is based on an automated procedure derived from a theorem established in [34] which states that every prime number can be written as the difference between the product of the first \(\mathsf{m}\) prime numbers and a prime number obtained in the previous level of gridding. Thus, using multiscale analysis, every prime number can be written as in Equation (4):  
\[p_{ij}=\left(\prod_{j=1}^{m}p_{j}\right)k-p_{i}\,,\ with\ k\in N \tag{4}\]  
where \(k\) is the counting index, \(p_{i}\) is a prime number purchased at the stage \(m-1\) (or \(-1\) or \(+1\)), \(j\) is the level of decomposition, and \(p_{ij}\) is the acquired prime number. The algorithm thereby accumulates step by step the candidate prime numbers useful for multiscalegeneration, to the nearest input prime number. Therefore, the prime input items to the algorithm are the following in (5):  
\[\left(\prod\
olimits_{j=1}^{m}p_{j}\right) \tag{5}\]  
It is the product of the first \(m\) primes that represents the multiscale level and is the basis for generating the prime candidates:  
* Each multiscale level k can range from 1 to a value \(k_{max}\), which changes at every level, and specifically, the last \(k_{max}\) takes the value of \(p_{m+1}\), which is the prime number that serves us to generate the next multiscale level.
* After generating the product between the multiscale level and \(k\), we subtract \(p_{i}\), which is each prime number obtained at the previous multiscale level.  
As proved in a recent work [4], the suggested multiscale algorithm is not only feasible but also offers better performance than other sieves.  
To clarify the procedure, consider the case n = 37. Instead of performing the classic divisibility tests, with their well-known computational costs, the multiscale sieve generates candidate prime numbers by evaluating the product of the first m = 4 prime numbers (\(2\times 3\times 5\times 7=210\)) and subtracting the known prime numbers from the previous level. For example, \(210-173\) = 37, which is itself a prime number. This confirms the recursive nature of the sieve and validates the generation path with respect to Formula (4). All variables are now explicitly indicated as p\({}_{\text{ij}}\), where i indicates the level and j the subcomponent.