using System.Collections.Generic;
using System.Numerics;
namespace Algorithms.Sequences;
///
///
/// Sequence of factorial numbers.
///
///
/// Wikipedia: https://en.wikipedia.org/wiki/Factorial.
///
///
/// OEIS: https://oeis.org/A000142.
///
///
public class FactorialSequence : ISequence
{
///
/// Gets sequence of factorial numbers.
///
public IEnumerable Sequence
{
get
{
var n = 0;
var factorial = new BigInteger(1);
while (true)
{
yield return factorial;
n++;
factorial *= n;
}
}
}
}