Skip to content

Commit cb54a85

Browse files
committed
nyu
1 parent e99eedf commit cb54a85

13 files changed

Lines changed: 206 additions & 90 deletions

demos/bfile.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ function write_oeis_bfile(anum, range, seq, comments, targetdir)
2525
end
2626
println(file, n, " ", val)
2727
end
28+
print("\n")
2829
close(file)
2930
end
3031

docs/src/index.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,6 @@ JacobiTheta4Powers
205205
KolakoskiList
206206
```
207207
```@docs
208-
LF097805
209-
```
210-
```@docs
211208
List
212209
```
213210
```@docs
@@ -481,6 +478,9 @@ RecTriangle
481478
Records
482479
```
483480
```@docs
481+
RecordsCached
482+
```
483+
```@docs
484484
ReflectPoly
485485
```
486486
```@docs
@@ -694,9 +694,6 @@ toΔ
694694
Ω
695695
```
696696
```@docs
697-
π
698-
```
699-
```@docs
700697
σ
701698
```
702699
```@docs

src/Compositions.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module Compositions
88
using Nemo, IterTools, Triangles
99

1010
export ModuleCompositions
11-
export T097805, LF097805, V097805, M097805
11+
export T097805, L097805, V097805, M097805
1212
# The module SetPartitionsMType contains : P097805, L097805, TL097805,
1313

1414
"""
@@ -36,7 +36,7 @@ T097805(n) = RecTriangle(n, R097805)
3636
3737
Lists the first ``n`` rows of A097805 by concatinating. This is the format for submissions to the OEIS.
3838
"""
39-
LF097805(n) = vcat(T097805(n)...)
39+
L097805(n) = vcat(T097805(n)...)
4040

4141
"""
4242
@@ -66,7 +66,7 @@ function demo()
6666
end
6767

6868
println("\nLists the first 9 rows of L097805 by concatinating.")
69-
println(LF097805(9))
69+
println(L097805(9))
7070

7171
#ShowAsMatrix(L097805(9))
7272
#println(M097805(9))
@@ -85,7 +85,7 @@ function demo()
8585
println("\nBenchmark the construction of the first 500 rows of A097805 based on Iteration.\n")
8686
# 0.111066 seconds (253.51 k allocations: 7.795 MiB)
8787
GC.gc()
88-
@time LF097805(500)
88+
@time L097805(500)
8989

9090
println("\nBenchmark the construction of the first 500 rows of A097805 based on closed formula.")
9191
# Result: 0.479466 seconds (1.72 M allocations: 21.592 MiB)
@@ -109,7 +109,7 @@ L097805(500) :: 0.111066 seconds (253.51 k allocations: 7.795 MiB)
109109
"""
110110
function perf()
111111
GC.gc()
112-
@time LF097805(500)
112+
@time L097805(500)
113113
end
114114

115115
function main()

src/GaussFactorials.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,13 @@ V066570(n) = div(GaussFactorial(n, 1), GaussFactorial(n, n))
9898
9999
Iterate over the indices of the first ``n`` record values of the Gauß factorial.
100100
"""
101-
I193339(n) = Records(GaussFactorial, n, true, true, Dict())
101+
I193339(n) = Records(GaussFactorial, n, true, true)
102102

103103
"""
104104
105105
Iterate over indices of the record values of the Gauß factorial which do not exceed ``n`` (``1 ≤ i ≤ n``).
106106
"""
107-
F193339(n) = Records(GaussFactorial, n, false, true, Dict())
107+
F193339(n) = Records(GaussFactorial, n, false, true)
108108

109109
"""
110110
@@ -125,13 +125,13 @@ V193339(n) = nth(I193339(n+1), n+1)
125125
126126
Iterate over the first ``n`` record values of the Gauß factorial (``1 ≤ r``).
127127
"""
128-
I193338(n) = Records(GaussFactorial, n, true, false, Dict())
128+
I193338(n) = Records(GaussFactorial, n, true, false)
129129

130130
"""
131131
132132
Iterate over the record values of the Gauß factorial which do not exceed ``n`` (``1 ≤ i ≤ n``).
133133
"""
134-
F193338(n) = Records(GaussFactorial, n, false, false, Dict())
134+
F193338(n) = Records(GaussFactorial, n, false, false)
135135

136136
"""
137137

