# Primes

Prime numbers are positive integers that can't be divided with other than 1 and number itself. For example 7 is prime number (can be divided only with 1 or 7) but 9 is not (can be divided with 3).

When I learned about big prime numbers first time, they had less than million digits. I was optimistic and made program to simply list bigger and bigger primes until stopped. Unfortunately my Basic programmed Amiga started choking already when going to millions. Much later I tried to make program that try to find totally random formulas that would result prime numbers from any X parameter given. Not much luck, even very complicated ones generated just up to 10 primes.

I made quite many different this kind of programs, with different changes like that X given must be also prime. So primes generating another primes. Niven's constant apperared in many, like:

F(x) = Niven^x + cos(x) - 1

That works with X values 11, 13, 17, 19, 23, 29 and 31. Result must be rounded. That was fun for a while but got too complicated.

## Polynomial

I tried something simpler and ended up to formulas like this:

1106621 + 41940 * n2   n=[0..18]

But those are big numbers, hard to remember or calculate in head. It would be fun to have very short and easy to remember formulas that would result many primes, even though not endlessly. Computers back to work, and this one was quick:

29 + 2n2   n=[0..28]

29 primes from such small formula, relatively easy to calculate in head. And yes, I'm aware that was found already hundreds of years ago, but it is still fun to stumble upon these myself :-)

Other similar ones found same way:

19 + 10n2   n=[0..18]
163 + 4n2   n=[0..19]

This one was interesting also, as it works with n=[0..79] but it returns only 40 different primes:

n2 - 79n + 1601   n=[0..79]

Here are some that are 2n form. These are always really easy for all computer programmers, everyone remember 2n values to at least up to n=8

33 + 10*2n   n=[0..6]
171 + 10*2n   n=[0..8]

Also one that doesn't have any xn or nx

7 + 6n!   n=[0..6]

n=0 and n=1 naturally gives same result.

## Favorite

This group of three is my favorite because they are so easy to remember:

10n2 + 7   n=[0..6]
10n2 + 13   n=[0..12]
10n2 + 19   n=[0..18]

So basically: "Pick n between 0 and 18, square it, times ten go easily. Finally add 7, 13 or 19 but so that you add more than original n."

Those gives 39 different primes very easily. It would be possible to add one more to this group:

10n2 + 3   n=[0..2]

But that would add only 2 more new primes. Nevertheless, exactly same rules can be used.

## More

I also have page for more special primes and prime-generating formulas.