# $3^p-2^p$ squarefree?

Original question:

$$3^n-2^{n-1}$$ seems to be squarefree. Is it?

Answer: No, but amongst the primes dividing one of these numbers, $$23$$ seems to be a special case: no $$23^2$$ divide any of them

Are there other case where $$p$$ divide a $$3^n-2^{n-1}$$ but $$p^2$$ does not?

It is conjectured that $$2^p-1$$ is squarefree.

Could it be that $$3^p-1$$ is also squarefree for $$p\neq2$$ and $$5$$ (where $$11^2$$ appears)?

Could it be that $$3^p-2^p$$ is also squarefree for $$p\neq11$$ (where $$23^2$$ appears)?

Thanks

edit: just saw this Is $(3^p-1)/2$ always squarefree?.

Note: $$n$$ is a positive natural natural in the original question and $$p$$ is a prime in my edit.

• wolframalpha.com/input/… Nope, but counterexamples seem to be pretty sparse. Commented Mar 19, 2019 at 20:49
• Use computer simulations to have an idea about it... Commented Mar 19, 2019 at 20:51
• Thx user113102, I sometimes used wolfram to plot things but didn't thought about using it that way. Commented Mar 19, 2019 at 20:54
• Deleted and reposted because I cannot freely edit my OWN comments: For the original problem, $23$ is not unique. There are lots of primes p>3 for which p2 never divides $3^n−2{n−1}$, the smallest of these actually being $5$. Just to be clear, in the edited question the exponent is now prime, right? Commented Mar 20, 2019 at 22:56
• Yes, sorry, I edited the post. Like Will, I was only looking at prime dividing these numbers, and indeed, I only consider prime exponent in the edited question (since there are clearly squares in the 3 forms for other $n$) Commented Mar 21, 2019 at 7:10

Well, I posted too quickly.....for $$n=67$$ it seems we have 2 factor $$11$$

• Also, $7^2 \mid 3^{38} - 2^{37}$. Commented Mar 19, 2019 at 20:50
• Yes, That's because I missed that one that i posted....too quickly Commented Mar 20, 2019 at 8:38

At the very end, I put a long list of these. The great majority of squared primes are below $$100,$$ but I did catch a few larger, so far $$127, 191, 271, 1021 : \;$$

712   +++  = 271^2  cdot mbox{BIG}
1588  +++ = 73 191^2  cdot mbox{BIG}
2340  +++   = 127^2  cdot mbox{BIG}
2531  +++     = 1021^2  cdot mbox{BIG}


There is a way to deal with this without doing genuine factoring. For example, your number is divisible by $$49 = 7^2$$ whenever $$n = 42 k + 38.$$

2    7   prime  7
8    6433   prime  7
14    4774777   prime  7
20    3486260113   prime  7

38    1350851580234038617   prime squared  49
80    147808829414345318853173402891795944513   prime squared  49
122    16173092699229880893715960009594875525837473033720099268457   prime squared  49


Your number is divisible by $$121 = 11^2$$ whenever $$n = 110 k + 67.$$

7    2123   prime  11
17    129074627   prime  11
27    7625530376123   prime  11

67    92709463147824050109467087204123   prime squared  121
177    2821383260958014531084804730393073172748132970923952481977527762896658545213494562627   prime squared  121
287    85861822891966292897565943276292392423908891501494514127947492094325821620603901184289283467528859878643948705742648123768724313989998123   prime squared  121


Your number is divisible by $$289 = 17^2$$ whenever $$n = 272 k + 214.$$

6    697   prime  17
22    31378962457   prime  17
38    1350851580234038617   prime  17

214    1270423474759653869629541561076150845942627861345583970679777076713806668073848513969400550694997546777   prime squared  289
486    7602033756829688179535612101927342434798006222913345882096671718462026450847558385638299237091029898106108915679642725019874527596206183615695170393375601813754958083630064304945006176793537681250116409274581709738622832815408017497   prime squared  289
758    45489491014727452017657094699993344217699387580459634625293727208970468768085650812024804178818092172750636489054819257623093543090018879398677204096366573883113560178809969964755425161715086488029060167818542608680433377185439106005853203184618487801892144052367301608312676367936439310746339829776474186019806821915640418802179770139744725661919759420980369817   prime squared  289


Surprising, your number is often divisible by $$23$$ but never by $$529 = 23^2.$$ Go Figure.

3    23   prime  23
14    4774777   prime  23
25    847271832227   prime  23
36    150094600937260753   prime  23
47    26588814288588759110123   prime  23
58    4710128697102129646845747817   prime  23

NO 23 SQUARED


Your number is divisible by $$961 = 31^2$$ whenever $$n = 930 k + 828.$$

18    387289417   prime  31
48    79766442936135021508033   prime  31
78    16423203268260507030504015972062417017   prime  31

828       prime squared  961
1758       prime squared  961
2688       prime squared  961
3618       prime squared  961
4548       prime squared  961


Your number is divisible by $$1369 = 37^2$$ whenever $$n = 1332 k + 383.$$

