Squares and Primes

Fiddling around with my calculator today I found a notable trend in addition of sequential squares:
4+1=5…prime
9+4=13…prime
16+9=25…5^2
25+16=41…prime
36+25=61…prime
49+36=85…517
64+49=113…prime
81+64=145…5
29
100+81=181…prime
121+100=221…1317
144+121=265…5
53
169+144=313…prime
196+169=365…573
225+196=421…prime
256+225=481…13
37
289+256=545…5109
324+289=613…prime
361+324=685…5
137
400+361=761…prime
441+400=841…29^2

Half are prime, and the majority of composites are divisible by 5.

Does any of this reveal anything remarkable?

You have too much time on your hands?

sounds interesting :slight_smile:

What you are noticing is that (2n^2 + 2n + 1) mod 5 = 0 has the solutions n = 5m+1 and n = 5m +3, where m is a whole number.
.
Or in other words 2/5 of the time the answer is going to be divisible by 5

If you want to have fun with primes and squares, try this one:

The square of every prime number is one more than a multiple of 24. (Obviously except 2 and 3.)

In terms of the prime values they will become less common as n goes to infinity.

And while we’re at it, it has no solutions mod 2 or 3. If something’s not a multiple of 2 or 3, then the most common way for it to fail to be a prime is going to be for it to be a multiple of 5.

This blows my mind.

The trend that “half are prime” doesn’t persist as you take more such numbers. I ran a quick program to test the primality of the first million such numbers (i.e., up to 1000000[sup]2[/sup] + 1000001[sup]2[/sup]), and found that a little over 10% of them (104,894 of them, to be exact) are prime.

No solutions mod 7, 11, 19, or 23 either; but 2/13 of the time, the answer will be divisible by 13; 2/17 of the time, it’ll be divisible by 17; 2/29 of the time, it’ll be divisible by 29.