-
Notifications
You must be signed in to change notification settings - Fork 0
/
BigFactorialApproximation.py
128 lines (123 loc) · 2.45 KB
/
BigFactorialApproximation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
from math import *
def b(n):
l=[]
while n:
l.append(n%2)
n//=2
return l
def pw(x,n):
B=b(n)
p,q=x,1
for i in range(len(B)):
if i:
p*=p
if B[i]:
q*=p
return q
f=lambda n:sqrt((2*n+1/3)*pi)*pw((n/e),n)
'''
while 1:
print(f(int(input())))
'''
'''
1 1.0039940820520508
2 1.0013202128333356
3 1.0006445226653895
4 1.0003797469292535
5 1.0002498109758917
6 1.0001766573310824
7 1.0001314698822024
8 1.00010162682426
9 1.000080896120529
10 1.0000659146300306
11 1.0000547383037663
12 1.0000461801073102
13 1.0000394820786849
14 1.000034141872078
15 1.0000298159031538
16 1.000026262746696
17 1.000023308747395
18 1.0000208264137385
19 1.000018720440079
20 1.000016918427763
21 1.000015364583117
22 1.0000140153489638
23 1.0000128363203247
24 1.000011800030312
25 1.000010884336626
26 1.0000100712293816
27 1.0000093459390935
28 1.0000086962614556
29 1.0000081120407602
30 1.0000075847707057
31 1.0000071072830956
32 1.0000066735029667
33 1.000006278254483
34 1.0000059171058444
35 1.0000055862445376
36 1.0000052823763188
37 1.000005002642929
38 1.000004744554641
39 1.0000045059346756
40 1.0000042848731479
41 1.0000040796887666
42 1.0000038888967564
43 1.0000037111819224
44 1.000003545375926
45 1.0000033904380796
46 1.0000032454388927
47 1.0000031095461852
48 1.0000029820130802
49 1.0000028621677175
50 1.0000027494044221
51 1.0000026431759885
52 1.0000025429870691
53 1.0000024483883807
54 1.0000023589716347
55 1.0000022743651604
56 1.000002194230026
57 1.0000021182566183
58 1.0000020461616796
59 1.000001977685639
60 1.0000019125902864
61 1.0000018506566983
62 1.0000017916833708
63 1.0000017354846116
64 1.0000016818890751
65 1.0000016307384192
66 1.0000015818861792
67 1.000001535196685
68 1.0000014905441352
69 1.000001447811738
70 1.0000014068909757
71 1.0000013676808475
72 1.0000013300873336
73 1.0000012940227614
74 1.0000012594053458
75 1.0000012261586728
76 1.0000011942113234
77 1.0000011634964574
78 1.0000011339515038
79 1.000001105517767
80 1.000001078140225
81 1.000001051767212
82 1.0000010263501677
83 1.0000010018434595
84 1.0000009782041117
85 1.0000009553916729
86 1.000000933368043
87 1.0000009120972382
88 1.0000008915453418
89 1.0000008716803417
90 1.0000008524719517
91 1.0000008338915334
92 1.0000008159120306
93 1.000000798507789
94 1.0000007816545504
95 1.0000007653292664
96 1.0000007495101624
97 1.0000007341764625
98 1.0000007193085698
99 1.0000007048877848
100 1.000000690896336
'''