src/HighlyAbundant.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ const ModuleHighlyAbundant = ""
2424
2525
Iterate over the first ``n`` highly abundant numbers.
2626
"""
27-
I002093(n) = Records(σ, n, true, true, Dict())
27+
I002093(n) = Records(σ, n, true, true)
2828

2929
"""
3030
3131
Iterate over the highly abundant numbers which do not exceed ``n`` (``1 ≤ i ≤ n``).
3232
"""
33-
F002093(n) = Records(σ, n, false, true, Dict())
33+
F002093(n) = Records(σ, n, false, true)
3434

3535
"""
3636
@@ -52,13 +52,13 @@ V002093(n) = nth(I002093(n+1), n+1)
5252
5353
Iterate over the first ``n`` record values of sigma.
5454
"""
55-
I034885(n) = Records(σ, n, true, false, Dict())
55+
I034885(n) = Records(σ, n, true, false)
5656

5757
"""
5858
5959
Iterate over the record values of sigma the indices of which do not exceed ``n`` (``1 ≤ r ≤ n``).
6060
"""
61-
F034885(n) = Records(σ, n, false, false, Dict())
61+
F034885(n) = Records(σ, n, false, false)
6262

6363
"""
6464

src/IntegerSequences.jl

Lines changed: 69 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# Copyright Peter Luschny. License is MIT.
33
# This file includes parts from Combinatorics.jl in modified form.
44

5-
# Version of: UTC 2019-11-06 01:35:53
6-
# 63b05410-002d-11ea-3957-070f416b5206
5+
# Version of: UTC 2019-11-06 13:47:27
6+
# 966f98f0-0093-11ea-1a21-434e877baaf5
77