23    94138984523   prime  37
59    14130386091450504128613099323   prime  37
95    2120895147045314099684568958946760345244084523   prime  37

383       prime squared  1369
1715       prime squared  1369
3047       prime squared  1369
4379       prime squared  1369
5711       prime squared  1369


I also did a bounded factoring: given one of these numbers, use trial division with primes $$p < 1200.$$ I did catch a $$1021^2$$ this way..

jagy@phobeusjunior:~$$./mse | grep "\^" 38 = 7^2 17 cdot mbox{BIG} 67 = 11^2 cdot mbox{BIG} 80 = 7^2 23 607 cdot mbox{BIG} 122 = 7^2 137 599 cdot mbox{BIG} 164 = 7^3 113 cdot mbox{BIG} 177 = 11^2 cdot mbox{BIG} 206 = 7^2 41 cdot mbox{BIG} 214 = 17^2 cdot mbox{BIG} 248 = 7^2 cdot mbox{BIG} 287 = 11^2 cdot mbox{BIG} 290 = 7^2 47 809 1033 cdot mbox{BIG} 332 = 7^2 1193 cdot mbox{BIG} 374 = 7^2 17 1087 cdot mbox{BIG} 383 = 37^2 cdot mbox{BIG} 397 = 11^3 cdot mbox{BIG} 416 = 7^2 233 cdot mbox{BIG} 458 = 7^3 439 cdot mbox{BIG} 486 = 17^2 41 cdot mbox{BIG} 500 = 7^2 113 cdot mbox{BIG} 507 = 11^2 83 cdot mbox{BIG} 508 = 73^2 cdot mbox{BIG} 542 = 7^2 23 cdot mbox{BIG} 584 = 7^2 431 cdot mbox{BIG} 606 = 41^2 cdot mbox{BIG} 617 = 11^2 cdot mbox{BIG} 626 = 7^2 cdot mbox{BIG} 668 = 7^2 cdot mbox{BIG} 710 = 7^2 17 911 cdot mbox{BIG} 712 = 271^2 cdot mbox{BIG} 727 = 11^2 47 cdot mbox{BIG} 752 = 7^3 89 cdot mbox{BIG} 758 = 7 17^3 cdot mbox{BIG} 794 = 7^2 cdot mbox{BIG} 828 = 23 31^2 127 191 cdot mbox{BIG} 836 = 7^2 113 cdot mbox{BIG} 837 = 11^2 683 cdot mbox{BIG} 878 = 7^2 cdot mbox{BIG} 920 = 7^2 cdot mbox{BIG} 947 = 11^2 983 cdot mbox{BIG} 957 = 11 47^2 229 cdot mbox{BIG} 962 = 7^2 cdot mbox{BIG} 1004 = 7^2 23 937 cdot mbox{BIG} 1030 = 17^2 151 cdot mbox{BIG} 1046 = 7^3 17 41 cdot mbox{BIG} 1057 = 11^2 59 431 cdot mbox{BIG} 1088 = 7^2 cdot mbox{BIG} 1130 = 7^2 cdot mbox{BIG} 1167 = 11^2 cdot mbox{BIG} 1172 = 7^2 113 cdot mbox{BIG} 1214 = 7^2 569 cdot mbox{BIG} 1256 = 7^2 47 cdot mbox{BIG} 1277 = 11^2 cdot mbox{BIG} 1298 = 7^2 cdot mbox{BIG} 1302 = 17^2 47 223 263 cdot mbox{BIG} 1340 = 7^3 cdot mbox{BIG} 1382 = 7^2 17 cdot mbox{BIG} 1387 = 11^2 cdot mbox{BIG} 1424 = 7^2 479 cdot mbox{BIG} 1466 = 7^2 23 cdot mbox{BIG} 1491 = 83^2 157 cdot mbox{BIG} 1497 = 11^2 433 cdot mbox{BIG} 1508 = 7^2 113 cdot mbox{BIG} 1550 = 7^2 727 cdot mbox{BIG} 1574 = 7 17^2 cdot mbox{BIG} 1588 = 73 191^2 cdot mbox{BIG} 1592 = 7^2 cdot mbox{BIG} 1607 = 11^3 37 167 cdot mbox{BIG} 1634 = 7^5 cdot mbox{BIG} 1676 = 7^2 cdot mbox{BIG} 1715 = 37^2 587 cdot mbox{BIG} 1717 = 11^2 1117 cdot mbox{BIG} 1718 = 7^2 17 cdot mbox{BIG} 1758 = 31^2 cdot mbox{BIG} 1760 = 7^2 cdot mbox{BIG} 1802 = 7^2 cdot mbox{BIG} 1827 = 11^2 cdot mbox{BIG} 1844 = 7^2 113 919 cdot mbox{BIG} 1846 = 17^2 41 cdot mbox{BIG} 1886 = 7^2 41 863 cdot mbox{BIG} 1928 = 7^3 23 cdot mbox{BIG} 1937 = 11^2 cdot mbox{BIG} 1970 = 7^2 cdot mbox{BIG} 2012 = 7^2 cdot mbox{BIG} 2038 = 17 23 47^2 cdot mbox{BIG} 2047 = 11^2 cdot mbox{BIG} 2054 = 7^2 17 cdot mbox{BIG} 2096 = 7^2 cdot mbox{BIG} 2118 = 17^2 31 cdot mbox{BIG} 2138 = 7^2 cdot mbox{BIG} 2157 = 11^2 cdot mbox{BIG} 2180 = 7^2 113 cdot mbox{BIG} 2222 = 7^3 47 cdot mbox{BIG} 2246 = 7 17 41^2 cdot mbox{BIG} 2264 = 7^2 cdot mbox{BIG} 2267 = 11^2 cdot mbox{BIG} 2306 = 7^2 887 cdot mbox{BIG} 2340 = 127^2 cdot mbox{BIG} 2348 = 7^2 191 cdot mbox{BIG} 2377 = 11^2 359 cdot mbox{BIG} 2390 = 7^2 17^2 23 431 cdot mbox{BIG} 2432 = 7^2 cdot mbox{BIG} 2474 = 7^2 cdot mbox{BIG} 2487 = 11^2 179 cdot mbox{BIG} 2516 = 7^3 113 cdot mbox{BIG} 2531 = 1021^2 cdot mbox{BIG} 2558 = 7^2 cdot mbox{BIG} 2597 = 11^2 cdot mbox{BIG} jagy@phobeusjunior:~$$


