|
|
Article: An improved algorithm for calculating the sum-of-factorials function.
- Article from:
- Scientia Magna
- Article date:
- January 1, 2005
- Author:
CopyrightCOPYRIGHT 2005 American Research Press. This material is published under license from the publisher through the Gale Group, Farmington Hills, Michigan. All inquiries regarding rights should be directed to the Gale Group. (Hide copyright information)
|
Abstract The sum of factorials function, also known as the left factorial function, is defined as !n = 0! + 1! + ... + (n - 1)!. These have been used by Smarandache and Kurepa to define the Smarandache-Kurepa Function (see reference [1], [2]). This paper presents an effective method for calculating !n, and implements the Smarandache-Kurepa function by using one new method.
1. Introduction
We define !n as 0! + 1! + ... + (n - 1)!.
A simple PARI/GP program to calculate these values is below:
sof f(n) = [n-1.summation over (i=0)]i!
Then, for(i = 0; 10, print1(","soff(i))) gives the desired output; 0, 1, 2, 4, 10, 34, 154, 874, ...