- Notifications
You must be signed in to change notification settings - Fork 1.6k
/
Copy pathKummerNumbersSequence.cs
36 lines (33 loc) · 899 Bytes
/
KummerNumbersSequence.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Numerics;
namespaceAlgorithms.Sequences;
/// <summary>
/// <para>
/// Sequence of Kummer numbers (also called Euclid numbers of the second kind):
/// -1 + product of first n consecutive primes.
/// </para>
/// <para>
/// Wikipedia: https://wikipedia.org/wiki/Euclid_number.
/// </para>
/// <para>
/// OEIS: https://oeis.org/A057588.
/// </para>
/// </summary>
publicclassKummerNumbersSequence:ISequence
{
/// <summary>
/// Gets sequence of Kummer numbers.
/// </summary>
publicIEnumerable<BigInteger>Sequence
{
get
{
varprimorialNumbers=newPrimorialNumbersSequence().Sequence.Skip(1);
foreach(varninprimorialNumbers)
{
yieldreturnn-1;
}
}
}
}