• @OscarLanzi I've been seeing a dermatologist also. Commented Mar 20, 2019 at 1:14
• It is hardly supprising, since 23 divides 3^11-2^11, that is, 23 is a sevenite of 3/2. Commented Mar 20, 2019 at 9:33
• Not just $23|(3^{11}-2^{11})$. Also $23^2|(3^{11}-2^{11})$. The latter is what ultimately gets you. Commented Mar 20, 2019 at 12:41
• I was half surprised. I was exploring Sophie Germain (23, 47,...) and Mersenne Primes (suposedly squarefree) when I noticed the factorisation (That I thought squarefree too). Commented Mar 20, 2019 at 13:44
• I wonder what would be the special number "23" for $5^n-2^{n-1}$, $7^n-2^{n-1}$, ... Commented Mar 20, 2019 at 18:17

The answer below has become out of date because the question changed. Please don't be that guy; ask a new question if you want to follow up.

We can show that there are multiples of $$49$$ using elementary modular arithmetic techniques.

Let $$p$$ be a prime greater than $$3$$ (why?), and seek values of $$n$$ for which

$$3^n\equiv 2^{n-1}\bmod p^2$$

Multiply by $$(3^{-1})^{n-1}$$ getting

$$3\equiv (2×3^{-1})^{n-1}\bmod p^2$$

Let us first try $$p=5$$. We die because the left side is a nonquadratic residue $$\bmod p=5$$ and the right side, with $$2×3^{-1}\equiv 4\bmod 5$$, is a quadratic residue.

Fortunately, for $$p=7$$ we avoid this contradiction because $$2×3^{-1}$$ is nonquadratic $$\bmod 7$$ thus also nonquadratic $$\bmod 49$$. We then have

$$3\equiv 17^{n-1}\bmod 49$$

where $$17\equiv 3\bmod 7$$ is a primitive root in the group of units $$\bmod 49$$ (the only nonprimitive root $$\bmod 49$$ congruent to $$3\bmod 7$$ is $$31$$), therefore this equation must have positive whole number solutions for $$n$$.

Will Jagy has identified the minimal solution as $$n=38$$, so let us check this case $$\bmod 49$$. Since units give $$1$$ when raised to the power of $$42$$, we may render

$$3^{38}\equiv (3^{-1})^4\equiv 33^4\equiv 11^2\equiv 121\equiv\color{blue}{23\bmod 49}$$

And

$$2^{37}\equiv (2^{-1})^5\equiv 25^5\equiv 25×(-12)^2\equiv 3600\equiv \color{blue}{23\bmod 49}$$

• Oscar, I realized I had a quick way to find squares of small primes, as I write my own factoring-related routines to get quick factors if needed: 712 +++ = 271^2 cdot mbox{BIG} 1588 +++ = 73 191^2 cdot mbox{BIG} 2340 +++ = 127^2 cdot mbox{BIG} 2531 +++ = 1021^2 cdot mbox{BIG} Commented Mar 20, 2019 at 15:46
• Oscar, no. Back in 2010 I downvoted some things, found I did not like the way it made me feel. Commented Jan 10 at 2:41
• Those three downvotes by me were actually in 2017 and 2018, not 2010, according to my profile. You have three upvotes, including mine, but one downvote. There are plenty of ill mannered people on this site. Commented Jan 10 at 2:49
• @WillJagy I've figured it out. Apparently the answer got downvoted because the question changed and the answer is out of date. I put in advice not to change questions but to ask new ones. Commented Jan 10 at 13:24