Skip to content

Instantly share code, notes, and snippets.

@FiloSottile
Last active February 14, 2025 15:36
Show Gist options
  • Save FiloSottile/6a533767fff4d7812fcaffe4be7972c3 to your computer and use it in GitHub Desktop.
Save FiloSottile/6a533767fff4d7812fcaffe4be7972c3 to your computer and use it in GitHub Desktop.
1 0.33333333333333337
2 0.4666666666666667
3 0.5428571428571429
4 0.5844155844155845
5 0.6163836163836165
6 0.6389492860081096
7 0.6579519551655776
8 0.6728236092888134
9 0.6841055537960956
10 0.694295697222028
11 0.7025579756754867
12 0.7098126591955969
13 0.7165612020050016
14 0.7225918147282995
15 0.7278259314315392
16 0.7324390512377843
17 0.7368252962994599
18 0.7407532769517068
19 0.7444046392481616
20 0.7479059455598306
21 0.7510970095400858
22 0.7540958407504463
23 0.7568588088319019
24 0.7593654190501298
25 0.7617479396535938
26 0.7640610664530735
27 0.7662661032151943
28 0.7684104508921191
29 0.7704599159284721
30 0.7722673181652557
31 0.7740057355838416
32 0.7756553287547624
33 0.7772693191953757
34 0.7787641559792993
35 0.7802292940191715
36 0.7816291074330621
37 0.7829688061604667
38 0.7842683941475298
39 0.7855153976495672
40 0.786713635651525
41 0.7878920133551077
42 0.7890025263741909
43 0.7900957775328739
44 0.7911612812002197
45 0.7922107219982085
46 0.7931955053062739
47 0.7941228797219408
48 0.795029827388364
49 0.7959248936443101
50 0.796800752469871
51 0.7976509585264824
52 0.7984905811052107
53 0.7992934074753094
54 0.8000743669792966
55 0.800834540488881
56 0.8015749325316733
57 0.8023071283525897
58 0.8030208210300172
59 0.8037218145494833
60 0.8044153770422413
61 0.8050829013526773
62 0.8057178104687924
63 0.8063425120428478
64 0.8069612260618803
65 0.8075701811847135
66 0.808151540153944
67 0.8087208234175821
68 0.8092720602377044
69 0.8098185586324387
70 0.8103573162567094
71 0.8108855688576656
72 0.8114008670351651
73 0.8119064947374837
74 0.8124027836695747
75 0.812892593633884
76 0.8133735895371388
77 0.813843681251151
78 0.8143079114724698
79 0.8147619263588453
80 0.8152040219999936
81 0.8156429673159081
82 0.816070709851138
83 0.8164954888122209
84 0.8169134945324664
85 0.8173267823551922
86 0.8177336269379201
87 0.8181324592640953
88 0.8185269658600517
89 0.8189189162577621
90 0.8193066701844051
91 0.8196839005180493
92 0.8200541594492237
93 0.8204206479228505
94 0.820780526383927
95 0.8211368275243167
96 0.8214882286490234
97 0.8218308616074705
98 0.8221715291760987
99 0.8225002324493407
100 0.8228247292821572
101 0.8231428177394604
102 0.8234569512781115
103 0.823767220256533
104 0.8240758591002169
105 0.8243807536251732
106 0.8246799346241082
107 0.8249755839755009
108 0.8252677783261261
109 0.8255585141358996
110 0.825845897143913
111 0.8261299984536292
112 0.8264117974836882
113 0.8266922307672364
114 0.826966886502946
115 0.8272368289576997
116 0.8275055119608759
117 0.8277721185884479
118 0.8280358672582971
119 0.8282968143489522
120 0.8285565771109054
121 0.8288113221672042
122 0.829064185797681
123 0.8293144578536141
124 0.8295614702156204
125 0.8298046064920603
126 0.8300446564123818
127 0.8302810338026289
128 0.8305144849253212
129 0.830745706637565
130 0.8309747381576765
131 0.8312022284158762
132 0.831426992425975
133 0.831649678037037
134 0.8318709005363314
135 0.83208953395566
136 0.8323067531872826
137 0.8325198322810726
138 0.8327299705090763
139 0.8329367319793988
140 0.8331427286107436
141 0.8333459652385015
142 0.8335484610280051
143 0.8337497325382492
144 0.833950275683559
145 0.8341481895385249
146 0.8343426230795113
147 0.834535922235778
148 0.8347285463076805
149 0.8349200543652613
150 0.8351082869144457
151 0.8352954511744748
152 0.8354819795423406
153 0.8356674564537923
154 0.8358486389714838
155 0.8360288270736007
156 0.8362072505479493
157 0.8363835613654435
158 0.8365581786958965
159 0.8367318681978138
160 0.8369042738280167
161 0.8370754130999705
162 0.8372438976779436
163 0.8374115146731259
164 0.8375779307277081
165 0.8377431617239159
166 0.8379068921358999
167 0.8380694729863152
168 0.838229959137964
169 0.838389653156584
170 0.8385482501603557
171 0.8387063811592192
172 0.8388628250184247
173 0.83901881453922
174 0.8391737531200292
175 0.8393270669874076
176 0.8394799432319485
177 0.8396312345201371
178 0.8397820988338529
179 0.8399319752615106
180 0.8400792319540024
181 0.840225813776226
182 0.8403719932695688
183 0.840517506493571
184 0.8406620962428969
185 0.8408057733427681
186 0.8409482927936698
187 0.8410899238775579
188 0.8412306768236362
189 0.8413686171565435
190 0.8415061985813861
191 0.841642478720181
192 0.8417777114454413
193 0.8419116845940904
194 0.8420448676736236
195 0.842177269293344
196 0.8423086787277376
197 0.8424386798169975
198 0.8425681468015357
199 0.8426968727649031
200 0.8428248655454036
201 0.8429525464019874
202 0.8430795047314926
203 0.843205141637232
204 0.8433296808416504
205 0.8434523670743508
206 0.8435747655363723
207 0.8436966869973728
208 0.8438179463557922
209 0.8439389239341378
210 0.8440592485880051
211 0.8441791108104586
212 0.8442986970646332
213 0.8444178258350505
214 0.8445357804780869
215 0.8446534672453252
216 0.8447705332082149
217 0.8448845886577313
218 0.8449980600632487
219 0.8451109529546812
220 0.84522311012126
221 0.8453337440668487
222 0.845443514298171
223 0.845552127429374
224 0.8456603599959968
225 0.8457683653423956
226 0.8458759938383186
227 0.8459830987765824
228 0.8460895375472965
229 0.8461956095407167
230 0.8463014625279563
231 0.8464068076530229
232 0.8465112217878611
233 0.8466148603957018
234 0.8467182893502563
235 0.8468213705275593
236 0.8469242440194817
237 0.8470267729920072
238 0.8471288231768024
239 0.8472299953653022
240 0.8473303039697898
241 0.847430022909065
242 0.8475289017017358
243 0.8476273336567379
244 0.847725448702677
245 0.8478231232063955
246 0.8479202367206224
247 0.848017041153009
248 0.8481132938185233
249 0.8482092424642476
250 0.8483042899016525
251 0.8483990405013392
252 0.848493378372838
253 0.8485875403502321
254 0.8486814104430094
255 0.8487748746737426
256 0.8488681659293418
257 0.8489610558089181
258 0.8490533215048198
259 0.8491444178708398
260 0.8492351307885363
261 0.8493255716218965
262 0.8494158498893489
263 0.8495047950459411
264 0.8495934781366624
265 0.8496820046356991
266 0.849769961332811
267 0.8498572536272138
268 0.8499443939327116
269 0.8500309811260568
270 0.8501171207118545
271 0.8502029151476234
272 0.8502883669929471
273 0.8503734787797618
274 0.8504576805362166
275 0.8505415517193147
276 0.8506251882320627
277 0.8507086844935317
278 0.8507915780612754
279 0.8508739681341294
280 0.8509557706749226
281 0.8510371711278581
282 0.8511178223616818
283 0.8511978235318259
284 0.8512775247511447
285 0.851357012979498
286 0.851436373890881
287 0.8515155233986642
288 0.8515945465368235
289 0.8516731095084822
290 0.8517511352267839
291 0.8518288745371002
292 0.8519063293857478
293 0.8519830221204004
294 0.8520595958285637
295 0.852135501628549
296 0.852211290710236
297 0.8522861962902106
298 0.8523608369186643
299 0.8524351394667676
300 0.8525091810425495
301 0.8525830372363188
302 0.8526567825903777
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "sympy",
# ]
# ///
from sympy import primerange
PRIMES = list(primerange(3, 2000))
SMALLDIV_RATIOS = [0]
for p in PRIMES:
SMALLDIV_RATIOS.append(1 - (1 - SMALLDIV_RATIOS[-1]) * ((p - 1) / p))
for i in range(1, len(SMALLDIV_RATIOS)):
print(f"{i} {SMALLDIV_RATIOS[i]}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment