- #1

Genericcoder

- 131

- 0

I always wanted to know if one could generate prime numbers according to an equation,so I wanted to go and study prime numbers little bit and know how exactly its gets formed and its logic.

So as we all know that prime number is any natural number that is divisable by itself and 1 only,but since all prime numbers are odd(except two then it can be of the following form)

2n - 1 or 2n + 1 for example

3 = 2 * 1 + 1 OR 3 = 2 * 2 - 1;

So I decided to take the form 2n + 1 and see how multiples of two change and see if I could find any pattern in the multipales of two in which there could be a equation that would generate it,so I did exactly that.

I made the pattern that I find is according the difference between the multiples like how much N increases on each member:

For example:

3 = 2 * 1 + 1;

5 = 2 * 2 + 1;

Here the n increased by 1,so when I made for first 29 member I find this some difference gets repeated for N(that is the difference between multipales of two) like Difference 1,3,2 gets repeated every some members,so does this mean that there exists a function of some form: 2n + 1 ..... that would generate prime numbers according to the element you want?

I made also a C program in order to check if this pattern increases as we go generate larger prime numbers I found that it does increase,so its not just the first 29 members or is this pattern of difference between multiples of two just random ?