1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

素数だ・・素数を数えるんだ・・・

Posted at

■コード確認

[root@entaku19890818 ~]# cat prime.py
#coding: UTF-8
from bottle import route,template,run
@route('/prime')

def prime():
        MAX = 10000
        LIST = range(2, MAX + 1)
        for i in range(2, int(MAX ** 0.5)):
                LIST = [x for x in LIST if (x == i or x % i != 0)]
        for j in LIST:
                 print j

run(host='www.entaku19890818.com', port=8080)

■実行

[root@entaku19890818 ~]# python prime.py
Bottle v0.13-dev server starting up (using WSGIRefServer())...
Listening on http://www.entaku19890818.com:8080/
Hit Ctrl-C to quit.

2
3
5
7
11
13
17
19
23
29
31
37
41
43
47
53
59
61
67
71
73
79
83
89
97
42.146.144.127 - - [05/May/2015 12:58:58] "GET /prime HTTP/1.1" 200 0

ホントはWebに表示したいんだけどなー

1
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?