


#PRIME NUMBER GENERATOR ALGORITHM PYTHON SERIES#
I just wanted to know the relationship between $k, f_1(k)$ and $f_2(k)$, so I started to play with modular arithmetic, it was easier to use first $f_2$, calculating some congruence series in the following way:ġ) (shift $s=1$) Calculated the congruence series $$ for a range $K $, and I found out that there are only two $k$ numbers whose congruence is $0$, one of them is $k=1$ and the other was a prime number, $k=41$.Ģ) (shift $s=2$) Then, I did the same calculation of the congruence series but shifting one number to the right, so now I calculated the congruence series $$ for all $k$, and again the two k numbers congruent with $0$ were $k=1$ and in this case a new prime, $k=181$.ģ) (shift $s$) I extended the calculation of congruence series shifting up from $s=3$ to $s=50000$ to the right, and always in the congruence series associated to the current $s$, the non trivial (I consider $k=1$ the trivial solution) $k$ number that is congruent with $0$ is always a prime number, when I have been able to find that number in the limits of the range of number $K $ I am using for the tests(*). The prime number generator algorithm (only generates primes):įirst I wrote the same functions replacing $x = 5k$: Unfortunately, there is not a clear rule why some of the perfect squares only ending with "00" or "25" are able to obtain prime numbers.įor that reason, I wanted to learn more about the function that are generating the above mentioned results, which are $f_1=x^2+(x+1)^2$ and $f_2=x^2+(x-1)^2$, but applied to $x = 5*k$ and there was a great surprise in the results of that study. being the distance between those primes $4k$ I focused on those who are able to generate two primes, with the previous and next perfect square.įor instance, these two samples for $n=5k$: Specifically only those perfect squares of a natural number $n = 5k$, $k\in\mathbb N$, in other words, those perfect squares ending with "$00$" or "$25$", are able to generate prime numbers when added to the previous or next perfect square, and of course that happens only sometimes. While I was studying the properties of perfect square numbers, I came across an observation about how some perfect square numbers were able to generate prime numbers when added to the previous or next perfect square. So please I would appreciate a review of it. I think I could have found a prime number generator algorithm, but still I am not very sure, maybe this is an already known property of perfect square numbers, maybe not, but it looks amazing and I would like to know it is look logical or not, or a counterexample if it is wrong.
