|
@@
-297,225
+297,193
b' hgweb fileannotate, html'
|
|
297
|
</tr>
|
|
297
|
</tr>
|
|
298
|
<tr id="l2" class="thisrev">
|
|
298
|
<tr id="l2" class="thisrev">
|
|
299
|
<td class="annotate">
|
|
299
|
<td class="annotate">
|
|
300
|
<a href="/annotate/06824edf55d0/primes.py#l2"
|
|
300
|
|
|
301
|
title="06824edf55d0: a">test@0</a>
|
|
|
|
|
302
|
</td>
|
|
301
|
</td>
|
|
303
|
<td class="source"><a href="#l2"> 2</a> </td>
|
|
302
|
<td class="source"><a href="#l2"> 2</a> </td>
|
|
304
|
</tr>
|
|
303
|
</tr>
|
|
305
|
<tr id="l3" class="thisrev">
|
|
304
|
<tr id="l3" class="thisrev">
|
|
306
|
<td class="annotate">
|
|
305
|
<td class="annotate">
|
|
307
|
<a href="/annotate/06824edf55d0/primes.py#l3"
|
|
306
|
|
|
308
|
title="06824edf55d0: a">test@0</a>
|
|
|
|
|
309
|
</td>
|
|
307
|
</td>
|
|
310
|
<td class="source"><a href="#l3"> 3</a> <span class="sd">"""Fun with generators. Corresponding Haskell implementation:</span></td>
|
|
308
|
<td class="source"><a href="#l3"> 3</a> <span class="sd">"""Fun with generators. Corresponding Haskell implementation:</span></td>
|
|
311
|
</tr>
|
|
309
|
</tr>
|
|
312
|
<tr id="l4" class="thisrev">
|
|
310
|
<tr id="l4" class="thisrev">
|
|
313
|
<td class="annotate">
|
|
311
|
<td class="annotate">
|
|
314
|
<a href="/annotate/06824edf55d0/primes.py#l4"
|
|
312
|
|
|
315
|
title="06824edf55d0: a">test@0</a>
|
|
|
|
|
316
|
</td>
|
|
313
|
</td>
|
|
317
|
<td class="source"><a href="#l4"> 4</a> </td>
|
|
314
|
<td class="source"><a href="#l4"> 4</a> </td>
|
|
318
|
</tr>
|
|
315
|
</tr>
|
|
319
|
<tr id="l5" class="thisrev">
|
|
316
|
<tr id="l5" class="thisrev">
|
|
320
|
<td class="annotate">
|
|
317
|
<td class="annotate">
|
|
321
|
<a href="/annotate/06824edf55d0/primes.py#l5"
|
|
318
|
|
|
322
|
title="06824edf55d0: a">test@0</a>
|
|
|
|
|
323
|
</td>
|
|
319
|
</td>
|
|
324
|
<td class="source"><a href="#l5"> 5</a> <span class="sd">primes = 2 : sieve [3, 5..]</span></td>
|
|
320
|
<td class="source"><a href="#l5"> 5</a> <span class="sd">primes = 2 : sieve [3, 5..]</span></td>
|
|
325
|
</tr>
|
|
321
|
</tr>
|
|
326
|
<tr id="l6" class="thisrev">
|
|
322
|
<tr id="l6" class="thisrev">
|
|
327
|
<td class="annotate">
|
|
323
|
<td class="annotate">
|
|
328
|
<a href="/annotate/06824edf55d0/primes.py#l6"
|
|
324
|
|
|
329
|
title="06824edf55d0: a">test@0</a>
|
|
|
|
|
330
|
</td>
|
|
325
|
</td>
|
|
331
|
<td class="source"><a href="#l6"> 6</a> <span class="sd"> where sieve (p:ns) = p : sieve [n | n <- ns, mod n p /= 0]</span></td>
|
|
326
|
<td class="source"><a href="#l6"> 6</a> <span class="sd"> where sieve (p:ns) = p : sieve [n | n <- ns, mod n p /= 0]</span></td>
|
|
332
|
</tr>
|
|
327
|
</tr>
|
|
333
|
<tr id="l7" class="thisrev">
|
|
328
|
<tr id="l7" class="thisrev">
|
|
334
|
<td class="annotate">
|
|
329
|
<td class="annotate">
|
|
335
|
<a href="/annotate/06824edf55d0/primes.py#l7"
|
|
330
|
|
|
336
|
title="06824edf55d0: a">test@0</a>
|
|
|
|
|
337
|
</td>
|
|
331
|
</td>
|
|
338
|
<td class="source"><a href="#l7"> 7</a> <span class="sd">"""</span></td>
|
|
332
|
<td class="source"><a href="#l7"> 7</a> <span class="sd">"""</span></td>
|
|
339
|
</tr>
|
|
333
|
</tr>
|
|
340
|
<tr id="l8" class="thisrev">
|
|
334
|
<tr id="l8" class="thisrev">
|
|
341
|
<td class="annotate">
|
|
335
|
<td class="annotate">
|
|
342
|
<a href="/annotate/06824edf55d0/primes.py#l8"
|
|
336
|
|
|
343
|
title="06824edf55d0: a">test@0</a>
|
|
|
|
|
344
|
</td>
|
|
337
|
</td>
|
|
345
|
<td class="source"><a href="#l8"> 8</a> </td>
|
|
338
|
<td class="source"><a href="#l8"> 8</a> </td>
|
|
346
|
</tr>
|
|
339
|
</tr>
|
|
347
|
<tr id="l9" class="thisrev">
|
|
340
|
<tr id="l9" class="thisrev">
|
|
348
|
<td class="annotate">
|
|
341
|
<td class="annotate">
|
|
349
|
<a href="/annotate/06824edf55d0/primes.py#l9"
|
|
342
|
|
|
350
|
title="06824edf55d0: a">test@0</a>
|
|
|
|
|
351
|
</td>
|
|
343
|
</td>
|
|
352
|
<td class="source"><a href="#l9"> 9</a> <span class="kn">from</span> <span class="nn">itertools</span> <span class="kn">import</span> <span class="n">dropwhile</span><span class="p">,</span> <span class="n">ifilter</span><span class="p">,</span> <span class="n">islice</span><span class="p">,</span> <span class="n">count</span><span class="p">,</span> <span class="n">chain</span></td>
|
|
344
|
<td class="source"><a href="#l9"> 9</a> <span class="kn">from</span> <span class="nn">itertools</span> <span class="kn">import</span> <span class="n">dropwhile</span><span class="p">,</span> <span class="n">ifilter</span><span class="p">,</span> <span class="n">islice</span><span class="p">,</span> <span class="n">count</span><span class="p">,</span> <span class="n">chain</span></td>
|
|
353
|
</tr>
|
|
345
|
</tr>
|
|
354
|
<tr id="l10" class="thisrev">
|
|
346
|
<tr id="l10" class="thisrev">
|
|
355
|
<td class="annotate">
|
|
347
|
<td class="annotate">
|
|
356
|
<a href="/annotate/06824edf55d0/primes.py#l10"
|
|
348
|
|
|
357
|
title="06824edf55d0: a">test@0</a>
|
|
|
|
|
358
|
</td>
|
|
349
|
</td>
|
|
359
|
<td class="source"><a href="#l10"> 10</a> </td>
|
|
350
|
<td class="source"><a href="#l10"> 10</a> </td>
|
|
360
|
</tr>
|
|
351
|
</tr>
|
|
361
|
<tr id="l11" class="thisrev">
|
|
352
|
<tr id="l11" class="thisrev">
|
|
362
|
<td class="annotate">
|
|
353
|
<td class="annotate">
|
|
363
|
<a href="/annotate/06824edf55d0/primes.py#l11"
|
|
354
|
|
|
364
|
title="06824edf55d0: a">test@0</a>
|
|
|
|
|
365
|
</td>
|
|
355
|
</td>
|
|
366
|
<td class="source"><a href="#l11"> 11</a> <span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></td>
|
|
356
|
<td class="source"><a href="#l11"> 11</a> <span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></td>
|
|
367
|
</tr>
|
|
357
|
</tr>
|
|
368
|
<tr id="l12" class="thisrev">
|
|
358
|
<tr id="l12" class="thisrev">
|
|
369
|
<td class="annotate">
|
|
359
|
<td class="annotate">
|
|
370
|
<a href="/annotate/06824edf55d0/primes.py#l12"
|
|
360
|
|
|
371
|
title="06824edf55d0: a">test@0</a>
|
|
|
|
|
372
|
</td>
|
|
361
|
</td>
|
|
373
|
<td class="source"><a href="#l12"> 12</a> <span class="sd">"""Generate all primes."""</span></td>
|
|
362
|
<td class="source"><a href="#l12"> 12</a> <span class="sd">"""Generate all primes."""</span></td>
|
|
374
|
</tr>
|
|
363
|
</tr>
|
|
375
|
<tr id="l13" class="thisrev">
|
|
364
|
<tr id="l13" class="thisrev">
|
|
376
|
<td class="annotate">
|
|
365
|
<td class="annotate">
|
|
377
|
<a href="/annotate/06824edf55d0/primes.py#l13"
|
|
366
|
|
|
378
|
title="06824edf55d0: a">test@0</a>
|
|
|
|
|
379
|
</td>
|
|
367
|
</td>
|
|
380
|
<td class="source"><a href="#l13"> 13</a> <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td>
|
|
368
|
<td class="source"><a href="#l13"> 13</a> <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td>
|
|
381
|
</tr>
|
|
369
|
</tr>
|
|
382
|
<tr id="l14" class="thisrev">
|
|
370
|
<tr id="l14" class="thisrev">
|
|
383
|
<td class="annotate">
|
|
371
|
<td class="annotate">
|
|
384
|
<a href="/annotate/06824edf55d0/primes.py#l14"
|
|
372
|
|
|
385
|
title="06824edf55d0: a">test@0</a>
|
|
|
|
|
386
|
</td>
|
|
373
|
</td>
|
|
387
|
<td class="source"><a href="#l14"> 14</a> <span class="n">p</span> <span class="o">=</span> <span class="n">ns</span><span class="o">.</span><span class="n">next</span><span class="p">()</span></td>
|
|
374
|
<td class="source"><a href="#l14"> 14</a> <span class="n">p</span> <span class="o">=</span> <span class="n">ns</span><span class="o">.</span><span class="n">next</span><span class="p">()</span></td>
|
|
388
|
</tr>
|
|
375
|
</tr>
|
|
389
|
<tr id="l15" class="thisrev">
|
|
376
|
<tr id="l15" class="thisrev">
|
|
390
|
<td class="annotate">
|
|
377
|
<td class="annotate">
|
|
391
|
<a href="/annotate/06824edf55d0/primes.py#l15"
|
|
378
|
|
|
392
|
title="06824edf55d0: a">test@0</a>
|
|
|
|
|
393
|
</td>
|
|
379
|
</td>
|
|
394
|
<td class="source"><a href="#l15"> 15</a> <span class="c"># It is important to yield *here* in order to stop the</span></td>
|
|
380
|
<td class="source"><a href="#l15"> 15</a> <span class="c"># It is important to yield *here* in order to stop the</span></td>
|
|
395
|
</tr>
|
|
381
|
</tr>
|
|
396
|
<tr id="l16" class="thisrev">
|
|
382
|
<tr id="l16" class="thisrev">
|
|
397
|
<td class="annotate">
|
|
383
|
<td class="annotate">
|
|
398
|
<a href="/annotate/06824edf55d0/primes.py#l16"
|
|
384
|
|
|
399
|
title="06824edf55d0: a">test@0</a>
|
|
|
|
|
400
|
</td>
|
|
385
|
</td>
|
|
401
|
<td class="source"><a href="#l16"> 16</a> <span class="c"># infinite recursion.</span></td>
|
|
386
|
<td class="source"><a href="#l16"> 16</a> <span class="c"># infinite recursion.</span></td>
|
|
402
|
</tr>
|
|
387
|
</tr>
|
|
403
|
<tr id="l17" class="thisrev">
|
|
388
|
<tr id="l17" class="thisrev">
|
|
404
|
<td class="annotate">
|
|
389
|
<td class="annotate">
|
|
405
|
<a href="/annotate/06824edf55d0/primes.py#l17"
|
|
390
|
|
|
406
|
title="06824edf55d0: a">test@0</a>
|
|
|
|
|
407
|
</td>
|
|
391
|
</td>
|
|
408
|
<td class="source"><a href="#l17"> 17</a> <span class="kn">yield</span> <span class="n">p</span></td>
|
|
392
|
<td class="source"><a href="#l17"> 17</a> <span class="kn">yield</span> <span class="n">p</span></td>
|
|
409
|
</tr>
|
|
393
|
</tr>
|
|
410
|
<tr id="l18" class="thisrev">
|
|
394
|
<tr id="l18" class="thisrev">
|
|
411
|
<td class="annotate">
|
|
395
|
<td class="annotate">
|
|
412
|
<a href="/annotate/06824edf55d0/primes.py#l18"
|
|
396
|
|
|
413
|
title="06824edf55d0: a">test@0</a>
|
|
|
|
|
414
|
</td>
|
|
397
|
</td>
|
|
415
|
<td class="source"><a href="#l18"> 18</a> <span class="n">ns</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">%</span> <span class="n">p</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">ns</span><span class="p">)</span></td>
|
|
398
|
<td class="source"><a href="#l18"> 18</a> <span class="n">ns</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">%</span> <span class="n">p</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">ns</span><span class="p">)</span></td>
|
|
416
|
</tr>
|
|
399
|
</tr>
|
|
417
|
<tr id="l19" class="thisrev">
|
|
400
|
<tr id="l19" class="thisrev">
|
|
418
|
<td class="annotate">
|
|
401
|
<td class="annotate">
|
|
419
|
<a href="/annotate/06824edf55d0/primes.py#l19"
|
|
402
|
|
|
420
|
title="06824edf55d0: a">test@0</a>
|
|
|
|
|
421
|
</td>
|
|
403
|
</td>
|
|
422
|
<td class="source"><a href="#l19"> 19</a> <span class="kn">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td>
|
|
404
|
<td class="source"><a href="#l19"> 19</a> <span class="kn">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td>
|
|
423
|
</tr>
|
|
405
|
</tr>
|
|
424
|
<tr id="l20" class="thisrev">
|
|
406
|
<tr id="l20" class="thisrev">
|
|
425
|
<td class="annotate">
|
|
407
|
<td class="annotate">
|
|
426
|
<a href="/annotate/06824edf55d0/primes.py#l20"
|
|
408
|
|
|
427
|
title="06824edf55d0: a">test@0</a>
|
|
|
|
|
428
|
</td>
|
|
409
|
</td>
|
|
429
|
<td class="source"><a href="#l20"> 20</a> <span class="kn">yield</span> <span class="n">n</span></td>
|
|
410
|
<td class="source"><a href="#l20"> 20</a> <span class="kn">yield</span> <span class="n">n</span></td>
|
|
430
|
</tr>
|
|
411
|
</tr>
|
|
431
|
<tr id="l21" class="thisrev">
|
|
412
|
<tr id="l21" class="thisrev">
|
|
432
|
<td class="annotate">
|
|
413
|
<td class="annotate">
|
|
433
|
<a href="/annotate/06824edf55d0/primes.py#l21"
|
|
414
|
|
|
434
|
title="06824edf55d0: a">test@0</a>
|
|
|
|
|
435
|
</td>
|
|
415
|
</td>
|
|
436
|
<td class="source"><a href="#l21"> 21</a> </td>
|
|
416
|
<td class="source"><a href="#l21"> 21</a> </td>
|
|
437
|
</tr>
|
|
417
|
</tr>
|
|
438
|
<tr id="l22" class="thisrev">
|
|
418
|
<tr id="l22" class="thisrev">
|
|
439
|
<td class="annotate">
|
|
419
|
<td class="annotate">
|
|
440
|
<a href="/annotate/06824edf55d0/primes.py#l22"
|
|
420
|
|
|
441
|
title="06824edf55d0: a">test@0</a>
|
|
|
|
|
442
|
</td>
|
|
421
|
</td>
|
|
443
|
<td class="source"><a href="#l22"> 22</a> <span class="n">odds</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">i</span><span class="p">:</span> <span class="n">i</span> <span class="o">%</span> <span class="mi">2</span> <span class="o">==</span> <span class="mi">1</span><span class="p">,</span> <span class="n">count</span><span class="p">())</span></td>
|
|
422
|
<td class="source"><a href="#l22"> 22</a> <span class="n">odds</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">i</span><span class="p">:</span> <span class="n">i</span> <span class="o">%</span> <span class="mi">2</span> <span class="o">==</span> <span class="mi">1</span><span class="p">,</span> <span class="n">count</span><span class="p">())</span></td>
|
|
444
|
</tr>
|
|
423
|
</tr>
|
|
445
|
<tr id="l23" class="thisrev">
|
|
424
|
<tr id="l23" class="thisrev">
|
|
446
|
<td class="annotate">
|
|
425
|
<td class="annotate">
|
|
447
|
<a href="/annotate/06824edf55d0/primes.py#l23"
|
|
426
|
|
|
448
|
title="06824edf55d0: a">test@0</a>
|
|
|
|
|
449
|
</td>
|
|
427
|
</td>
|
|
450
|
<td class="source"><a href="#l23"> 23</a> <span class="kn">return</span> <span class="n">chain</span><span class="p">([</span><span class="mi">2</span><span class="p">],</span> <span class="n">sieve</span><span class="p">(</span><span class="n">dropwhile</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o"><</span> <span class="mi">3</span><span class="p">,</span> <span class="n">odds</span><span class="p">)))</span></td>
|
|
428
|
<td class="source"><a href="#l23"> 23</a> <span class="kn">return</span> <span class="n">chain</span><span class="p">([</span><span class="mi">2</span><span class="p">],</span> <span class="n">sieve</span><span class="p">(</span><span class="n">dropwhile</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o"><</span> <span class="mi">3</span><span class="p">,</span> <span class="n">odds</span><span class="p">)))</span></td>
|
|
451
|
</tr>
|
|
429
|
</tr>
|
|
452
|
<tr id="l24" class="thisrev">
|
|
430
|
<tr id="l24" class="thisrev">
|
|
453
|
<td class="annotate">
|
|
431
|
<td class="annotate">
|
|
454
|
<a href="/annotate/06824edf55d0/primes.py#l24"
|
|
432
|
|
|
455
|
title="06824edf55d0: a">test@0</a>
|
|
|
|
|
456
|
</td>
|
|
433
|
</td>
|
|
457
|
<td class="source"><a href="#l24"> 24</a> </td>
|
|
434
|
<td class="source"><a href="#l24"> 24</a> </td>
|
|
458
|
</tr>
|
|
435
|
</tr>
|
|
459
|
<tr id="l25" class="thisrev">
|
|
436
|
<tr id="l25" class="thisrev">
|
|
460
|
<td class="annotate">
|
|
437
|
<td class="annotate">
|
|
461
|
<a href="/annotate/06824edf55d0/primes.py#l25"
|
|
438
|
|
|
462
|
title="06824edf55d0: a">test@0</a>
|
|
|
|
|
463
|
</td>
|
|
439
|
</td>
|
|
464
|
<td class="source"><a href="#l25"> 25</a> <span class="kn">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">"__main__"</span><span class="p">:</span></td>
|
|
440
|
<td class="source"><a href="#l25"> 25</a> <span class="kn">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">"__main__"</span><span class="p">:</span></td>
|
|
465
|
</tr>
|
|
441
|
</tr>
|
|
466
|
<tr id="l26" class="thisrev">
|
|
442
|
<tr id="l26" class="thisrev">
|
|
467
|
<td class="annotate">
|
|
443
|
<td class="annotate">
|
|
468
|
<a href="/annotate/06824edf55d0/primes.py#l26"
|
|
444
|
|
|
469
|
title="06824edf55d0: a">test@0</a>
|
|
|
|
|
470
|
</td>
|
|
445
|
</td>
|
|
471
|
<td class="source"><a href="#l26"> 26</a> <span class="kn">import</span> <span class="nn">sys</span></td>
|
|
446
|
<td class="source"><a href="#l26"> 26</a> <span class="kn">import</span> <span class="nn">sys</span></td>
|
|
472
|
</tr>
|
|
447
|
</tr>
|
|
473
|
<tr id="l27" class="thisrev">
|
|
448
|
<tr id="l27" class="thisrev">
|
|
474
|
<td class="annotate">
|
|
449
|
<td class="annotate">
|
|
475
|
<a href="/annotate/06824edf55d0/primes.py#l27"
|
|
450
|
|
|
476
|
title="06824edf55d0: a">test@0</a>
|
|
|
|
|
477
|
</td>
|
|
451
|
</td>
|
|
478
|
<td class="source"><a href="#l27"> 27</a> <span class="kn">try</span><span class="p">:</span></td>
|
|
452
|
<td class="source"><a href="#l27"> 27</a> <span class="kn">try</span><span class="p">:</span></td>
|
|
479
|
</tr>
|
|
453
|
</tr>
|
|
480
|
<tr id="l28" class="thisrev">
|
|
454
|
<tr id="l28" class="thisrev">
|
|
481
|
<td class="annotate">
|
|
455
|
<td class="annotate">
|
|
482
|
<a href="/annotate/06824edf55d0/primes.py#l28"
|
|
456
|
|
|
483
|
title="06824edf55d0: a">test@0</a>
|
|
|
|
|
484
|
</td>
|
|
457
|
</td>
|
|
485
|
<td class="source"><a href="#l28"> 28</a> <span class="n">n</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span></td>
|
|
458
|
<td class="source"><a href="#l28"> 28</a> <span class="n">n</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span></td>
|
|
486
|
</tr>
|
|
459
|
</tr>
|
|
487
|
<tr id="l29" class="thisrev">
|
|
460
|
<tr id="l29" class="thisrev">
|
|
488
|
<td class="annotate">
|
|
461
|
<td class="annotate">
|
|
489
|
<a href="/annotate/06824edf55d0/primes.py#l29"
|
|
462
|
|
|
490
|
title="06824edf55d0: a">test@0</a>
|
|
|
|
|
491
|
</td>
|
|
463
|
</td>
|
|
492
|
<td class="source"><a href="#l29"> 29</a> <span class="kn">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">IndexError</span><span class="p">):</span></td>
|
|
464
|
<td class="source"><a href="#l29"> 29</a> <span class="kn">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">IndexError</span><span class="p">):</span></td>
|
|
493
|
</tr>
|
|
465
|
</tr>
|
|
494
|
<tr id="l30" class="thisrev">
|
|
466
|
<tr id="l30" class="thisrev">
|
|
495
|
<td class="annotate">
|
|
467
|
<td class="annotate">
|
|
496
|
<a href="/annotate/06824edf55d0/primes.py#l30"
|
|
468
|
|
|
497
|
title="06824edf55d0: a">test@0</a>
|
|
|
|
|
498
|
</td>
|
|
469
|
</td>
|
|
499
|
<td class="source"><a href="#l30"> 30</a> <span class="n">n</span> <span class="o">=</span> <span class="mi">10</span></td>
|
|
470
|
<td class="source"><a href="#l30"> 30</a> <span class="n">n</span> <span class="o">=</span> <span class="mi">10</span></td>
|
|
500
|
</tr>
|
|
471
|
</tr>
|
|
501
|
<tr id="l31" class="thisrev">
|
|
472
|
<tr id="l31" class="thisrev">
|
|
502
|
<td class="annotate">
|
|
473
|
<td class="annotate">
|
|
503
|
<a href="/annotate/06824edf55d0/primes.py#l31"
|
|
474
|
|
|
504
|
title="06824edf55d0: a">test@0</a>
|
|
|
|
|
505
|
</td>
|
|
475
|
</td>
|
|
506
|
<td class="source"><a href="#l31"> 31</a> <span class="n">p</span> <span class="o">=</span> <span class="n">primes</span><span class="p">()</span></td>
|
|
476
|
<td class="source"><a href="#l31"> 31</a> <span class="n">p</span> <span class="o">=</span> <span class="n">primes</span><span class="p">()</span></td>
|
|
507
|
</tr>
|
|
477
|
</tr>
|
|
508
|
<tr id="l32" class="thisrev">
|
|
478
|
<tr id="l32" class="thisrev">
|
|
509
|
<td class="annotate">
|
|
479
|
<td class="annotate">
|
|
510
|
<a href="/annotate/06824edf55d0/primes.py#l32"
|
|
480
|
|
|
511
|
title="06824edf55d0: a">test@0</a>
|
|
|
|
|
512
|
</td>
|
|
481
|
</td>
|
|
513
|
<td class="source"><a href="#l32"> 32</a> <span class="kn">print</span> <span class="s">"The first </span><span class="si">%d</span><span class="s"> primes: </span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="nb">list</span><span class="p">(</span><span class="n">islice</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">n</span><span class="p">)))</span></td>
|
|
482
|
<td class="source"><a href="#l32"> 32</a> <span class="kn">print</span> <span class="s">"The first </span><span class="si">%d</span><span class="s"> primes: </span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="nb">list</span><span class="p">(</span><span class="n">islice</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">n</span><span class="p">)))</span></td>
|
|
514
|
</tr>
|
|
483
|
</tr>
|
|
515
|
<tr id="l33" class="thisrev">
|
|
484
|
<tr id="l33" class="thisrev">
|
|
516
|
<td class="annotate">
|
|
485
|
<td class="annotate">
|
|
517
|
<a href="/annotate/06824edf55d0/primes.py#l33"
|
|
486
|
|
|
518
|
title="06824edf55d0: a">test@0</a>
|
|
|
|
|
519
|
</td>
|
|
487
|
</td>
|
|
520
|
<td class="source"><a href="#l33"> 33</a> </td>
|
|
488
|
<td class="source"><a href="#l33"> 33</a> </td>
|
|
521
|
</tr>
|
|
489
|
</tr>
|