Alternating factorial


In mathematics, an alternating factorial is the absolute value of the alternating sum of the first n factorials of positive integers.
This is the same as their sum, with the odd-indexed factorials multiplied by −1 if n is even, and the even-indexed factorials multiplied by −1 if n is odd, resulting in an alternation of signs of the summands. To put it algebraically,
or with the recurrence relation
in which af = 1.
The first few alternating factorials are
For example, the third alternating factorial is 1! − 2! + 3!. The fourth alternating factorial is −1! + 2! - 3! + 4! = 19. Regardless of the parity of n, the last summand, n!, is given a positive sign, the th summand is given a negative sign, and the signs of the lower-indexed summands are alternated accordingly.
This pattern of alternation ensures the resulting sums are all positive integers. Changing the rule so that either the odd- or even-indexed summands are given negative signs changes the signs of the resulting sums but not their absolute values.
Miodrag Zivković proved in 1999 that there are only a finite number of alternating factorials that are also prime numbers, since 3612703 divides af and therefore divides af for all n ≥ 3612702., the known primes and probable primes are af for
Only the values up to n = 661 have been proved prime in 2006. af is approximately 7.818097272875 × 101578.