36

I know that $S_n:=1!^2+2!^2+3!^2+\dots+n!^2$ cannot be a perfect square because it is equal to $2\pmod{3}$ and it is never a perfect cube because it is equal to $5\pmod{9}$, but can $S_n$ be a higher odd perfect power?

Edit:

  • $S_n$ cannot be also a perfect 5th power when $n\geq10$, since $17$ is not a 5th power residue $\pmod{100}$.

  • $S_n$ is also never a perfect 11th power if $n\geq23$, since $8$ is not a 11th power residue $\pmod{23}$.

  • $S_n$ is not a perfect 7th power for all $n\geq29$ because $7$ is not a 7th power residue $\pmod{29}$.

  • $S_n$ is not a perfect 13th power if $n\geq52$, since $7$ is not 13th power residue $\pmod{53}$.

  • $S_n$ isn't a perfect 17th power when $n\geq137$, since $70$ is not a 17th power residue $\pmod{137}$.

  • $S_n$ isn't a perfect 19th power when $n\geq191$, since $44$ is not 19th power residue $\pmod{191}$.

  • $S_n$ is never a perfect 23rd power if $n\geq47$, since $30$ is not a 23rd power residue $\pmod{47}$.

  • $S_n$ is not a perfect 29th power for all $n\geq59$, since $5$ is not 29th power residue $\pmod{59}$.

  • If $n\geq310$, then $S_n$ is never a perfect 31st power, since $62$ is not a 31st power residue $\pmod{311}$.

  • $S_n$ is not a perfect 37th power for all $n\geq148$, since $88$ isn't a 37th power residue $\pmod{149}$.

  • $S_n$ cannot be a perfect 41st power for all $n\geq82$, because $S_{82}\equiv45\pmod{83}$, and since $x^{41}\equiv45\pmod{83}$ is not solvable, $45$ is not a 41st power residue $\pmod{83}$.

