-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.go
More file actions
87 lines (72 loc) · 2.47 KB
/
example.go
File metadata and controls
87 lines (72 loc) · 2.47 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package lucas
import "math/big"
// GenerateFibonacci returns first n Fibonacci numbers (F[0] to F[n-1])
// e.g. [0 1 1 2 3 5 8 13 21 34 55]
func GenerateFibonacci(n uint) []*big.Int {
return GenerateSequenceU(1, -1, n)
}
// NthFibonacci returns n-th Fibonacci number (zero-indexed)
// e.g. F[10] = 55
func NthFibonacci(n uint) *big.Int {
return NthSequenceU(1, -1, n)
}
// GenerateLucas returns first n Lucas numbers (L[0] to L[n-1])
// e.g. [2 1 3 4 7 11 18 29 47 76 123]
func GenerateLucas(n uint) []*big.Int {
return GenerateSequenceV(1, -1, n)
}
// NthLucas returns n-th Lucas number (zero-indexed)
// e.g. L[10] = 123
func NthLucas(n uint) *big.Int {
return NthSequenceV(1, -1, n)
}
// GeneratePell returns first n Pell numbers (P[0] to P[n-1])
// e.g. [0 1 2 5 12 29 70 169 408 985 2378]
func GeneratePell(n uint) []*big.Int {
return GenerateSequenceU(2, -1, n)
}
// NthPell returns n-th Pell number (zero-indexed)
// e.g. P[10] = 2378
func NthPell(n uint) *big.Int {
return NthSequenceU(2, -1, n)
}
// GeneratePellLucas returns first n Pell-Lucas (companion Pell) numbers (Q[0] to Q[n-1])
// e.g. [2 2 6 14 34 82 198 478 1154 2786 6726]
func GeneratePellLucas(n uint) []*big.Int {
return GenerateSequenceV(2, -1, n)
}
// NthPellLucas returns n-th Pell-Lucas (companion Pell) number (zero-indexed)
// e.g. Q[10] = 6726
func NthPellLucas(n uint) *big.Int {
return NthSequenceV(2, -1, n)
}
// GenerateCounting returns first n counting numbers (0 to n-1)
// e.g. [0 1 2 3 4 5 6 7 8 9 10]
func GenerateCounting(n uint) []*big.Int {
return GenerateSequenceU(2, 1, n)
}
// NthCounting returns n-th counting number (zero-indexed)
// e.g. N[10] = 10
func NthCounting(n uint) *big.Int {
return NthSequenceU(2, 1, n)
}
// GenerateJacobsthal returns first n Jacobsthal numbers (J[0] to J[n-1])
// e.g. [0 1 1 3 5 11 21 43 85 171 341]
func GenerateJacobsthal(n uint) []*big.Int {
return GenerateSequenceU(1, -2, n)
}
// NthJacobsthal returns n-th Jacobsthal number (zero-indexed)
// e.g. J[10] = 341
func NthJacobsthal(n uint) *big.Int {
return NthSequenceU(1, -2, n)
}
// GenerateJacobsthalLucas returns first n Jacobsthal-Lucas (companion Jacobsthal) numbers (j[0] to j[n-1])
// e.g. [2 1 5 7 17 31 65 127 257 511 1025]
func GenerateJacobsthalLucas(n uint) []*big.Int {
return GenerateSequenceV(1, -2, n)
}
// NthJacobsthalLucas returns n-th Jacobsthal-Lucas (companion Jacobsthal) number (zero-indexed)
// e.g. j[10] = 1025
func NthJacobsthalLucas(n uint) *big.Int {
return NthSequenceV(1, -2, n)
}