# Squares and Primes

**URL:** <https://boards.straightdope.com/t/squares-and-primes/714661>\
**Category:** Factual Questions\
**Created:** [March 10, 2015, 1:39am UTC](https://boards.straightdope.com/t/squares-and-primes/714661 "2015-03-10T01:39:57Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Enola\_Straight](https://avatars.discourse-cdn.com/v4/letter/e/dec6dc/32.png) [@Enola\_Straight](https://boards.straightdope.com/u/Enola_Straight)\
**Post date:** [March 10, 2015, 1:39am UTC](https://boards.straightdope.com/t/squares-and-primes/714661/1 "2015-03-10T01:39:57Z")

</div>

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…5_17  
64+49=113…prime  
81+64=145…5_29  
100+81=181…prime  
121+100=221…13_17  
144+121=265…5_53  
169+144=313…prime  
196+169=365…5_73  
225+196=421…prime  
256+225=481…13_37  
289+256=545…5_109  
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?

---

<div class="post-metadata">

**Author:** ![jezzaOZ](https://avatars.discourse-cdn.com/v4/letter/j/a9a28c/32.png) [@jezzaOZ](https://boards.straightdope.com/u/jezzaOZ)\
**Post date:** [March 10, 2015, 1:48am UTC](https://boards.straightdope.com/t/squares-and-primes/714661/2 "2015-03-10T01:48:32Z")

</div>

> [@Enola\_Straight](#):
>
> Does any of this reveal anything remarkable?

You have too much time on your hands?

---

<div class="post-metadata">

**Author:** ![Robert163](https://avatars.discourse-cdn.com/v4/letter/r/4af34b/32.png) [@Robert163](https://boards.straightdope.com/u/Robert163)\
**Post date:** [March 10, 2015, 2:13am UTC](https://boards.straightdope.com/t/squares-and-primes/714661/3 "2015-03-10T02:13:56Z")

</div>

sounds interesting 🙂

---

<div class="post-metadata">

**Author:** ![Asympotically\_fat](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@Asympotically\_fat](https://boards.straightdope.com/u/Asympotically_fat)\
**Post date:** [March 10, 2015, 2:17am UTC](https://boards.straightdope.com/t/squares-and-primes/714661/4 "2015-03-10T02:17:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Exapno\_Mapcase](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/exapno_mapcase/32/1051_2.png) [@Exapno\_Mapcase](https://boards.straightdope.com/u/Exapno_Mapcase)\
**Post date:** [March 10, 2015, 2:39am UTC](https://boards.straightdope.com/t/squares-and-primes/714661/5 "2015-03-10T02:39:23Z")

</div>

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.)

---

<div class="post-metadata">

**Author:** ![Asympotically\_fat](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@Asympotically\_fat](https://boards.straightdope.com/u/Asympotically_fat)\
**Post date:** [March 10, 2015, 2:43am UTC](https://boards.straightdope.com/t/squares-and-primes/714661/6 "2015-03-10T02:43:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Chronos](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/chronos/32/134_2.png) [@Chronos](https://boards.straightdope.com/u/Chronos)\
**Post date:** [March 10, 2015, 4:21am UTC](https://boards.straightdope.com/t/squares-and-primes/714661/7 "2015-03-10T04:21:52Z")

</div>

> [@](#):
>
> 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.

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.

---

<div class="post-metadata">

**Author:** ![RickJay](https://avatars.discourse-cdn.com/v4/letter/r/bb73d2/32.png) [@RickJay](https://boards.straightdope.com/u/RickJay)\
**Post date:** [March 10, 2015, 3:01pm UTC](https://boards.straightdope.com/t/squares-and-primes/714661/8 "2015-03-10T15:01:25Z")

</div>

> [@Exapno\_Mapcase](#):
>
> 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.)

This blows my mind.

---

<div class="post-metadata">

**Author:** ![MikeS](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@MikeS](https://boards.straightdope.com/u/MikeS)\
**Post date:** [March 10, 2015, 5:33pm UTC](https://boards.straightdope.com/t/squares-and-primes/714661/9 "2015-03-10T17:33:15Z")

</div>

> [@Enola\_Straight](#):
>
> Half are prime, and the majority of composites are divisible by 5.
> 
> Does any of this reveal anything remarkable?

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.

> [@Chronos](#):
>
> And while we’re at it, it has no solutions mod 2 or 3.

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.