RobPratt
  • 45,619
  • 4
    For all $k$ even, we can easily see that $a^k$ will not leave remainder 2 when divided by 3, for any natural number $a$. And hence, $$1!^2+2!^2+\dots+n!^2$$ is never a $k^{th}$ power ($k$ being even).

    For all $k$, odd, again it can be easily seen that $a^k$ can never leave reminder 5 when divided by 9. Hence, the conclusion.

    – Yathi Jun 03 '23 at 16:58
  • 4
    @YathirajSharma What is wrong with remainder $5$ mod $9$? For example $32^7$ is a perfect power that is $5$ mod $9$. – 2'5 9'2 Jun 03 '23 at 17:05
  • 2
    Oh yes. I missed a calculation for odd $k$. My cases for odd $k$ apply to those odds $k$ which are multiples of 3. – Yathi Jun 03 '23 at 17:10
  • 2
    For positive integer $n\le 10^4$ , the sum is never a perfect power ($1$ not condsidered to be a perfect power). – Peter Jun 03 '23 at 17:51
  • 1
    @Peter the first few dozen are squarefree... $n=32$ took pari a while to factor, though, so I can't expect to check much higher – Will Jagy Jun 03 '23 at 20:59
  • 3
    @WillJagy Does this lead to the conjecture that the above sum is even squarefree for all positive integers $n$ ? – Peter Jun 03 '23 at 21:51
  • @Peter yes. That is stronger than the original question needs, of course; it would be enough to show that there is a prime factor with exponent no larger than $2$ (as squares were already ruled out). – Will Jagy Jun 03 '23 at 21:59
  • For prime $p\le 10^6$ and $n\le 10^4$ , we have $p^2\nmid S(n)$ , where $S(n)$ denotes the above sum. So, the conjecture that it is always squarefree is promising. The largesr positive integer $n$ for which $S(n)$ is prime I found so far is $n=310$ – Peter Jun 03 '23 at 22:23
  • A partial answer: Suppose the odd $k$ is such that $2k+1$ is prime $p$ and that the sum $1!^2+2!^2+\dots+(p-1)!^2$ is not 0 or $\pm 1$ modulo $p$, then the given sum is never $a^m$ for any $a$, where $m$ is any odd multiple of $k$. Few values of $k$ include, $k=5, 9, 11, 15, 21, \dots$ – Yathi Jun 04 '23 at 16:39
  • Surprisingly, I have landed in one more observation, while working on this. For what primes, the sum $1!^2+2!^2+\dots+(p-1)!^2$ is 0 or $\pm 1$ modulo $p$? So far I have got only two $p=2, 131$. I am using a primitive software to check this and I couldn't check for large numbers. – Yathi Jun 04 '23 at 16:45
  • 1
    For $n=3175$ , we get a probable prime. – Peter Jun 05 '23 at 15:41
  • 2
    If for some prime $p$ , $p^2$ divides the above sum for some positive integer $n$ , then we must have $p>20\ 000$ – Peter Jun 06 '23 at 15:41
  • @Peter, if you are looking for primes A100289 already listed some. – jorisperrenet Jun 07 '23 at 19:52
  • It is probably worth asking how likely this conjecture is to be true, heuristically, just based on the rate of growth of the terms $A_n = 1! + 2! + \ldots + (n-1)! + n!$ and the known density of perfect powers. I'm guessing extremely likely? – mjqxxxx Jun 20 '23 at 18:09
  • Your sequence grows very fast, and most numbers are perfect powers, so most likely none of the terms is a perfect power. That may be very hard to prove though. – Derivative Jun 22 '23 at 07:24
  • 2
    If $1!^2+2!^2+\cdots +n!^2=m^p$ where $p\equiv 1\pmod 4$ is prime, then $m\equiv 57\pmod{80}$. If $1!^2+2!^2+\cdots +n!^2=m^p$ where $p\equiv 3\pmod 4$ is prime, then $m\equiv 73\pmod{80}$. – mathlove Jul 10 '23 at 09:32
  • Your edit can be simplified: The last digits are $17$ for $n\geq4$, not just $n\geq10$. Also, $17$ is not a $5$th power mod $25$. – mr_e_man Jul 10 '23 at 12:14
  • Your sum can't be a $7$th power because it's $3\bmod49$. -- Can $0!^2+1!^2+2!^2+\cdots+n!^2$ be a perfect power? ...No, because it has only one factor of $2$. – mr_e_man Jul 10 '23 at 14:06
  • @mr_e_man it is interesting that $S(n)+1$ (your proposed sum) seems to be squarefree for all positive integers $n$, the same as for $S(n)$ (as already noted by @Peter) – Juan Moreno Jul 10 '23 at 14:17
  • We only need to check that the sum is not a perfect power for $n<1248828$. For larger $n$, the sum has only one factor of $1248829$. (See the linked question.) – mr_e_man Jul 10 '23 at 15:04
  • Expanding on @mr_e_man's comment: sum-of-factorial squares, $sf^{2}(n)$ is divisible by $1248829$ for $n \ge 1248828$.

    See: https://mathworld.wolfram.com/FactorialSums.html

    – vvg Jul 11 '23 at 02:12
  • For most prime exponents $p$, the sum $S(p)$ (i.e. the eventual constant value of the sum mod $p^2$) is not a $p$th power mod $p^2$. However, $p=59$ is an exception: $S(58)\equiv300\equiv5^{59}\bmod59^2$. For that exponent, we can use the modulus $709$ instead of $59^2$; the eventual constant value is $S(709)\equiv534$ which is not a $59$th power mod $709$. -- It seems that for any prime exponent $p$ there exists some modulus $m\leq p^2$ such that $S(m)$ is not a $p$th power mod $m$. I wrote a program that verified this for all $p<2000$. It also seems that the minimal $m$ is $\equiv1\bmod p$. – mr_e_man Jul 11 '23 at 02:51
  • In fact it seems that the minimal $m$ is https://oeis.org/A035095 -- Now I've verified that, with this $m$ (the smallest prime $\equiv1\bmod p$), the sum $S(m)$ is not a $p$th power mod $m$, for all primes $p<10^4$. – mr_e_man Jul 11 '23 at 03:44
  • @OscarLanzi - No, $S(10)=13301522971817\equiv3\bmod11$. And that is a special case of my previous comment ($p=5$, $m=11$). – mr_e_man Jul 11 '23 at 12:27
  • @Smart231 - For the $7$th power case, I get $S(29)\equiv9\bmod29$, not $7\bmod29$ as you write. And for the $17$th power, we can use modulus $103$ instead of $137$, since $S(103)\equiv43$ is not a $17$th power mod $103$. – mr_e_man Jul 11 '23 at 12:44
  • @mathlove - I can see that it's true (indeed $p$ needn't be prime), but how did you arrive there? Why $80$ instead of, say, $40$ or $120$? Can you further restrict the possible values of $m$ (modulo some larger number)? – mr_e_man Jul 14 '23 at 05:59
  • 1
    @mathlove - You got me thinking about Euler's and Carmichael's totient functions. $80$ is the largest number with $\lambda=4$. But then why $4$? So I tried a much bigger $\lambda=2^5\cdot3^3\cdot5^2\cdot7^1\cdot11^1=1663200$, and modulus $$M=2^7\cdot3^4\cdot5^3\cdot7^2\cdot11^2\cdot13^1\cdots8317^1\cdot9241^1\cdot9901^1\approx5.972\cdot10^{208}.$$ (I could have put more factors in $M$, if it weren't for Peter's limit of $n<10000$ on the already checked values of $S(n)$.) It follows that $S(n)\bmod M$ is constant for $n\geq9900$, and I've computed that it's relatively prime to $M$. (... – mr_e_man Jul 17 '23 at 01:40
  • 1
    ...) We want to know whether $S(n)=b^e$, where the exponent $e>11$ is prime (or at least relatively prime to $\lambda$). $S(n)\equiv b^e\bmod M$ is equivalent to $b\equiv S(n)^{(1/e\bmod\lambda)}\bmod M$. There are $\phi(\lambda)=345600$ many possible values of $e$ or $1/e\bmod\lambda$, and each gives a possible value of $b\bmod M$. I found that the smallest one is $b\approx1.656\cdot10^{203}$. Therefore, $S(n)=b^e$ must have $b>10^{203}$. But this is still tiny compared to $S(1248829)$, so it's not much help.... – mr_e_man Jul 17 '23 at 01:43
  • (Actually $240$ is the largest number with $\lambda=4$.) – mr_e_man Jul 17 '23 at 02:04
  • 1
    Might be helpful: https://math.stackexchange.com/questions/131330/detecting-perfect-squares-faster-than-by-extracting-square-root and https://math.stackexchange.com/questions/3165146/method-to-test-if-a-number-is-a-perfect-power – mr_e_man Jul 17 '23 at 03:03
  • 1
    @JuanMoreno, it is not true that $S(n)+1$ is squarefree for all positive integers $n$. Three counterexamples are $461^2|S(456)+1$, $31219^2|S(19096)+1$ and $852463^2|S(673285)+1$, I have found no other counterexamples with $p < 1\ 000\ 000$. – jorisperrenet Jul 17 '23 at 22:07
  • 1
    @Peter, I have increased your search limit for the $S(n)$ case up to $p=1\ 600\ 000$, now if for some prime $p$ and (positive) integer $n$ we have $p^2|S(n)$, then $p > 1\ 600\ 000$. – jorisperrenet Jul 17 '23 at 22:07
  • 2
    Using my lower bound on $b$ and an upper bound on $S(1248827)$, I was able to put a bound on the exponent, $e\leq75000$, and then check all those cases to finish the proof. But I don't feel like writing an answer (partly because there is one already). – mr_e_man Jul 18 '23 at 19:12
  • 1
    @Peter, if $p^2|S(n)$ holds for some prime $p$ and positive integer $n$ we have $p > 10\ 000\ 000$. – jorisperrenet Jul 18 '23 at 21:43
  • @mr_e_man, did you look for triples (in the form I specified in my answer) to check whether or not an exponent was possible? If so, how did you verify the base cases $n < z$. I assumed they had to be verified separately as I calculated $y=S(z-1) \bmod z=S(n'-1) \bmod z$ where $n' \geq z$, meaning that the value of $y$ would be constant for $n\geq z$, however if $n < z$, the value of $y$ fluctuates; did you check all of these $y$ values? – jorisperrenet Jul 18 '23 at 21:52
  • 1
    @jorisperrenet - Yes, I checked all values of $S(n)$ with $n$ less than the modulus, using this algorithm: For each prime exponent $e<75000$, for redundancy find three different prime moduli $m_1,m_2,m_3\equiv1\bmod e$. Then compute $S(n)\bmod m$ (three sums in parallel) from $n=1$ to $m_1-1$, and check each value for $e$'th powers. (I think $S(m_1-1)\bmod m_1$ is never an $e$'th power, so then we can continue to the next value of $e$. But if it is an $e$'th power, then drop $m_1$ and continue the sum mod $m_2$ and $m_3$, up to $n=m_2-1$.) Some $S(n)$ failed two tests, but never all three. – mr_e_man Jul 19 '23 at 22:54
  • 1
    (And if $S(m_2-1)\bmod m_2$ is an $e$'th power, then also drop $m_2$ and continue the sum mod $m_3$, up to $n=m_3-1$. I didn't write this because I thought it was obvious, and because of the comment length limit.) – mr_e_man Jul 19 '23 at 23:18

2 Answers2

3

Partial answer

Note that, for $n\geq9$, it is easy to show that $S(n)$ always has $1817$ as last digits. This fact eliminates the posibility of $S(n)$ being some even perfect power. For odd integers, note that:

  • perfect powers of integers having $1$ as last digit also have $1$ as last digit, so $S(n)$ can not be a perfect power of some odd integer having $1$ as last digit.

  • perfect powers of integers having $3$ as last digit have $3,9,7,1$ as last digits, so $S(n)$ could be a perfect power of some odd integer having $3$ as last digit only for powers $P$ of the form $P^{4k+3}$. It would remain to show that there is not any power of some odd integer having $3$ as last digit of the form $P^{4k+3}$ that could end in $1817$.

  • perfect powers of integers having $5$ as last digit also have $5$ as last digit, so $S(n)$ can not be a perfect power of some odd integer having $5$ as last digit.

  • perfect powers of integers having $7$ as last digit have $7,9,3,1$ as last digits, so $S(n)$ could be a perfect power of some odd integer having $7$ as last digit only for powers $P$ of the form $P^{4k+1}$. It would remain to show that there is not any power of some odd integer having $7$ as last digit of the form $P^{4k+1}$ that could end in $1817$.

  • perfect powers of integers having $9$ as last digit have $9,1$ as last digits, so $S(n)$ can not be a perfect power of some odd integer having $9$ as last digit.

Indeed, the "fixed" last digits of $S(n)$ grow as $n$ grows, so if there exists a counterexample for the pending cases, maybe other ones with more fixed ending digits could work.

EDIT

Running a Python program, I have been checking all odd integers less than $10001$ having $3$ or $7$ as last digit, and powers of the form $4k+3$ or $4k+1$ respectively less than $10001$.

I have been able to check that there are both powers of odd integers having $3$ as last digit of the form $P^{4k+3}$, and powers of odd integers having $7$ as last digit of the form $P^{4k+3}$, that end in $1817$. For instance, $73^{443}$ or $137^{57}$, although the program showed at least fourteen counterexamples before I stopped it.

I have found the powers $137^{2057}$, $153^{1399}$, $297^{929}$, $313^{1587}$, and $473^{2403}$ before I stopped the program, all of them ending in $51817$, the last five digits of $S(n)$ for $n\geq 14$

I have found the power $777^{653}$ ending in $851817$, the last six digits of $S(n)$ for $n\geq 14$, before I stopped the program.

Therefore, although the suitable powers get scarcer, the "fixed" last digits approach does not seem so promising as it could, or at least some additional insight would be needed. It seems that the smallest powers ending in some given fixed digits of $S(n)$ are quite bigger than $S(n)$, so proving that this holds would be a possible line of attack.

EDIT 2

Noting that $\lim_{n\to\infty} \frac{n!^2}{S(n)}=1$, we have that $S(n)<n^{2n}$; hence, there is an important restriction on the size of the possible perfect powers. Proving a minimum size of the powers generating the "fixed" digits greater than $n^{2n}$ could be a way to solve the problem.

Note also that the number of "fixed" digits of $S(n)$ seems to be always near to $\frac{n}{2}$.

Juan Moreno
  • 1,110
  • A perfect even power is also a perfect square, so your second sentence is unnecessary given the OP. A number with last digit 5 is a multiple of 5, so your third bullet is likewise unnecessary. (I hope you see that the OP's focus on prime exponents is justified.) – mr_e_man Jul 10 '23 at 11:31
  • 1
    @mr_e_man I think that a self-contained answer is always better, although you are right. Of course, I see what you say about prime exponents, I just have focused on another way to approach the question, pointing out that repetition and continuous increase of "fixed" ending digits of $S(n)$ as $n$ grows is an important fact that could lead eventually to an answer in negative terms of the question posed at the OP – Juan Moreno Jul 10 '23 at 14:05
  • 1
    For n > 100 the last digits are 362944395975863609110502747608704759517069851817 – munichmath Jul 11 '23 at 12:22
2

A complete proof

First of all, $1248829|S(n)$ if $n\geq 1248828$ (as confirmed by this post and also by this link).

The question now arises, does $1248829^2|S(n)$ ever occur? If not we know that $S(n)$ will never be a perfect power if $n \geq 1248828$ as it has exactly one factor of $1248829$. To see that this can indeed never occur I will note that $1248829^2|(k!)^2$ if $k\geq 1248829$, thus, we only need to verify whether $1248829^2|S(1248828)$ holds. In fact we have $S(1248828)\equiv869856854002 \pmod {1248829^2}$, hence $S(n)$ will never be a perfect power if $n \geq 1248828$. (also, great work @mr_e_man for finding this)

For notation, let $b^e=S(n)$ denote the perfect power. This method is also adapted from one of the comments by mr_e_man.

First of all, I verified by brute force that $n > 10^5$.

Using $\lambda = 2^7 3^3 5^2 7^1 11^1 13^1$ and a modulus $M=2^{7+2}3^{3+1}5^{2+1}7^211^213^2 \cdot m\approx 6.7 \cdot 10^{640}$ with $m$ a product of all primes $13 < p < 100000$ such that for each prime $p$ dividing $m$ the factorization of $p-1$ is a divisor of $\lambda$ (note that $S(n)\bmod M$ is constant for $n\geq 100000$) I iterated through all integers $0\leq e<\lambda$ prime to $\lambda$ and calculated $b\equiv S(1000000)^{(1/e \bmod \lambda)} \pmod M$. The minimum of these values was $b=1.76 \cdot 10^{632}$. Hence $b > 10^{632}$. (for more information see the comment from mr_e_man).

From the OP, we know that a few perfect prime powers are impossible, I extended the search to all perfect (prime) powers up to $e \geq 3167$. That is, I found triples $(x, y, z)$ for all primes $x < 3167$ which fit into the sentence

Cannot be a perfect {x} power for all $n\geq${z} due to {y} not being a perfect {x} power modulo {z}.

The first of these triples are

[(2, 2, 3), (3, 3, 7), (5, 3, 11), (7, 9, 29), (11, 8, 23), (13, 7, 53),
(17, 43, 103), (19, 44, 191), (23, 30, 47), (29, 5, 59), (31, 62, 311),
(37, 88, 149), (41, 6, 83), (43, 87, 173), (47, 193, 283), (53, 3, 107),
(59, 534, 709), (61, 224, 367), (67, 244, 269), (71, 204, 569), (73, 288, 293),
(79, 234, 317), (83, 148, 167), (89, 7, 179), (97, 100, 389)]

Note that I kept $z<10^5$, as I only verified $n$ up to $10^5$. The first case for which $z > 10^5$ is the prime $3167$ (interestingly, most of these records of $z$ are listed in A233516).

Using the new lower bounds of $b$ and $e$, we get that $$b^e > 10^{2000000} > (204001!)^2 > S(204000)\,.$$ Without doing that much calculations we thus know that $n > 204000$. This gave a new minimum for $e$ as the triple $(3167, 50827, 114013)$ could now be found. In short: $$ n > 100000 \implies b > 10^{632}, e \geq 3167 \implies n > 204000 \implies e \geq 3833 \implies \\ n > 244000 \implies e \geq 5227 \implies n > 325000 \implies $$ $$ b > 1.589\cdot 10^{837} \textrm{(using $\lambda'=2\lambda$, $p<325000$, and $M\approx 2.8 \cdot 10^{844}$)} \implies n > 420000 \implies $$ $$ e \geq 6637 \implies n > 522000 \implies e \geq 12919 \implies \\ n > 950000 \implies e \geq 18637 \implies n > 1350000 $$ concluding the proof.

Any verification/double check is welcome.


Another try to prove it which failed.

This reasoning is an adaptation of @JuanMoreno's answer, but it extended to multiple modulos.

First, define $M=160$ to be our modulo, we have that $S(n) \equiv 137 \pmod M$ if $n \geq 4$. Also, if for all integers $0 \leq a < M$ we check whether $a^i \equiv 137 \pmod M$ holds for some integer $0 \leq i < \varphi(M)$ we get that $a = 137$ or $a = 153$ must hold. This implies that we must have $b \equiv 137,153 \pmod {160}$ since only then $b^e \equiv S(n) \equiv 137 \pmod {160}$ is possible.

After doing the same for $M=1456$, we get that $b\equiv 745,985 \pmod {1456}$ if $n \geq 12$ and chosing $M=1872$ we get $b \equiv 329,569 \pmod {1872}$ if $n \geq 12$.

Combining these relations we get that $$b \equiv 41753,54857,107033,120137 \pmod {131040}$$ must hold (note that all $n<12$ have been verified not to result in a perfect power).

Now we shift our attention to the exponent, $e$. @munichmath correctly commented the ending digits of $S(n)$ for $n>100$, for this example I will only be using the last $9$ digits, which are $069851817$ and which hold if $n \geq 24$ (note that again all $n < 24$ have been verified). Thus, we must have $b^e \equiv 69851817 \pmod {10^{9}}$.

Taking $b=41753$ gives the first such value $e=17150159$, however $$\log_{10} b^e = e \cdot \log_{10}b > 79\cdot 10^6 > 15\cdot 10^6 > 2 \log_{10} (1248829!) > \log_{10} S(1248828)\,.$$

Note that to run a faster search you can first work modulo $10^4$, determine the congruences for the exponent to deliver the correct last $4$ digits $1817$ and then use those congruences to search up to a higher limit modulo $10^9$. Since all $b \geq 41743$ the search limit $e$ up to $4\cdot10^6$ suffices.

This is where I got stuck, there are too much possible values for $b$ that I needed to search.

  • Also, to speed up my search of the triples, I was only interested in triples $(x, y, z)$ with $x$ prime, $z$ prime, and $z\equiv 1 \pmod x$. Iterating through those values I calculated $y\equiv S(x-1) \pmod z$ and checked if $y$ ever was an $x$th power modulo $z$ using a brute-force search. – jorisperrenet Jul 18 '23 at 06:13
  • *Mistake: I calculated $y=S(z-1) \bmod z$. – jorisperrenet Jul 18 '23 at 06:24
  • "I verified by brute force that $n>10^5$." - How did you do that? My program took several hours to get to $10^4$, with the time being approximately quadratic (so $10^5$ would take hundreds of hours). I mean, it can calculate $S(n)$ for all $n\leq10^4$ in seconds, but it takes much longer to check that they're not perfect powers. – mr_e_man Jul 18 '23 at 16:07
  • @mr_e_man, I used Python with the gmpy2.is_power() function. The package gmpy2 is a Python variant of the GMP library. The search limit of $10^5$ took only a few hours on a single core. – jorisperrenet Jul 18 '23 at 18:26
  • 1
    About your previous comment - If $z$ is prime and $z-1=qx$, then $y$ is an $x$th power $\bmod z$ if and only if $y^q\equiv0$ or $1\bmod z$. This test is much faster than calculating $z$ many $x$th powers and comparing them to $y$. – mr_e_man Jul 18 '23 at 18:44
  • @mr_e_man, thank you for this addition. That would indeed speed up the search for triples by approximately a factor $q$ (a HUGE speedup). FYI, the program that took the most time (apart from the brute force perfect power search up to $100\ 000$) was finding the lower bound on $b$, I did not loop through all coprimes of $\lambda$ efficiently. – jorisperrenet Jul 18 '23 at 19:36