88
# Do not edit this file, it is generated from the modules and will be overwritten!
99
# Edit the modules in the src directory and build this file with BuildSequences.jl!
@@ -80,7 +80,6 @@ InvOrthoPoly,
8080
JacobiTheta3Powers,
8181
JacobiTheta4Powers,
8282
KolakoskiList,
83-
LF097805,
8483
List,
8584
ModuleAbundant,
8685
ModuleAndreNumbers,
@@ -172,6 +171,7 @@ RamanujanTau,
172171
RamanujanTauList,
173172
RecTriangle,
174173
Records,
174+
RecordsCached,
175175
ReflectPoly,
176176
RiordanProduct,
177177
RiordanSquare,
@@ -243,7 +243,6 @@ oeis_writebfile,
243243
takeFirst,
244244
toΔ,
245245
Ω,
246-
π,
247246
σ,
248247
σ2,
249248
τ,
@@ -2621,7 +2620,7 @@ T097805(n) = RecTriangle(n, R097805)
26212620
Lists the first ``n`` rows of A097805 by concatinating. This is the format for submissions to the OEIS.
26222621
$(SIGNATURES)
26232622
"""
2624-
LF097805(n) = vcat(T097805(n)...)
2623+
L097805(n) = vcat(T097805(n)...)
26252624
"""
26262625
26272626
Return the triangular array as a square matrix.
@@ -4468,13 +4467,13 @@ V066570(n) = div(GaussFactorial(n, 1), GaussFactorial(n, n))
44684467
Iterate over the indices of the first ``n`` record values of the Gauß factorial.
44694468
$(SIGNATURES)
44704469
"""
4471-
I193339(n) = Records(GaussFactorial, n, true, true, Dict())
4470+
I193339(n) = Records(GaussFactorial, n, true, true)
44724471
"""
44734472
44744473
Iterate over indices of the record values of the Gauß factorial which do not exceed ``n`` (``1 ≤ i ≤ n``).
44754474
$(SIGNATURES)
44764475
"""
4477-
F193339(n) = Records(GaussFactorial, n, false, true, Dict())
4476+
F193339(n) = Records(GaussFactorial, n, false, true)
44784477
"""
44794478
44804479
Return the indices of the first ``n`` record values of the Gauß factorial as an array.
@@ -4492,13 +4491,13 @@ V193339(n) = nth(I193339(n+1), n+1)
44924491
Iterate over the first ``n`` record values of the Gauß factorial (``1 ≤ r``).
44934492
$(SIGNATURES)
44944493
"""
4495-
I193338(n) = Records(GaussFactorial, n, true, false, Dict())
4494+
I193338(n) = Records(GaussFactorial, n, true, false)
44964495
"""
44974496
44984497
Iterate over the record values of the Gauß factorial which do not exceed ``n`` (``1 ≤ i ≤ n``).
44994498
$(SIGNATURES)
45004499
"""
4501-
F193338(n) = Records(GaussFactorial, n, false, false, Dict())
4500+
F193338(n) = Records(GaussFactorial, n, false, false)
45024501
"""
45034502
45044503
Return the first ``n`` record values of the Gauß factorial as an array.
@@ -4668,13 +4667,13 @@ const ModuleHighlyAbundant = ""
46684667
Iterate over the first ``n`` highly abundant numbers.
46694668
$(SIGNATURES)
46704669
"""
4671-
I002093(n) = Records(σ, n, true, true, Dict())
4670+
I002093(n) = Records(σ, n, true, true)
46724671
"""
46734672
46744673
Iterate over the highly abundant numbers which do not exceed ``n`` (``1 ≤ i ≤ n``).
46754674
$(SIGNATURES)
46764675
"""
4677-
F002093(n) = Records(σ, n, false, true, Dict())
4676+
F002093(n) = Records(σ, n, false, true)
46784677
"""
46794678
46804679
Return the first ``n`` highly abundant numbers as an array.
@@ -4692,13 +4691,13 @@ V002093(n) = nth(I002093(n+1), n+1)
46924691
Iterate over the first ``n`` record values of sigma.
46934692
$(SIGNATURES)
46944693
"""
4695-
I034885(n) = Records(σ, n, true, false, Dict())
4694+
I034885(n) = Records(σ, n, true, false)
46964695
"""
46974696
46984697
Iterate over the record values of sigma the indices of which do not exceed ``n`` (``1 ≤ r ≤ n``).
46994698
$(SIGNATURES)
47004699
"""
4701-
F034885(n) = Records(σ, n, false, false, Dict())
4700+
F034885(n) = Records(σ, n, false, false)
47024701
"""
47034702
47044703
Return the first ``n`` record values of sigma as an array.
@@ -7140,7 +7139,7 @@ const ModuleRecordSearch = ""
71407139
The type object to construct an iterated search for records in sequences.
71417140
$(SIGNATURES)
71427141
"""
7143-
struct Records
7142+
struct RecordsCached
71447143
"function representing the sequence"
71457144
fun::Function
71467145
"search limit OR search length"
@@ -7152,17 +7151,16 @@ index::Bool
71527151
"the records"
71537152
records
71547153
end
7155-
Base.iterate(::Records) = (ZZ(1), (ZZ(1), ZZ(0), ZZ(1)))
7154+
Base.iterate(::RecordsCached) = (ZZ(1), (ZZ(1), ZZ(0), ZZ(1)))
71567155
"""
71577156
71587157
Return the value or the index of the next record.
71597158
$(SIGNATURES)
71607159
"""
7161-
function Base.iterate(R::Records, state)
7160+
function Base.iterate(R::RecordsCached, state)
71627161
h, n, s = state
71637162
if (R.below ? s : n) >= R.lim
7164-
println()
7165-
println(R.records)
7163+
println(); println(R.records)
71667164
return nothing
71677165
end
71687166
while true
@@ -7174,6 +7172,38 @@ end
71747172
n += 1
71757173
end
71767174
end
7175+
Base.length(R::RecordsCached) = R.lim
7176+
Base.eltype(R::RecordsCached) = fmpz
7177+
"""
7178+
7179+
The type object to construct an iterated search for records in sequences.
7180+
$(SIGNATURES)
7181+
"""
7182+
struct Records
7183+
"function representing the sequence"
7184+
fun::Function
7185+
"search limit OR search length"
7186+
lim::Int
7187+
"true ↦ search all below lim, false ↦ search length items"
7188+
below::Bool
7189+
"true ↦ return index of record, false ↦ return value of record"
7190+
index::Bool
7191+
end
7192+
Base.iterate(::Records) = (ZZ(1), (ZZ(1), ZZ(0), ZZ(1)))
7193+
"""
7194+
7195+
Return the value or the index of the next record.
7196+
$(SIGNATURES)
7197+
"""
7198+
function Base.iterate(R::Records, state)
7199+
h, n, s = state
7200+
(R.below ? s : n) >= R.lim && return nothing
7201+
while true
7202+
v = R.fun(n)
7203+
v > h && return (R.index ? n : v, (v, n + 1, s + 1))
7204+
n += 1
7205+
end
7206+
end
71777207
Base.length(R::Records) = R.lim
71787208
Base.eltype(R::Records) = fmpz
71797209
# *** RiordanSquares.jl ****************
@@ -7415,6 +7445,11 @@ Alias for is_oeis_installed.
74157445
$(SIGNATURES)
74167446
"""
74177447
data_installed() = is_oeis_installed()
7448+
"""
7449+
7450+
Perform tests for an array of sequences of given type assuming the given offset.
7451+
$(SIGNATURES)
7452+
"""
74187453
function SeqTest(seqarray, kind, offset = 0)
74197454
if kind == 'V'
74207455
return SeqVTest(seqarray, offset)
@@ -7495,6 +7530,11 @@ ShowAsΔ(S)
74957530
end
74967531
end
74977532
end
7533+
"""
7534+
7535+
Test to generate sequences from a given list of sequences.
7536+
$(SIGNATURES)
7537+
"""
74987538
function GenerateAllTest(A::Array{Function,1})
74997539
err = String[]
75007540
for a A
@@ -7518,9 +7558,7 @@ elseif startswith(stra, "is")
75187558
elseif startswith(stra, 'I')
75197559
collect(a(6)) |> println
75207560
elseif startswith(stra, 'F')
7521-
w = fmpz[]
7522-
for r a(20) push!(w, r) end
7523-
println(w)
7561+
collect(IterTools.takewhile(k -> k <= 20, a(21))) |> println
75247562
elseif startswith(stra, 'P')
75257563
for k 0:4 a(k) |> println end
75267564
elseif startswith(stra, 'R')
@@ -7537,7 +7575,12 @@ else
75377575
[a(2, k) for k 0:6] |> println
75387576
end
75397577
else
7540-
"??? \n" |> print
7578+
if applicable(a, 1)
7579+
[a(k) for k 0:6] |> println
7580+
else
7581+
[a(0, k) for k 0:6] |> println
7582+
[a(2, k) for k 0:6] |> println
7583+
end
75417584
end
75427585
catch
75437586
"ERROR!" |> println
@@ -7546,7 +7589,8 @@ end
75467589
end
75477590
numerr = length(err)
75487591
if numerr > 0
7549-
@warn(numerr, " errors found:\n", err)
7592+
@warn(numerr, " errors found:")
7593+
for e err println(e) end
75507594
end
75517595
return numerr
75527596
end
@@ -8123,13 +8167,13 @@ P097805(n) = OrderedSetPolynomials(0, n)
81238167
81248168
Return the number of ordered set partitions of an ``n``-set which are of shape type ``0``.
81258169
```julia-repl
8126-
julia> L097805(3)
8170+
julia> TL097805(3)
81278171
4-element Array{Nemo.fmpz,1}:
81288172
[0, 1, 2, 1]
81298173
```
81308174
$(SIGNATURES)
81318175
"""
8132-
L097805(n) = Coeffs(OrderedSetPolynomials(0, n))
8176+
TL097805(n) = Coeffs(OrderedSetPolynomials(0, n))
81338177
"""
81348178
81358179
Return the first ``len`` rows of the triangle of compositions of ``n``.

0 commit comments

Comments
 (0)