Metamath Proof Explorer


Theorem stirlinglem4

Description: Algebraic manipulation of ( ( B n ) - ( B ( n + 1 ) ) ) . It will be used in other theorems to show that B is decreasing. (Contributed by Glauco Siliprandi, 29-Jun-2017)

Ref Expression
Hypotheses stirlinglem4.1 A = n n ! 2 n n e n
stirlinglem4.2 B = n log A n
stirlinglem4.3 J = n 1 + 2 n 2 log n + 1 n 1
Assertion stirlinglem4 N B N B N + 1 = J N

Proof

Step Hyp Ref Expression
1 stirlinglem4.1 A = n n ! 2 n n e n
2 stirlinglem4.2 B = n log A n
3 stirlinglem4.3 J = n 1 + 2 n 2 log n + 1 n 1
4 nnre N N
5 nnnn0 N N 0
6 5 nn0ge0d N 0 N
7 4 6 ge0p1rpd N N + 1 +
8 nnrp N N +
9 7 8 rpdivcld N N + 1 N +
10 9 rpsqrtcld N N + 1 N +
11 nnz N N
12 9 11 rpexpcld N N + 1 N N +
13 10 12 rpmulcld N N + 1 N N + 1 N N +
14 epr e +
15 14 a1i N e +
16 13 15 relogdivd N log N + 1 N N + 1 N N e = log N + 1 N N + 1 N N log e
17 10 12 relogmuld N log N + 1 N N + 1 N N = log N + 1 N + log N + 1 N N
18 logsqrt N + 1 N + log N + 1 N = log N + 1 N 2
19 9 18 syl N log N + 1 N = log N + 1 N 2
20 relogexp N + 1 N + N log N + 1 N N = N log N + 1 N
21 9 11 20 syl2anc N log N + 1 N N = N log N + 1 N
22 19 21 oveq12d N log N + 1 N + log N + 1 N N = log N + 1 N 2 + N log N + 1 N
23 17 22 eqtrd N log N + 1 N N + 1 N N = log N + 1 N 2 + N log N + 1 N
24 peano2nn N N + 1
25 24 nncnd N N + 1
26 nncn N N
27 nnne0 N N 0
28 25 26 27 divcld N N + 1 N
29 24 nnne0d N N + 1 0
30 25 26 29 27 divne0d N N + 1 N 0
31 28 30 logcld N log N + 1 N
32 2cnd N 2
33 2rp 2 +
34 33 a1i N 2 +
35 34 rpne0d N 2 0
36 31 32 35 divrec2d N log N + 1 N 2 = 1 2 log N + 1 N
37 36 oveq1d N log N + 1 N 2 + N log N + 1 N = 1 2 log N + 1 N + N log N + 1 N
38 1cnd N 1
39 38 halfcld N 1 2
40 39 26 31 adddird N 1 2 + N log N + 1 N = 1 2 log N + 1 N + N log N + 1 N
41 26 32 35 divcan4d N N 2 2 = N
42 26 32 mulcomd N N 2 = 2 N
43 42 oveq1d N N 2 2 = 2 N 2
44 41 43 eqtr3d N N = 2 N 2
45 44 oveq2d N 1 2 + N = 1 2 + 2 N 2
46 32 26 mulcld N 2 N
47 38 46 32 35 divdird N 1 + 2 N 2 = 1 2 + 2 N 2
48 45 47 eqtr4d N 1 2 + N = 1 + 2 N 2
49 48 oveq1d N 1 2 + N log N + 1 N = 1 + 2 N 2 log N + 1 N
50 40 49 eqtr3d N 1 2 log N + 1 N + N log N + 1 N = 1 + 2 N 2 log N + 1 N
51 23 37 50 3eqtrd N log N + 1 N N + 1 N N = 1 + 2 N 2 log N + 1 N
52 loge log e = 1
53 52 a1i N log e = 1
54 51 53 oveq12d N log N + 1 N N + 1 N N log e = 1 + 2 N 2 log N + 1 N 1
55 16 54 eqtrd N log N + 1 N N + 1 N N e = 1 + 2 N 2 log N + 1 N 1
56 1 stirlinglem2 N A N +
57 56 relogcld N log A N
58 nfcv _ n N
59 nfcv _ n log
60 nfmpt1 _ n n n ! 2 n n e n
61 1 60 nfcxfr _ n A
62 61 58 nffv _ n A N
63 59 62 nffv _ n log A N
64 2fveq3 n = N log A n = log A N
65 58 63 64 2 fvmptf N log A N B N = log A N
66 57 65 mpdan N B N = log A N
67 nfcv _ k log A n
68 nfcv _ n k
69 61 68 nffv _ n A k
70 59 69 nffv _ n log A k
71 2fveq3 n = k log A n = log A k
72 67 70 71 cbvmpt n log A n = k log A k
73 2 72 eqtri B = k log A k
74 73 a1i N B = k log A k
75 simpr N k = N + 1 k = N + 1
76 75 fveq2d N k = N + 1 A k = A N + 1
77 76 fveq2d N k = N + 1 log A k = log A N + 1
78 1 stirlinglem2 N + 1 A N + 1 +
79 24 78 syl N A N + 1 +
80 79 relogcld N log A N + 1
81 74 77 24 80 fvmptd N B N + 1 = log A N + 1
82 66 81 oveq12d N B N B N + 1 = log A N log A N + 1
83 56 79 relogdivd N log A N A N + 1 = log A N log A N + 1
84 faccl N 0 N !
85 nnrp N ! N ! +
86 5 84 85 3syl N N ! +
87 34 8 rpmulcld N 2 N +
88 87 rpsqrtcld N 2 N +
89 8 15 rpdivcld N N e +
90 89 11 rpexpcld N N e N +
91 88 90 rpmulcld N 2 N N e N +
92 86 91 rpdivcld N N ! 2 N N e N +
93 1 a1i N N ! 2 N N e N + A = n n ! 2 n n e n
94 simpr N N ! 2 N N e N + n = N n = N
95 94 fveq2d N N ! 2 N N e N + n = N n ! = N !
96 94 oveq2d N N ! 2 N N e N + n = N 2 n = 2 N
97 96 fveq2d N N ! 2 N N e N + n = N 2 n = 2 N
98 94 oveq1d N N ! 2 N N e N + n = N n e = N e
99 98 94 oveq12d N N ! 2 N N e N + n = N n e n = N e N
100 97 99 oveq12d N N ! 2 N N e N + n = N 2 n n e n = 2 N N e N
101 95 100 oveq12d N N ! 2 N N e N + n = N n ! 2 n n e n = N ! 2 N N e N
102 simpl N N ! 2 N N e N + N
103 86 rpcnd N N !
104 103 adantr N N ! 2 N N e N + N !
105 2cnd N N ! 2 N N e N + 2
106 102 nncnd N N ! 2 N N e N + N
107 105 106 mulcld N N ! 2 N N e N + 2 N
108 107 sqrtcld N N ! 2 N N e N + 2 N
109 ere e
110 109 recni e
111 110 a1i N N ! 2 N N e N + e
112 0re 0
113 epos 0 < e
114 112 113 gtneii e 0
115 114 a1i N N ! 2 N N e N + e 0
116 106 111 115 divcld N N ! 2 N N e N + N e
117 102 nnnn0d N N ! 2 N N e N + N 0
118 116 117 expcld N N ! 2 N N e N + N e N
119 108 118 mulcld N N ! 2 N N e N + 2 N N e N
120 88 rpne0d N 2 N 0
121 120 adantr N N ! 2 N N e N + 2 N 0
122 102 nnne0d N N ! 2 N N e N + N 0
123 106 111 122 115 divne0d N N ! 2 N N e N + N e 0
124 102 nnzd N N ! 2 N N e N + N
125 116 123 124 expne0d N N ! 2 N N e N + N e N 0
126 108 118 121 125 mulne0d N N ! 2 N N e N + 2 N N e N 0
127 104 119 126 divcld N N ! 2 N N e N + N ! 2 N N e N
128 93 101 102 127 fvmptd N N ! 2 N N e N + A N = N ! 2 N N e N
129 92 128 mpdan N A N = N ! 2 N N e N
130 nfcv _ k n ! 2 n n e n
131 nfcv _ n k ! 2 k k e k
132 fveq2 n = k n ! = k !
133 oveq2 n = k 2 n = 2 k
134 133 fveq2d n = k 2 n = 2 k
135 oveq1 n = k n e = k e
136 id n = k n = k
137 135 136 oveq12d n = k n e n = k e k
138 134 137 oveq12d n = k 2 n n e n = 2 k k e k
139 132 138 oveq12d n = k n ! 2 n n e n = k ! 2 k k e k
140 130 131 139 cbvmpt n n ! 2 n n e n = k k ! 2 k k e k
141 1 140 eqtri A = k k ! 2 k k e k
142 141 a1i N A = k k ! 2 k k e k
143 75 fveq2d N k = N + 1 k ! = N + 1 !
144 75 oveq2d N k = N + 1 2 k = 2 N + 1
145 144 fveq2d N k = N + 1 2 k = 2 N + 1
146 75 oveq1d N k = N + 1 k e = N + 1 e
147 146 75 oveq12d N k = N + 1 k e k = N + 1 e N + 1
148 145 147 oveq12d N k = N + 1 2 k k e k = 2 N + 1 N + 1 e N + 1
149 143 148 oveq12d N k = N + 1 k ! 2 k k e k = N + 1 ! 2 N + 1 N + 1 e N + 1
150 24 nnnn0d N N + 1 0
151 faccl N + 1 0 N + 1 !
152 nnrp N + 1 ! N + 1 ! +
153 150 151 152 3syl N N + 1 ! +
154 34 7 rpmulcld N 2 N + 1 +
155 154 rpsqrtcld N 2 N + 1 +
156 7 15 rpdivcld N N + 1 e +
157 11 peano2zd N N + 1
158 156 157 rpexpcld N N + 1 e N + 1 +
159 155 158 rpmulcld N 2 N + 1 N + 1 e N + 1 +
160 153 159 rpdivcld N N + 1 ! 2 N + 1 N + 1 e N + 1 +
161 142 149 24 160 fvmptd N A N + 1 = N + 1 ! 2 N + 1 N + 1 e N + 1
162 129 161 oveq12d N A N A N + 1 = N ! 2 N N e N N + 1 ! 2 N + 1 N + 1 e N + 1
163 facp1 N 0 N + 1 ! = N ! N + 1
164 5 163 syl N N + 1 ! = N ! N + 1
165 164 oveq1d N N + 1 ! 2 N + 1 N + 1 e N + 1 = N ! N + 1 2 N + 1 N + 1 e N + 1
166 159 rpcnd N 2 N + 1 N + 1 e N + 1
167 159 rpne0d N 2 N + 1 N + 1 e N + 1 0
168 103 25 166 167 divassd N N ! N + 1 2 N + 1 N + 1 e N + 1 = N ! N + 1 2 N + 1 N + 1 e N + 1
169 165 168 eqtrd N N + 1 ! 2 N + 1 N + 1 e N + 1 = N ! N + 1 2 N + 1 N + 1 e N + 1
170 169 oveq2d N N ! 2 N N e N N + 1 ! 2 N + 1 N + 1 e N + 1 = N ! 2 N N e N N ! N + 1 2 N + 1 N + 1 e N + 1
171 91 rpcnd N 2 N N e N
172 25 166 167 divcld N N + 1 2 N + 1 N + 1 e N + 1
173 103 172 mulcld N N ! N + 1 2 N + 1 N + 1 e N + 1
174 91 rpne0d N 2 N N e N 0
175 86 rpne0d N N ! 0
176 25 166 29 167 divne0d N N + 1 2 N + 1 N + 1 e N + 1 0
177 103 172 175 176 mulne0d N N ! N + 1 2 N + 1 N + 1 e N + 1 0
178 103 171 173 174 177 divdiv32d N N ! 2 N N e N N ! N + 1 2 N + 1 N + 1 e N + 1 = N ! N ! N + 1 2 N + 1 N + 1 e N + 1 2 N N e N
179 103 103 172 175 176 divdiv1d N N ! N ! N + 1 2 N + 1 N + 1 e N + 1 = N ! N ! N + 1 2 N + 1 N + 1 e N + 1
180 179 eqcomd N N ! N ! N + 1 2 N + 1 N + 1 e N + 1 = N ! N ! N + 1 2 N + 1 N + 1 e N + 1
181 180 oveq1d N N ! N ! N + 1 2 N + 1 N + 1 e N + 1 2 N N e N = N ! N ! N + 1 2 N + 1 N + 1 e N + 1 2 N N e N
182 103 175 dividd N N ! N ! = 1
183 182 oveq1d N N ! N ! N + 1 2 N + 1 N + 1 e N + 1 = 1 N + 1 2 N + 1 N + 1 e N + 1
184 183 oveq1d N N ! N ! N + 1 2 N + 1 N + 1 e N + 1 2 N N e N = 1 N + 1 2 N + 1 N + 1 e N + 1 2 N N e N
185 25 166 29 167 recdivd N 1 N + 1 2 N + 1 N + 1 e N + 1 = 2 N + 1 N + 1 e N + 1 N + 1
186 185 oveq1d N 1 N + 1 2 N + 1 N + 1 e N + 1 2 N N e N = 2 N + 1 N + 1 e N + 1 N + 1 2 N N e N
187 166 25 29 divcld N 2 N + 1 N + 1 e N + 1 N + 1
188 88 rpcnd N 2 N
189 90 rpcnd N N e N
190 90 rpne0d N N e N 0
191 187 188 189 120 190 divdiv1d N 2 N + 1 N + 1 e N + 1 N + 1 2 N N e N = 2 N + 1 N + 1 e N + 1 N + 1 2 N N e N
192 166 25 188 29 120 divdiv32d N 2 N + 1 N + 1 e N + 1 N + 1 2 N = 2 N + 1 N + 1 e N + 1 2 N N + 1
193 155 rpcnd N 2 N + 1
194 158 rpcnd N N + 1 e N + 1
195 193 194 188 120 div23d N 2 N + 1 N + 1 e N + 1 2 N = 2 N + 1 2 N N + 1 e N + 1
196 34 rpred N 2
197 34 rpge0d N 0 2
198 24 nnred N N + 1
199 150 nn0ge0d N 0 N + 1
200 196 197 198 199 sqrtmuld N 2 N + 1 = 2 N + 1
201 196 197 4 6 sqrtmuld N 2 N = 2 N
202 200 201 oveq12d N 2 N + 1 2 N = 2 N + 1 2 N
203 32 sqrtcld N 2
204 25 sqrtcld N N + 1
205 26 sqrtcld N N
206 34 rpsqrtcld N 2 +
207 206 rpne0d N 2 0
208 8 rpsqrtcld N N +
209 208 rpne0d N N 0
210 203 203 204 205 207 209 divmuldivd N 2 2 N + 1 N = 2 N + 1 2 N
211 203 207 dividd N 2 2 = 1
212 198 199 8 sqrtdivd N N + 1 N = N + 1 N
213 212 eqcomd N N + 1 N = N + 1 N
214 211 213 oveq12d N 2 2 N + 1 N = 1 N + 1 N
215 202 210 214 3eqtr2d N 2 N + 1 2 N = 1 N + 1 N
216 215 oveq1d N 2 N + 1 2 N N + 1 e N + 1 = 1 N + 1 N N + 1 e N + 1
217 28 sqrtcld N N + 1 N
218 217 mulid2d N 1 N + 1 N = N + 1 N
219 218 oveq1d N 1 N + 1 N N + 1 e N + 1 = N + 1 N N + 1 e N + 1
220 195 216 219 3eqtrd N 2 N + 1 N + 1 e N + 1 2 N = N + 1 N N + 1 e N + 1
221 220 oveq1d N 2 N + 1 N + 1 e N + 1 2 N N + 1 = N + 1 N N + 1 e N + 1 N + 1
222 192 221 eqtrd N 2 N + 1 N + 1 e N + 1 N + 1 2 N = N + 1 N N + 1 e N + 1 N + 1
223 222 oveq1d N 2 N + 1 N + 1 e N + 1 N + 1 2 N N e N = N + 1 N N + 1 e N + 1 N + 1 N e N
224 191 223 eqtr3d N 2 N + 1 N + 1 e N + 1 N + 1 2 N N e N = N + 1 N N + 1 e N + 1 N + 1 N e N
225 217 194 mulcld N N + 1 N N + 1 e N + 1
226 225 25 189 29 190 divdiv32d N N + 1 N N + 1 e N + 1 N + 1 N e N = N + 1 N N + 1 e N + 1 N e N N + 1
227 217 194 189 190 divassd N N + 1 N N + 1 e N + 1 N e N = N + 1 N N + 1 e N + 1 N e N
228 15 rpcnd N e
229 15 rpne0d N e 0
230 25 228 229 150 expdivd N N + 1 e N + 1 = N + 1 N + 1 e N + 1
231 26 228 229 5 expdivd N N e N = N N e N
232 230 231 oveq12d N N + 1 e N + 1 N e N = N + 1 N + 1 e N + 1 N N e N
233 232 oveq2d N N + 1 N N + 1 e N + 1 N e N = N + 1 N N + 1 N + 1 e N + 1 N N e N
234 25 150 expcld N N + 1 N + 1
235 228 150 expcld N e N + 1
236 26 5 expcld N N N
237 228 5 expcld N e N
238 228 229 157 expne0d N e N + 1 0
239 228 229 11 expne0d N e N 0
240 26 27 11 expne0d N N N 0
241 234 235 236 237 238 239 240 divdivdivd N N + 1 N + 1 e N + 1 N N e N = N + 1 N + 1 e N e N + 1 N N
242 234 237 mulcomd N N + 1 N + 1 e N = e N N + 1 N + 1
243 242 oveq1d N N + 1 N + 1 e N e N + 1 N N = e N N + 1 N + 1 e N + 1 N N
244 237 235 234 236 238 240 divmuldivd N e N e N + 1 N + 1 N + 1 N N = e N N + 1 N + 1 e N + 1 N N
245 228 5 expp1d N e N + 1 = e N e
246 245 oveq2d N e N e N + 1 = e N e N e
247 237 237 228 239 229 divdiv1d N e N e N e = e N e N e
248 237 239 dividd N e N e N = 1
249 248 oveq1d N e N e N e = 1 e
250 246 247 249 3eqtr2d N e N e N + 1 = 1 e
251 250 oveq1d N e N e N + 1 N + 1 N + 1 N N = 1 e N + 1 N + 1 N N
252 244 251 eqtr3d N e N N + 1 N + 1 e N + 1 N N = 1 e N + 1 N + 1 N N
253 241 243 252 3eqtrd N N + 1 N + 1 e N + 1 N N e N = 1 e N + 1 N + 1 N N
254 253 oveq2d N N + 1 N N + 1 N + 1 e N + 1 N N e N = N + 1 N 1 e N + 1 N + 1 N N
255 227 233 254 3eqtrd N N + 1 N N + 1 e N + 1 N e N = N + 1 N 1 e N + 1 N + 1 N N
256 255 oveq1d N N + 1 N N + 1 e N + 1 N e N N + 1 = N + 1 N 1 e N + 1 N + 1 N N N + 1
257 234 236 240 divcld N N + 1 N + 1 N N
258 38 228 257 229 div32d N 1 e N + 1 N + 1 N N = 1 N + 1 N + 1 N N e
259 257 228 229 divcld N N + 1 N + 1 N N e
260 259 mulid2d N 1 N + 1 N + 1 N N e = N + 1 N + 1 N N e
261 258 260 eqtrd N 1 e N + 1 N + 1 N N = N + 1 N + 1 N N e
262 261 oveq2d N N + 1 N N + 1 1 e N + 1 N + 1 N N = N + 1 N N + 1 N + 1 N + 1 N N e
263 228 229 reccld N 1 e
264 263 257 mulcld N 1 e N + 1 N + 1 N N
265 217 264 25 29 div23d N N + 1 N 1 e N + 1 N + 1 N N N + 1 = N + 1 N N + 1 1 e N + 1 N + 1 N N
266 217 25 29 divcld N N + 1 N N + 1
267 266 257 228 229 divassd N N + 1 N N + 1 N + 1 N + 1 N N e = N + 1 N N + 1 N + 1 N + 1 N N e
268 262 265 267 3eqtr4d N N + 1 N 1 e N + 1 N + 1 N N N + 1 = N + 1 N N + 1 N + 1 N + 1 N N e
269 226 256 268 3eqtrd N N + 1 N N + 1 e N + 1 N + 1 N e N = N + 1 N N + 1 N + 1 N + 1 N N e
270 186 224 269 3eqtrd N 1 N + 1 2 N + 1 N + 1 e N + 1 2 N N e N = N + 1 N N + 1 N + 1 N + 1 N N e
271 181 184 270 3eqtrd N N ! N ! N + 1 2 N + 1 N + 1 e N + 1 2 N N e N = N + 1 N N + 1 N + 1 N + 1 N N e
272 170 178 271 3eqtrd N N ! 2 N N e N N + 1 ! 2 N + 1 N + 1 e N + 1 = N + 1 N N + 1 N + 1 N + 1 N N e
273 217 25 257 29 div32d N N + 1 N N + 1 N + 1 N + 1 N N = N + 1 N N + 1 N + 1 N N N + 1
274 25 5 expp1d N N + 1 N + 1 = N + 1 N N + 1
275 274 oveq1d N N + 1 N + 1 N + 1 = N + 1 N N + 1 N + 1
276 25 5 expcld N N + 1 N
277 276 25 29 divcan4d N N + 1 N N + 1 N + 1 = N + 1 N
278 275 277 eqtrd N N + 1 N + 1 N + 1 = N + 1 N
279 278 oveq1d N N + 1 N + 1 N + 1 N N = N + 1 N N N
280 234 236 25 240 29 divdiv32d N N + 1 N + 1 N N N + 1 = N + 1 N + 1 N + 1 N N
281 25 26 27 5 expdivd N N + 1 N N = N + 1 N N N
282 279 280 281 3eqtr4d N N + 1 N + 1 N N N + 1 = N + 1 N N
283 282 oveq2d N N + 1 N N + 1 N + 1 N N N + 1 = N + 1 N N + 1 N N
284 273 283 eqtrd N N + 1 N N + 1 N + 1 N + 1 N N = N + 1 N N + 1 N N
285 284 oveq1d N N + 1 N N + 1 N + 1 N + 1 N N e = N + 1 N N + 1 N N e
286 162 272 285 3eqtrd N A N A N + 1 = N + 1 N N + 1 N N e
287 286 fveq2d N log A N A N + 1 = log N + 1 N N + 1 N N e
288 82 83 287 3eqtr2d N B N B N + 1 = log N + 1 N N + 1 N N e
289 38 46 addcld N 1 + 2 N
290 289 halfcld N 1 + 2 N 2
291 290 31 mulcld N 1 + 2 N 2 log N + 1 N
292 291 38 subcld N 1 + 2 N 2 log N + 1 N 1
293 3 a1i N 1 + 2 N 2 log N + 1 N 1 J = n 1 + 2 n 2 log n + 1 n 1
294 simpr N 1 + 2 N 2 log N + 1 N 1 n = N n = N
295 294 oveq2d N 1 + 2 N 2 log N + 1 N 1 n = N 2 n = 2 N
296 295 oveq2d N 1 + 2 N 2 log N + 1 N 1 n = N 1 + 2 n = 1 + 2 N
297 296 oveq1d N 1 + 2 N 2 log N + 1 N 1 n = N 1 + 2 n 2 = 1 + 2 N 2
298 294 oveq1d N 1 + 2 N 2 log N + 1 N 1 n = N n + 1 = N + 1
299 298 294 oveq12d N 1 + 2 N 2 log N + 1 N 1 n = N n + 1 n = N + 1 N
300 299 fveq2d N 1 + 2 N 2 log N + 1 N 1 n = N log n + 1 n = log N + 1 N
301 297 300 oveq12d N 1 + 2 N 2 log N + 1 N 1 n = N 1 + 2 n 2 log n + 1 n = 1 + 2 N 2 log N + 1 N
302 301 oveq1d N 1 + 2 N 2 log N + 1 N 1 n = N 1 + 2 n 2 log n + 1 n 1 = 1 + 2 N 2 log N + 1 N 1
303 simpl N 1 + 2 N 2 log N + 1 N 1 N
304 simpr N 1 + 2 N 2 log N + 1 N 1 1 + 2 N 2 log N + 1 N 1
305 293 302 303 304 fvmptd N 1 + 2 N 2 log N + 1 N 1 J N = 1 + 2 N 2 log N + 1 N 1
306 292 305 mpdan N J N = 1 + 2 N 2 log N + 1 N 1
307 55 288 306 3eqtr4d N B N B N + 1 = J N