# Is this prime formula too general?

I managed to develop a working sequence formula for primes but I think it is too general so I wanted to post it here as a question and let the community say if we could get something from it or not.

Let A(0)=2 and A(1)=3 those are our first numbers with which we will play with our primes. Let's define our % operation the way we define it in programming 3%2=1 7%5=2 (a modulo function).

Now let it be known that A(n+1) is actually a function of variables (A(0),A(1),...A(n)) and in exactly this way A(n+1)=A(n)+C(n+1) where C(n+1)=minimum of N{ F(A(0),A(1),...,A(n)) } (N are positive intigers) Now this F is actually a set that consists of (k-1)*(A(i)) -A(n)%A(i) where i is strictly smaller than n and k is an element of N.

Since I probably confused you up until here let me tell you what my idea is here: C(n+1) can obviously be seen as a difference between two consecutive primes (for 7 and 11 it is 4, 29 and 31 is 2)

Now let's try finding the next prime by using this formula (if we can even call it like that). for number 17 the primes before are 2,3,5,7,11 and 13.

these are 6 sets we get from F(2,3,5,7,11,13,17)

2-17%2=1 1+2=3 1+4=5 1+6=7 => 1,3,5,7,...

3-17%3=1 1+3=4 1+6=7 => 1,4,7,10...

5-17%5=3 3+5=8 3+10=13 => 3,8,13,...

7-17%7=4 4+7=11 4+14=18 => 4,11,18...

11-17%11=5 5+11=16 5+22=27 => 5,16,27...

13-17%13=9 9+13=22 9+26=35 => 9,22,25...

17-17%17=17 17+17=34 17+34=51 => 17,34,51...

and their union is Q={1,3,4,5,7,8,9,10,11,13,15,16,17,18,19,21,...}

N/Q={2,6,12,20,...}

Now the idea behind this is to find the smallest x that is not a part of this set here and it is 2 which gives us the C(n+1). (Note that also all of these first numbers that are in N\Q 17+them is prime number)

Anyway I hope you got the idea for the algorithm, so please tell me if anything similar exists.

-
Please use $\LaTeX$! –  Pedro Tamaroff Feb 23 '13 at 18:08
Yes, this does produce the prime sequence, i.e. $A(n+1)$ is indeed the next prime. Your algorithm is essentially not much slower than standard trial division to find the next prime. If you went for several primes at once instead, your method would essentially be what is known as Erathosthenes's sieve (it gives you all primes $<17^2=289$ "at once" as soon as you have reached $17$) –  Hagen von Eitzen Feb 23 '13 at 18:09
You can find some good starting points on how to format mathematics on the site here. This AMS reference is very useful. If you need to format more advanced things, there are many excellent references on LaTeX on the internet, including StackExchange's own TeX.SE site. –  Zev Chonoles Feb 23 '13 at 18:11
I'm sorry for not using latex, but i still hope you could read this without it. Anyway in my view this has some elements of Erathosthenes's sieve but is formed in a slightly different way. –  user1398593 Feb 23 '13 at 18:17
–  Math Gems Feb 23 '13 at 18:17