VOOZH about

URL: https://qiita.com/entaku0818/items/74f8a7fb47a4a1b2589e

⇱ 素数だ・・素数を数えるんだ・・・ #Python - Qiita


👁 Image
1

Go to list of users who liked

0

Share on X(Twitter)

Share on Facebook

Add to Hatena Bookmark

More than 5 years have passed since last update.

@entaku0818(Takuya Endo)in👁 Image
エンジニアと人生コミュニティ

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

1
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

Go to list of users who liked

0
0

Go to list of comments

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

Go to list of users who liked

0