Prime number recognition is a very hard problem and yet no good enough solution has been found using classical algorithms. There are two ways to get around those limitations: find an algorithm with a better complexity or find a way to compute faster. The first one has already been researched by a large amount of people so I decided to give a shot to the second one.
We are limited by the speed of the electricity, so my idea is to use speed of light to improve speed by a great factor. I've come up with a simple example of how to use it to compute prime numbers.
We set up 2 mirrors with light sources that are directed.
Here is the pseudo code of the prime calculation with Light & Mirror.
hasLight(n): // Sensor placed at lower n that tells weither if it is enlightened or not newLight(n): // Creates a light that starts from lower n, targeted at the upper n + n/2, // that first reflects to lower 2n and then to all the multiples of n. isPrime(n): for i = 2 to sqrt(n) if not hasLight(i) newLight(i) return not hasLight(n)
This method allows us to recognize prime numbers with light sources, mirrors, sensors and a bit of programming.
Recognizing if a number is prime or not requires to have a lot of lasers and sensors. I don't think that is a viable process, however this could be interesting to do multiplications. You want to fire 2 lights and then see in what point they cross. However there are 2 main problems:
- It requires to have 2 really long mirrors possibly infinite which is not possible in practice. It may be possible to add a vertical mirror in order to work in a bounded area. Yet to know how many times the light hit that mirror.
- We are required either to have an infinite number of sensors. We could have only one sensor that checks all positions sequentially but then we loose the speed of light! What is wanted instead are mirrors in each position that would redirect light to a unique sensor capable of knowing where it came from.
This is an experiment and it is not at the moment near to be faster than actual methods but this is a new way to think about programming. I don't know if anything useful is going to be deviated from this but it shows how to use the light to compute things.