Skip to content

Commit 5410bdd

Browse files
committed
Pi
1 parent c564a6c commit 5410bdd

12 files changed

Lines changed: 3501 additions & 2749 deletions

Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ version = "0.2.0"
55
[deps]
66
Atom = "c52e3926-4ff0-5f6e-af25-54175e0327b1"
77
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
8+
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
89
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
910
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
1011
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"

demos/DistributedQueens.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ module QueensAlwaysPuzzleMe
22

33
using Distributed, BenchmarkTools
44

5-
# For some background see: https://wp.me/paipV7-E
65
# There is also a simple (i.e. not distributed) version:
76
# https://github.com/PeterLuschny/IntegerSequences.jl/blob/master/demos/SimpleQueens.jl
7+
# For some background see https://wp.me/paipV7-E and https://oeis.org/A319284
88

99
function solve!(profile, level, size, start, cols, diag4, diag1)
1010

docs/src/index.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ CantorMachine
8888
CantorPairing
8989
```
9090
```@docs
91+
CardinalityOfSetPartitionsWithShape
92+
```
93+
```@docs
9194
Central
9295
```
9396
```@docs
@@ -418,6 +421,9 @@ PartitionNumberList
418421
Pascal
419422
```
420423
```@docs
424+
Pi
425+
```
426+
```@docs
421427
Poly
422428
```
423429
```@docs
@@ -529,6 +535,9 @@ SetPartitions
529535
Sfactorial
530536
```
531537
```@docs
538+
ShapePartitions
539+
```
540+
```@docs
532541
ShowAsMatrix
533542
```
534543
```@docs
@@ -715,6 +724,9 @@ toΔ
715724
Ω
716725
```
717726
```@docs
727+
π
728+
```
729+
```@docs
718730
σ
719731
```
720732
```@docs
@@ -940,6 +952,9 @@ L000735
940952
L000739
941953
```
942954
```@docs
955+
L000796
956+
```
957+
```@docs
943958
G000957
944959
```
945960
```@docs

docs/src/modules.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,16 @@ For example consider the case n = 4. There are five integer partitions of 4:
456456

457457
See also [A260876](https://oeis.org/A260876).
458458

459+
  🔶  [SpigotPi](https://github.com/OpenLibMathSeq/IntegerSequences.jl/blob/master/src/SpigotPi.jl)
460+
461+
Computes the first n decimal digits of Pi, uses a variant of the spigot algorithm valid as long as the number of digits <= 54900.
462+
463+
Based on ideas of A. Sale (1968). Algorithm due to D. Saada (1988) and S. Rabinowitz (1991). Proof due to S. Rabinowitz and S. Wagon (1995).
464+
465+
https://www.maa.org/sites/default/files/pdf/pubs/amm_supplements/Monthly_Reference_12.pdf
466+
467+
* Pi, π, L000796
468+
459469
  🔶  [StirlingLahNumbers](https://github.com/OpenLibMathSeq/IntegerSequences.jl/blob/master/src/StirlingLahNumbers.jl)
460470

461471

src/BuildSequences.jl

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ docsrcdir = joinpath(docdir, "src")
3535
@info("The following modules are included in IntegerSequences.jl:")
3636

3737
exclude = [
38-
"SetPartitionsByShape.jl",
3938
"TemplateModule.jl",
4039
"BuildSequences.jl",
4140
"IntegerSequences.jl",
@@ -221,7 +220,7 @@ function build_seq()
221220
println(olm, "__precompile__()")
222221

223222
println(olm, "module IntegerSequences")
224-
println(olm, "using Nemo, IterTools, HTTP, DocStringExtensions")
223+
println(olm, "using Nemo, IterTools, DataStructures, HTTP, DocStringExtensions")
225224
# println(olm, "import AbstractAlgebra.lead")
226225

227226
for l in eachline(sor, keep = true)
@@ -252,10 +251,7 @@ function build_test()
252251
println(o, "srcdir ∉ LOAD_PATH && push!(LOAD_PATH, srcdir)")
253252

254253
println(o, "module runtests")
255-
println(
256-
o,
257-
"using Nemo, Test, SeqTests, IntegerSequences, IterTools"
258-
)
254+
println(o, "using Nemo, Test, SeqTests, IntegerSequences, IterTools, DataStructures")
259255

260256
path = joinpath(tstdir, "runtests.jl")
261257
i = open(path, "r")
@@ -331,7 +327,7 @@ function build_perf()
331327
println(o, "srcdir ∉ LOAD_PATH && push!(LOAD_PATH, srcdir)")
332328

333329
println(o, "module perftests")
334-
println(o, "using IntegerSequences, Dates, InteractiveUtils")
330+
println(o, "using IntegerSequences, DataStructures, Dates, InteractiveUtils")
335331

336332
println(o, "InteractiveUtils.versioninfo()")
337333
println(o, "start = Dates.now()")

src/GeneralizedBinomial.jl

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module GeneralizedBinomial
77
using Nemo, PrimesIterator, NumberTheory, Products, Triangles
88

99
export ModuleGeneralizedBinomial
10-
export Binomial, Pascal, T007318
10+
export Binomial, Pascal, T007318, Multinomial
1111

1212
"""
1313
@@ -94,6 +94,21 @@ function Binomial(n::Int, k::Int)
9494
ZZ(0)
9595
end
9696

97+
"""
98+
99+
Return the multinomial coefficient of a list.
100+
"""
101+
function Multinomial(lst::Array{Int})
102+
s = 0
103+
result = ZZ(1)
104+
for c in lst
105+
s += c
106+
result *= binom(s, c)
107+
end
108+
result
109+
end
110+
111+
97112
#START-TEST-########################################################
98113

99114
using Test

src/IntPartitions.jl

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55

66
module IntPartitions
77

8+
using GeneralizedBinomial
9+
810
export ModuleIntPartitions
9-
export IntegerPartitions, PartitionNumber, Multinomial
11+
export IntegerPartitions, PartitionNumber
1012
export PartOrder, byNumPart, byMaxPart
1113
export PartitionCoefficientsByLength, PartitionCoefficientsByBiggestPart
1214
export V000041, I072233, L072233, L036038, L078760, L005651, L262071, L292222
@@ -219,19 +221,6 @@ Return a list of the number of partitions of ``n`` into ``k`` parts.
219221
"""
220222
L072233(n) = collect(I072233(n))
221223

222-
"""
223-
224-
Return the multinomial coefficient of a list.
225-
"""
226-
function Multinomial(lst::Array{Int})
227-
s = 0
228-
result = 1
229-
for c in lst
230-
s += c
231-
result *= binomial(s, c)
232-
end
233-
result
234-
end
235224

236225
"""
237226

0 commit comments

Comments
 (0)