Metamath Proof Explorer


Theorem stirlinglem7

Description: Algebraic manipulation of the formula for J(n). (Contributed by Glauco Siliprandi, 29-Jun-2017)

Ref Expression
Hypotheses stirlinglem7.1 J = n 1 + 2 n 2 log n + 1 n 1
stirlinglem7.2 K = k 1 2 k + 1 1 2 N + 1 2 k
stirlinglem7.3 H = k 0 2 1 2 k + 1 1 2 N + 1 2 k + 1
Assertion stirlinglem7 N seq 1 + K J N

Proof

Step Hyp Ref Expression
1 stirlinglem7.1 J = n 1 + 2 n 2 log n + 1 n 1
2 stirlinglem7.2 K = k 1 2 k + 1 1 2 N + 1 2 k
3 stirlinglem7.3 H = k 0 2 1 2 k + 1 1 2 N + 1 2 k + 1
4 nnuz = 1
5 1zzd N 1
6 1e0p1 1 = 0 + 1
7 6 a1i N 1 = 0 + 1
8 7 seqeq1d N seq 1 + H = seq 0 + 1 + H
9 nn0uz 0 = 0
10 0nn0 0 0
11 10 a1i N 0 0
12 oveq2 k = j 2 k = 2 j
13 12 oveq1d k = j 2 k + 1 = 2 j + 1
14 13 oveq2d k = j 1 2 k + 1 = 1 2 j + 1
15 13 oveq2d k = j 1 2 N + 1 2 k + 1 = 1 2 N + 1 2 j + 1
16 14 15 oveq12d k = j 1 2 k + 1 1 2 N + 1 2 k + 1 = 1 2 j + 1 1 2 N + 1 2 j + 1
17 16 oveq2d k = j 2 1 2 k + 1 1 2 N + 1 2 k + 1 = 2 1 2 j + 1 1 2 N + 1 2 j + 1
18 simpr N j 0 j 0
19 2cnd N j 0 2
20 2cnd j 0 2
21 nn0cn j 0 j
22 20 21 mulcld j 0 2 j
23 1cnd j 0 1
24 22 23 addcld j 0 2 j + 1
25 24 adantl N j 0 2 j + 1
26 0red j 0 0
27 2re 2
28 27 a1i j 0 2
29 nn0re j 0 j
30 28 29 remulcld j 0 2 j
31 1red j 0 1
32 0le2 0 2
33 32 a1i j 0 0 2
34 nn0ge0 j 0 0 j
35 28 29 33 34 mulge0d j 0 0 2 j
36 0lt1 0 < 1
37 36 a1i j 0 0 < 1
38 30 31 35 37 addgegt0d j 0 0 < 2 j + 1
39 26 38 ltned j 0 0 2 j + 1
40 39 adantl N j 0 0 2 j + 1
41 40 necomd N j 0 2 j + 1 0
42 25 41 reccld N j 0 1 2 j + 1
43 nncn N N
44 43 adantr N j 0 N
45 19 44 mulcld N j 0 2 N
46 1cnd N j 0 1
47 45 46 addcld N j 0 2 N + 1
48 27 a1i N 2
49 nnre N N
50 48 49 remulcld N 2 N
51 1red N 1
52 32 a1i N 0 2
53 0red N 0
54 nngt0 N 0 < N
55 53 49 54 ltled N 0 N
56 48 49 52 55 mulge0d N 0 2 N
57 36 a1i N 0 < 1
58 50 51 56 57 addgegt0d N 0 < 2 N + 1
59 58 gt0ne0d N 2 N + 1 0
60 59 adantr N j 0 2 N + 1 0
61 47 60 reccld N j 0 1 2 N + 1
62 2nn0 2 0
63 62 a1i N j 0 2 0
64 63 18 nn0mulcld N j 0 2 j 0
65 1nn0 1 0
66 65 a1i N j 0 1 0
67 64 66 nn0addcld N j 0 2 j + 1 0
68 61 67 expcld N j 0 1 2 N + 1 2 j + 1
69 42 68 mulcld N j 0 1 2 j + 1 1 2 N + 1 2 j + 1
70 19 69 mulcld N j 0 2 1 2 j + 1 1 2 N + 1 2 j + 1
71 3 17 18 70 fvmptd3 N j 0 H j = 2 1 2 j + 1 1 2 N + 1 2 j + 1
72 71 70 eqeltrd N j 0 H j
73 3 stirlinglem6 N seq 0 + H log N + 1 N
74 9 11 72 73 clim2ser N seq 0 + 1 + H log N + 1 N seq 0 + H 0
75 8 74 eqbrtrd N seq 1 + H log N + 1 N seq 0 + H 0
76 0z 0
77 seq1 0 seq 0 + H 0 = H 0
78 76 77 mp1i N seq 0 + H 0 = H 0
79 3 a1i N H = k 0 2 1 2 k + 1 1 2 N + 1 2 k + 1
80 simpr N k = 0 k = 0
81 80 oveq2d N k = 0 2 k = 2 0
82 81 oveq1d N k = 0 2 k + 1 = 2 0 + 1
83 82 oveq2d N k = 0 1 2 k + 1 = 1 2 0 + 1
84 82 oveq2d N k = 0 1 2 N + 1 2 k + 1 = 1 2 N + 1 2 0 + 1
85 83 84 oveq12d N k = 0 1 2 k + 1 1 2 N + 1 2 k + 1 = 1 2 0 + 1 1 2 N + 1 2 0 + 1
86 85 oveq2d N k = 0 2 1 2 k + 1 1 2 N + 1 2 k + 1 = 2 1 2 0 + 1 1 2 N + 1 2 0 + 1
87 2cnd N 2
88 0cnd N 0
89 87 88 mulcld N 2 0
90 1cnd N 1
91 89 90 addcld N 2 0 + 1
92 87 mul01d N 2 0 = 0
93 92 eqcomd N 0 = 2 0
94 93 oveq1d N 0 + 1 = 2 0 + 1
95 7 94 eqtrd N 1 = 2 0 + 1
96 57 95 breqtrd N 0 < 2 0 + 1
97 96 gt0ne0d N 2 0 + 1 0
98 91 97 reccld N 1 2 0 + 1
99 87 43 mulcld N 2 N
100 99 90 addcld N 2 N + 1
101 100 59 reccld N 1 2 N + 1
102 95 65 eqeltrrdi N 2 0 + 1 0
103 101 102 expcld N 1 2 N + 1 2 0 + 1
104 98 103 mulcld N 1 2 0 + 1 1 2 N + 1 2 0 + 1
105 87 104 mulcld N 2 1 2 0 + 1 1 2 N + 1 2 0 + 1
106 79 86 11 105 fvmptd N H 0 = 2 1 2 0 + 1 1 2 N + 1 2 0 + 1
107 92 oveq1d N 2 0 + 1 = 0 + 1
108 107 6 eqtr4di N 2 0 + 1 = 1
109 108 oveq2d N 1 2 0 + 1 = 1 1
110 90 div1d N 1 1 = 1
111 109 110 eqtrd N 1 2 0 + 1 = 1
112 108 oveq2d N 1 2 N + 1 2 0 + 1 = 1 2 N + 1 1
113 101 exp1d N 1 2 N + 1 1 = 1 2 N + 1
114 112 113 eqtrd N 1 2 N + 1 2 0 + 1 = 1 2 N + 1
115 111 114 oveq12d N 1 2 0 + 1 1 2 N + 1 2 0 + 1 = 1 1 2 N + 1
116 101 mulid2d N 1 1 2 N + 1 = 1 2 N + 1
117 115 116 eqtrd N 1 2 0 + 1 1 2 N + 1 2 0 + 1 = 1 2 N + 1
118 117 oveq2d N 2 1 2 0 + 1 1 2 N + 1 2 0 + 1 = 2 1 2 N + 1
119 87 90 100 59 divassd N 2 1 2 N + 1 = 2 1 2 N + 1
120 87 mulid1d N 2 1 = 2
121 120 oveq1d N 2 1 2 N + 1 = 2 2 N + 1
122 118 119 121 3eqtr2d N 2 1 2 0 + 1 1 2 N + 1 2 0 + 1 = 2 2 N + 1
123 78 106 122 3eqtrd N seq 0 + H 0 = 2 2 N + 1
124 123 oveq2d N log N + 1 N seq 0 + H 0 = log N + 1 N 2 2 N + 1
125 75 124 breqtrd N seq 1 + H log N + 1 N 2 2 N + 1
126 90 99 addcld N 1 + 2 N
127 126 halfcld N 1 + 2 N 2
128 seqex seq 1 + K V
129 128 a1i N seq 1 + K V
130 elnnuz j j 1
131 130 biimpi j j 1
132 131 adantl N j j 1
133 oveq2 k = n 2 k = 2 n
134 133 oveq1d k = n 2 k + 1 = 2 n + 1
135 134 oveq2d k = n 1 2 k + 1 = 1 2 n + 1
136 134 oveq2d k = n 1 2 N + 1 2 k + 1 = 1 2 N + 1 2 n + 1
137 135 136 oveq12d k = n 1 2 k + 1 1 2 N + 1 2 k + 1 = 1 2 n + 1 1 2 N + 1 2 n + 1
138 137 oveq2d k = n 2 1 2 k + 1 1 2 N + 1 2 k + 1 = 2 1 2 n + 1 1 2 N + 1 2 n + 1
139 elfzuz n 1 j n 1
140 elnnuz n n 1
141 140 biimpri n 1 n
142 nnnn0 n n 0
143 139 141 142 3syl n 1 j n 0
144 143 adantl N j n 1 j n 0
145 2cnd N j n 1 j 2
146 144 nn0cnd N j n 1 j n
147 145 146 mulcld N j n 1 j 2 n
148 1cnd N j n 1 j 1
149 147 148 addcld N j n 1 j 2 n + 1
150 elfznn n 1 j n
151 0red n 0
152 1red n 1
153 27 a1i n 2
154 nnre n n
155 153 154 remulcld n 2 n
156 155 152 readdcld n 2 n + 1
157 36 a1i n 0 < 1
158 2rp 2 +
159 158 a1i n 2 +
160 nnrp n n +
161 159 160 rpmulcld n 2 n +
162 152 161 ltaddrp2d n 1 < 2 n + 1
163 151 152 156 157 162 lttrd n 0 < 2 n + 1
164 163 gt0ne0d n 2 n + 1 0
165 150 164 syl n 1 j 2 n + 1 0
166 165 adantl N j n 1 j 2 n + 1 0
167 149 166 reccld N j n 1 j 1 2 n + 1
168 101 ad2antrr N j n 1 j 1 2 N + 1
169 62 a1i N j n 1 j 2 0
170 169 144 nn0mulcld N j n 1 j 2 n 0
171 65 a1i N j n 1 j 1 0
172 170 171 nn0addcld N j n 1 j 2 n + 1 0
173 168 172 expcld N j n 1 j 1 2 N + 1 2 n + 1
174 167 173 mulcld N j n 1 j 1 2 n + 1 1 2 N + 1 2 n + 1
175 145 174 mulcld N j n 1 j 2 1 2 n + 1 1 2 N + 1 2 n + 1
176 3 138 144 175 fvmptd3 N j n 1 j H n = 2 1 2 n + 1 1 2 N + 1 2 n + 1
177 176 175 eqeltrd N j n 1 j H n
178 addcl n i n + i
179 178 adantl N j n i n + i
180 132 177 179 seqcl N j seq 1 + H j
181 1cnd N j n i 1
182 2cnd N j n i 2
183 43 ad2antrr N j n i N
184 182 183 mulcld N j n i 2 N
185 181 184 addcld N j n i 1 + 2 N
186 185 halfcld N j n i 1 + 2 N 2
187 simprl N j n i n
188 simprr N j n i i
189 186 187 188 adddid N j n i 1 + 2 N 2 n + i = 1 + 2 N 2 n + 1 + 2 N 2 i
190 133 oveq2d k = n 1 2 N + 1 2 k = 1 2 N + 1 2 n
191 135 190 oveq12d k = n 1 2 k + 1 1 2 N + 1 2 k = 1 2 n + 1 1 2 N + 1 2 n
192 150 adantl N j n 1 j n
193 168 170 expcld N j n 1 j 1 2 N + 1 2 n
194 167 193 mulcld N j n 1 j 1 2 n + 1 1 2 N + 1 2 n
195 2 191 192 194 fvmptd3 N j n 1 j K n = 1 2 n + 1 1 2 N + 1 2 n
196 126 ad2antrr N j n 1 j 1 + 2 N
197 2ne0 2 0
198 197 a1i N j n 1 j 2 0
199 196 145 175 198 div32d N j n 1 j 1 + 2 N 2 2 1 2 n + 1 1 2 N + 1 2 n + 1 = 1 + 2 N 2 1 2 n + 1 1 2 N + 1 2 n + 1 2
200 174 145 198 divcan3d N j n 1 j 2 1 2 n + 1 1 2 N + 1 2 n + 1 2 = 1 2 n + 1 1 2 N + 1 2 n + 1
201 200 oveq2d N j n 1 j 1 + 2 N 2 1 2 n + 1 1 2 N + 1 2 n + 1 2 = 1 + 2 N 1 2 n + 1 1 2 N + 1 2 n + 1
202 196 167 173 mul12d N j n 1 j 1 + 2 N 1 2 n + 1 1 2 N + 1 2 n + 1 = 1 2 n + 1 1 + 2 N 1 2 N + 1 2 n + 1
203 100 ad2antrr N j n 1 j 2 N + 1
204 59 ad2antrr N j n 1 j 2 N + 1 0
205 172 nn0zd N j n 1 j 2 n + 1
206 203 204 205 exprecd N j n 1 j 1 2 N + 1 2 n + 1 = 1 2 N + 1 2 n + 1
207 206 oveq2d N j n 1 j 1 + 2 N 1 2 N + 1 2 n + 1 = 1 + 2 N 1 2 N + 1 2 n + 1
208 203 172 expcld N j n 1 j 2 N + 1 2 n + 1
209 203 204 205 expne0d N j n 1 j 2 N + 1 2 n + 1 0
210 196 208 209 divrecd N j n 1 j 1 + 2 N 2 N + 1 2 n + 1 = 1 + 2 N 1 2 N + 1 2 n + 1
211 43 ad2antrr N j n 1 j N
212 145 211 mulcld N j n 1 j 2 N
213 148 212 addcomd N j n 1 j 1 + 2 N = 2 N + 1
214 203 170 expcld N j n 1 j 2 N + 1 2 n
215 214 203 mulcomd N j n 1 j 2 N + 1 2 n 2 N + 1 = 2 N + 1 2 N + 1 2 n
216 213 215 oveq12d N j n 1 j 1 + 2 N 2 N + 1 2 n 2 N + 1 = 2 N + 1 2 N + 1 2 N + 1 2 n
217 203 170 expp1d N j n 1 j 2 N + 1 2 n + 1 = 2 N + 1 2 n 2 N + 1
218 217 oveq2d N j n 1 j 1 + 2 N 2 N + 1 2 n + 1 = 1 + 2 N 2 N + 1 2 n 2 N + 1
219 2z 2
220 219 a1i N j n 1 j 2
221 144 nn0zd N j n 1 j n
222 220 221 zmulcld N j n 1 j 2 n
223 203 204 222 expne0d N j n 1 j 2 N + 1 2 n 0
224 203 203 214 204 223 divdiv1d N j n 1 j 2 N + 1 2 N + 1 2 N + 1 2 n = 2 N + 1 2 N + 1 2 N + 1 2 n
225 216 218 224 3eqtr4d N j n 1 j 1 + 2 N 2 N + 1 2 n + 1 = 2 N + 1 2 N + 1 2 N + 1 2 n
226 207 210 225 3eqtr2d N j n 1 j 1 + 2 N 1 2 N + 1 2 n + 1 = 2 N + 1 2 N + 1 2 N + 1 2 n
227 226 oveq2d N j n 1 j 1 2 n + 1 1 + 2 N 1 2 N + 1 2 n + 1 = 1 2 n + 1 2 N + 1 2 N + 1 2 N + 1 2 n
228 203 204 dividd N j n 1 j 2 N + 1 2 N + 1 = 1
229 1exp 2 n 1 2 n = 1
230 222 229 syl N j n 1 j 1 2 n = 1
231 228 230 eqtr4d N j n 1 j 2 N + 1 2 N + 1 = 1 2 n
232 231 oveq1d N j n 1 j 2 N + 1 2 N + 1 2 N + 1 2 n = 1 2 n 2 N + 1 2 n
233 148 203 204 170 expdivd N j n 1 j 1 2 N + 1 2 n = 1 2 n 2 N + 1 2 n
234 232 233 eqtr4d N j n 1 j 2 N + 1 2 N + 1 2 N + 1 2 n = 1 2 N + 1 2 n
235 234 oveq2d N j n 1 j 1 2 n + 1 2 N + 1 2 N + 1 2 N + 1 2 n = 1 2 n + 1 1 2 N + 1 2 n
236 202 227 235 3eqtrd N j n 1 j 1 + 2 N 1 2 n + 1 1 2 N + 1 2 n + 1 = 1 2 n + 1 1 2 N + 1 2 n
237 199 201 236 3eqtrd N j n 1 j 1 + 2 N 2 2 1 2 n + 1 1 2 N + 1 2 n + 1 = 1 2 n + 1 1 2 N + 1 2 n
238 176 eqcomd N j n 1 j 2 1 2 n + 1 1 2 N + 1 2 n + 1 = H n
239 238 oveq2d N j n 1 j 1 + 2 N 2 2 1 2 n + 1 1 2 N + 1 2 n + 1 = 1 + 2 N 2 H n
240 195 237 239 3eqtr2d N j n 1 j K n = 1 + 2 N 2 H n
241 179 189 132 177 240 seqdistr N j seq 1 + K j = 1 + 2 N 2 seq 1 + H j
242 4 5 125 127 129 180 241 climmulc2 N seq 1 + K 1 + 2 N 2 log N + 1 N 2 2 N + 1
243 90 99 addcomd N 1 + 2 N = 2 N + 1
244 243 oveq1d N 1 + 2 N 2 = 2 N + 1 2
245 244 oveq1d N 1 + 2 N 2 log N + 1 N 2 2 N + 1 = 2 N + 1 2 log N + 1 N 2 2 N + 1
246 244 127 eqeltrrd N 2 N + 1 2
247 43 90 addcld N N + 1
248 nnne0 N N 0
249 247 43 248 divcld N N + 1 N
250 49 51 readdcld N N + 1
251 49 ltp1d N N < N + 1
252 53 49 250 54 251 lttrd N 0 < N + 1
253 252 gt0ne0d N N + 1 0
254 247 43 253 248 divne0d N N + 1 N 0
255 249 254 logcld N log N + 1 N
256 87 100 59 divcld N 2 2 N + 1
257 246 255 256 subdid N 2 N + 1 2 log N + 1 N 2 2 N + 1 = 2 N + 1 2 log N + 1 N 2 N + 1 2 2 2 N + 1
258 99 90 addcomd N 2 N + 1 = 1 + 2 N
259 258 oveq1d N 2 N + 1 2 = 1 + 2 N 2
260 259 oveq1d N 2 N + 1 2 log N + 1 N = 1 + 2 N 2 log N + 1 N
261 197 a1i N 2 0
262 100 87 59 261 divcan6d N 2 N + 1 2 2 2 N + 1 = 1
263 260 262 oveq12d N 2 N + 1 2 log N + 1 N 2 N + 1 2 2 2 N + 1 = 1 + 2 N 2 log N + 1 N 1
264 245 257 263 3eqtrd N 1 + 2 N 2 log N + 1 N 2 2 N + 1 = 1 + 2 N 2 log N + 1 N 1
265 242 264 breqtrd N seq 1 + K 1 + 2 N 2 log N + 1 N 1
266 oveq2 n = N 2 n = 2 N
267 266 oveq2d n = N 1 + 2 n = 1 + 2 N
268 267 oveq1d n = N 1 + 2 n 2 = 1 + 2 N 2
269 oveq1 n = N n + 1 = N + 1
270 id n = N n = N
271 269 270 oveq12d n = N n + 1 n = N + 1 N
272 271 fveq2d n = N log n + 1 n = log N + 1 N
273 268 272 oveq12d n = N 1 + 2 n 2 log n + 1 n = 1 + 2 N 2 log N + 1 N
274 273 oveq1d n = N 1 + 2 n 2 log n + 1 n 1 = 1 + 2 N 2 log N + 1 N 1
275 id N N
276 127 255 mulcld N 1 + 2 N 2 log N + 1 N
277 276 90 subcld N 1 + 2 N 2 log N + 1 N 1
278 1 274 275 277 fvmptd3 N J N = 1 + 2 N 2 log N + 1 N 1
279 265 278 breqtrrd N seq 1 + K J N