33
44(@__DIR__ ) ∉ LOAD_PATH && push! (LOAD_PATH , (@__DIR__ ))
55
6- module GaussFactorial
6+ module GaussFactorials
77
88using Nemo, IterTools
99using RecordSearch, NumberTheory, Products
1010
11- export ModuleGaussFactorial, GaußFactorial
11+ export ModuleGaussFactorials, GaussFactorial
12+ export V216919, V001783, V055634, V232980, V232981, V232982, V124441, V124442, V066570
1213export I193338, F193338, L193338, V193338
1314export I193339, F193339, L193339, V193339
1415
1516"""
1617The Gauß factorial is ``∏_{1 ≤ j ≤ N, j ⊥ n} j``, the product of the positive integers which are ``≤ N`` and are prime to ``n``.
1718
18- * GaußFactorial , I193338, F193338, L193338, V193338, I193339, F193339, L193339, V193339
19+ * GaussFactorial , I193338, F193338, L193338, V193338, I193339, F193339, L193339, V193339, V216919, V001783, V055634, V232980, V232981, V232982, V124441, V124442, V066570
1920"""
20- const ModuleGaussFactorial = " "
21-
22- # A216919
21+ const ModuleGaussFactorials = " "
2322
2423"""
2524Return ``∏_{1 ≤ j ≤ N, j ⊥ n} j``, the product of the positive integers which are ``≤ N`` and are prime to ``n``.
2625"""
27- GaußFactorial (n) = prod ([j for j in 1 : Int (n) if ⊥ (j, n)])
26+ GaussFactorial (N, n) = ∏ ([j for j in 1 : Int (N) if ⊥ (j, n)])
27+
28+ """
29+ Return ``∏_{1 ≤ j ≤ n, j ⊥ n} j``, the product of the positive integers which are ``≤ n`` and are prime to ``n``.
30+ """
31+ GaussFactorial (n) = GaussFactorial (n, n)
32+
33+ # V000142(n) = n! = GaussFactorial(n, 1).
34+ # V001147(n) = GaussFactorial(2*n, 2), double factorial of odd numbers.
35+
36+ """
37+ Return GaussFactorial(N, n).
38+ """
39+ V216919 (N, n) = GaussFactorial (N, n)
40+
41+ """
42+ Return ``∏_{1 ≤ j ≤ n, j ⊥ n} j``, the product of the positive integers which are ``≤ N`` and are prime to ``n``, a.k.a. the phi-torial of n.
43+ """
44+ V001783 (n) = GaussFactorial (n, n)
45+
46+ """
47+ Return the 2-adic factorial of n.
48+ """
49+ V055634 (n) = GaussFactorial (n, 2 )* (- 1 )^ n
50+
51+ """
52+ Return GaussFactorial(n, 3).
53+ """
54+ V232980 (n) = GaussFactorial (n, 3 )
55+
56+ """
57+ Return GaussFactorial(n, 5).
58+ """
59+ V232981 (n) = GaussFactorial (n, 5 )
60+
61+ """
62+ Return GaussFactorial(n, 6).
63+ """
64+ V232982 (n) = GaussFactorial (n, 6 )
65+
66+ """
67+ Return GaussFactorial(div(n, 2), n).
68+ """
69+ V124441 (n) = GaussFactorial (div (n, 2 ), n)
70+
71+ """
72+ Return GaussFactorial(n, n)/GaussFactorial(div(n, 2), n).
73+ """
74+ V124442 (n) = div (GaussFactorial (n, n), GaussFactorial (div (n, 2 ), n))
75+
76+ """
77+ Return GaussFactorial(n, 1)/GaussFactorial(n, n).
78+ """
79+ V066570 (n) = div (GaussFactorial (n, 1 ), GaussFactorial (n, n))
2880
2981# -----------------------------------------------------------------
3082# Indices!
3183
3284"""
3385Iterate over the indices of the first ``n`` record values of the Gauß factorial.
3486"""
35- I193339 (n) = Records (GaußFactorial , n, true , true )
87+ I193339 (n) = Records (GaussFactorial , n, true , true )
3688
3789"""
3890Iterate over indices of the record values of the Gauß factorial which do not exceed ``n`` (``1 ≤ i ≤ n``).
3991"""
40- F193339 (n) = Records (GaußFactorial , n, false , true )
92+ F193339 (n) = Records (GaussFactorial , n, false , true )
4193
4294"""
4395Return the indices of the first ``n`` record values of the Gauß factorial as an array.
@@ -55,12 +107,12 @@ V193339(n) = nth(I193339(n), n)
55107"""
56108Iterate over the first ``n`` record values of the Gauß factorial (``1 ≤ r``).
57109"""
58- I193338 (n) = Records (GaußFactorial , n, true , false )
110+ I193338 (n) = Records (GaussFactorial , n, true , false )
59111
60112"""
61113Iterate over the record values of the Gauß factorial which do not exceed ``n`` (``1 ≤ i ≤ n``).
62114"""
63- F193338 (n) = Records (GaußFactorial , n, false , false )
115+ F193338 (n) = Records (GaussFactorial , n, false , false )
64116
65117"""
66118Return the first ``n`` record values of the Gauß factorial as an array.
@@ -74,14 +126,25 @@ V193338(n) = nth(I193338(n), n)
74126
75127# START-TEST-########################################################
76128
77- using Test
129+ using Test, SeqTests
78130
79131function test ()
132+
133+ @testset " GaussFactorial" begin
134+
135+ # @test
136+ if is_oeis_installed ()
137+
138+ V = [V001783, V124441, V124442, V066570]
139+ for v in V SeqTest (v, ' V' , 1 ) end
140+
141+ W = [V055634, V232980, V232981, V232982]
142+ for w in W SeqTest (w, ' V' , 0 ) end
143+ end
144+ end
80145end
81146
82147function demo ()
83- # 1, 3, 4, 5, 7, 9, 11, 13, 17, 19, ...
84-
85148 println (" \n Iterate over the indices of the first 10 record values of the Gauß factorial." )
86149 for r in I193339 (10 ) print (r, " , " ) end ; println (" ..." )
87150
@@ -122,26 +185,26 @@ end # module
122185
123186#=
124187Iterate over the indices of the first 10 record values ofthe Gauß factorial.
125- 0, 0 , 3, 4, 5, 7, 9, 11, 13, 17, ...
188+ 1 , 3, 4, 5, 7, 9, 11, 13, 17, ...
126189
127190Iterate over indices of the record values of the Gauß factorial which do not exceed 10.
128- 0, 0 , 3, 4, 5, 7, 9, ...
191+ 1 , 3, 4, 5, 7, 9, ...
129192
130193Return the indices of the first 10 record values of the Gauß factorial as an array.
131- Nemo.fmpz[0, 0 , 3, 4, 5, 7, 9, 11, 13, 17]
194+ Nemo.fmpz[1 , 3, 4, 5, 7, 9, 11, 13, 17]
132195
133196Return the index of the 9-th record value of the Gauß factorial.
1341979 -> 13
135198
136199Iterate over the first 10 record values of the Gauß factorial.
137- 0, 1, 2, 3, 24, 720, 2240, 3628800, 479001600, 20922789888000, ...
200+ 1, 2, 3, 24, 720, 2240, 3628800, 479001600, 20922789888000, ...
138201
139202Iterate over the record values of Gauß factorial which do
140203not exceed 10.
141- 0, 1, 2, 3, 24, 720, 2240, ...
204+ 1, 2, 3, 24, 720, 2240, ...
142205
143206Return the first 10 record values of the Gauß factorial as an array.
144- Nemo.fmpz[0, 1, 2, 3, 24, 720, 2240, 3628800, 479001600, 20922789888000]
207+ Nemo.fmpz[1, 2, 3, 24, 720, 2240, 3628800, 479001600, 20922789888000]
145208
146209Return the (value of the) 9-th record of the Gauß factorial.
1472109 -> 479001600
0 commit comments