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.

Caption

We first set the sensor to the position lower 2

2 had no light so we create a new one that is going to en-light all the multiples of 2

Caption

3 had no light so we create a new one that is going to en-light all the multiples of 3

4 is already in the light, we skip it

4 is already in the light, we skip it


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.

If you liked this article, you might be interested in my Twitter feed as well.
 
  • http://fry-them-all.com 3on

    Wait to be in the LRDE to publish that !

  • lukas

    @3on: Why ? If it is his idea what's the problem?

 

Random Posts

  • July 5, 2011 -- Climb – Chaining Operators & Component Trees (1)
    During the last 6 months as part of the LRDE (EPITA Research & Development Lab), I've been working on Climb, a Common Lisp image processing library. I've written a report and presented it. You can download the slides and report. Climb - Chaining Operators & Component Trees Abstract: Climb is...
  • December 7, 2010 -- Javascript – MAX_INT: Number Limits (2)
    As I read an article about solving the 8-queen problem storing the board in a 64bit integer (French) I wanted to test it in Javascript. I knew that numbers where not stored as int64 but who knows, maybe it would have worked! As you may have expected, it failed, giving completly off results. The r...
  • April 24, 2011 -- JSPP – Morph C++ Into Javascript (7)
    C++ has a new standard called C++0x (Wikipedia, Bjarne Stroustrup) that includes many interesting features such as Lambda, For Each, List Initialization ... Those features are so powerful that they allow to write C++ as if it was Javascript. The goal of this project is to transform C++ into Javas...
  • February 6, 2011 -- Lisp – Chaining Operator (2)
    In the Javascript world, it is a common thing to chain methods call. For example, this could be a call from an image processing library. Image('in.png') .resize(200, 100) .erode() .save('out.jpg'); In Lisp, there is not such thing as a dot notation to call an object method. Method...
  • August 19, 2011 -- Javascript – Stupid Idea: Hoisting at the end (0)
    JSLint imposes us to do manual hoisting of variables. What if we did it but at the end of the function? :P How you write function print_array (array) { var length = array.length; for (var i = 0; i < length; ++i) { var elem = array[i]; console.log(elem); } } How Jav...