# Primes made from alternating factorials

While messing around with factorials, I noticed this:

$$3! - 2! + 1! = 6 - 2 + 1 = 5$$ $$4! - 3! + 2! - 1!= 24 - 6 + 2 - 1=19$$ $$5! - 4! + 3! - 2! + 1! = 5! - 19 = 101$$ $$6! - 5! + 4! - 3! + 2! - 1! = 6! - 101 = 619$$ $$7! - 6! + 5! - 4! + 3! - 2! + 1! = 7! - 619 = 4421$$

Notice that all of the sums are prime.

My question, is, does this pattern (i.e. the results are prime) continue forever? (If yes, please prove why. If no, please provide a counterexample, and why it happens.)

My attempt was to show that for every positive integer $$n > 2$$, $$(n - 1)! - (n + 2)! + (n + 3)! - (n + 4)!$$ (and so on) $$= k$$, and prove that $$k$$ is not divisible by any prime below or equal to $$(n - 1)$$. (Which by the way, I almost proved it. Will edit this post if I did it.)

But, I am really confused on how to show that $$k$$ is not divisible by any prime bigger than $$(n - 1).$$ Is my approach to solve this problem correct?

• The law of small numbers is quite powerful... The sequence can be taken as $a_n=n!-a_{n-1}$, so that may help further calculations. Dec 1 '21 at 1:36
• Try $n=9$ for counterexample Dec 1 '21 at 1:37
• Oops, again I asked a really easy question that has an easy counterexample. I guess I should check at least 15 possibilities first before asking... Dec 1 '21 at 1:40
• It is still an interesting observation. Dec 1 '21 at 1:43
• See M. Zivkovic, The number of primes Sum_{i=1..n} (-1)^(n-i)*i! is finite, Math. Comp. 68 (1999), pp. 403-409, cited in OEIS A005165. An OEIS search is the first thing you should try on problems like this. Dec 1 '21 at 1:53