{"action":"created","comment":{"url":"https://api.github.com/repos/onRightSide/python_algorithms/pulls/comments/205475770","pull_request_review_id":140747382,"id":205475770,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNTQ3NTc3MA==","diff_hunk":"@@ -0,0 +1,106 @@\n+# 2. Написать два алгоритма нахождения i-го по счёту простого числа. Первый - использовать алгоритм решето Эратосфена.\n+# Второй - без использования \"решета\". Проанализировать скорость и сложность алгоритмов.\n+\n+\n+import math\n+\n+\n+import cProfile\n+\n+\n+def prime_eratosfen(n):\n+\n+    list_range = 11\n+    n -= 1\n+\n+    while True:\n+\n+        top_border = 100 * (n // list_range + 1)\n+        num_list = [num for num in range(2, top_border + 1)]\n+\n+        index = 0\n+\n+        while index < math.sqrt(top_border):\n+\n+            if index == n:\n+                return num_list[n]\n+\n+            step = num_list[index]\n+            p = step\n+            mult = 2\n+\n+            while p * mult < top_border:\n+\n+                step = p * mult\n+                try:\n+                    num_list.remove(step)\n+                    mult += 1\n+                except ValueError:\n+                    mult += 1\n+            index += 1\n+        try:\n+            if num_list[n]:\n+                return num_list[n]\n+        except IndexError:\n+            list_range -= 1\n+\n+\n+# 100 loops, best of 5: 133 usec per loop  (10 номер)\n+# 100 loops, best of 5: 8.11 msec per loop (100 номер)\n+# 100 loops, best of 5: 615 msec per loop  (1000 номер)\n+\n+# cProfile.run(\"prime_eratosfen(1000)\"):  19056 function calls in 0.561 seconds\n+\n+\n+def prime_eratosfen_modified(n):\n+\n+    list_range = 11\n+\n+    while True:\n+\n+        top_border = 100 * (n // list_range + 1)\n+        num_list = [num for num in range(top_border + 1)]\n+        prime_list = []\n+\n+        for i in range(2, top_border - 1):\n+            if num_list[i] != -1:\n+                prime_list.append(num_list[i])\n+                for j in range(i, top_border + 1 - i, i):\n+                    num_list[j] = -1\n+\n+        return prime_list[n - 1]\n+\n+\n+# 100 loops, best of 5: 32.5 usec per loop (10 номер)\n+# 100 loops, best of 5: 347 usec per loop  (100 номер)\n+# 100 loops, best of 5: 3.33 msec per loop (1000 номер)\n+\n+\n+# cProfile.run(\"prime_eratosfen_modified(1000)\"): 1140 function calls in 0.004 seconds\n+\n+\n+def prime(n):\n+    list_range = 11\n+    while True:\n+        top_border = 100 * (n // list_range + 1)\n+        prime_list = []\n+\n+        index = 0\n+\n+        for num in range(2, top_border):\n+            for div in prime_list:\n+                if num % div == 0:\n+                    break\n+            else:\n+                index += 1\n+                prime_list.append(num)\n+                if index == n:\n+                    return num\n+\n+\n+# 100 loops, best of 5: 9.37 usec per loop (10 номер)\n+# 100 loops, best of 5: 434 usec per loop  (100 номер)\n+# 100 loops, best of 5: 41.8 msec per loop (1000 номер)\n+\n+# cProfile.run(\"prime(1000)\"): 1004 function calls in 0.042 seconds\n+","path":"Задача_2.py","position":106,"original_position":106,"commit_id":"fd541c1db2ce851488cb1fe58489b89396fccaa6","original_commit_id":"fd541c1db2ce851488cb1fe58489b89396fccaa6","user":{"login":"Dzhoker1","id":31956448,"node_id":"MDQ6VXNlcjMxOTU2NDQ4","avatar_url":"https://avatars2.githubusercontent.com/u/31956448?v=4","gravatar_id":"","url":"https://api.github.com/users/Dzhoker1","html_url":"https://github.com/Dzhoker1","followers_url":"https://api.github.com/users/Dzhoker1/followers","following_url":"https://api.github.com/users/Dzhoker1/following{/other_user}","gists_url":"https://api.github.com/users/Dzhoker1/gists{/gist_id}","starred_url":"https://api.github.com/users/Dzhoker1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dzhoker1/subscriptions","organizations_url":"https://api.github.com/users/Dzhoker1/orgs","repos_url":"https://api.github.com/users/Dzhoker1/repos","events_url":"https://api.github.com/users/Dzhoker1/events{/privacy}","received_events_url":"https://api.github.com/users/Dzhoker1/received_events","type":"User","site_admin":false},"body":"Попробовал найти 10000-е число. У вас получилось?","created_at":"2018-07-26T14:20:06Z","updated_at":"2018-07-26T14:21:08Z","html_url":"https://github.com/onRightSide/python_algorithms/pull/4#discussion_r205475770","pull_request_url":"https://api.github.com/repos/onRightSide/python_algorithms/pulls/4","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/onRightSide/python_algorithms/pulls/comments/205475770"},"html":{"href":"https://github.com/onRightSide/python_algorithms/pull/4#discussion_r205475770"},"pull_request":{"href":"https://api.github.com/repos/onRightSide/python_algorithms/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/onRightSide/python_algorithms/pulls/4","id":204036110,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA0MDM2MTEw","html_url":"https://github.com/onRightSide/python_algorithms/pull/4","diff_url":"https://github.com/onRightSide/python_algorithms/pull/4.diff","patch_url":"https://github.com/onRightSide/python_algorithms/pull/4.patch","issue_url":"https://api.github.com/repos/onRightSide/python_algorithms/issues/4","number":4,"state":"open","locked":false,"title":"Lesson 5","user":{"login":"onRightSide","id":40866049,"node_id":"MDQ6VXNlcjQwODY2MDQ5","avatar_url":"https://avatars1.githubusercontent.com/u/40866049?v=4","gravatar_id":"","url":"https://api.github.com/users/onRightSide","html_url":"https://github.com/onRightSide","followers_url":"https://api.github.com/users/onRightSide/followers","following_url":"https://api.github.com/users/onRightSide/following{/other_user}","gists_url":"https://api.github.com/users/onRightSide/gists{/gist_id}","starred_url":"https://api.github.com/users/onRightSide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onRightSide/subscriptions","organizations_url":"https://api.github.com/users/onRightSide/orgs","repos_url":"https://api.github.com/users/onRightSide/repos","events_url":"https://api.github.com/users/onRightSide/events{/privacy}","received_events_url":"https://api.github.com/users/onRightSide/received_events","type":"User","site_admin":false},"body":"ДЗ_5\r\n\r\nВ качестве комментариев можно сказать, что:\r\n- Пайтон - стайл добавляет скорости\r\n- Сет катастрофически ускоряет программу, где требуются многократные проходы по списку с повторяющимися элементами\r\n- Алгоритм Эратосфена позволяет наиболее быстро посчитать i-тое простое число","created_at":"2018-07-26T06:00:57Z","updated_at":"2018-07-26T14:21:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ef1df07ff7af35ff54d7ca3cbcc6aa25b46e798b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/onRightSide/python_algorithms/pulls/4/commits","review_comments_url":"https://api.github.com/repos/onRightSide/python_algorithms/pulls/4/comments","review_comment_url":"https://api.github.com/repos/onRightSide/python_algorithms/pulls/comments{/number}","comments_url":"https://api.github.com/repos/onRightSide/python_algorithms/issues/4/comments","statuses_url":"https://api.github.com/repos/onRightSide/python_algorithms/statuses/fd541c1db2ce851488cb1fe58489b89396fccaa6","head":{"label":"onRightSide:lesson_5","ref":"lesson_5","sha":"fd541c1db2ce851488cb1fe58489b89396fccaa6","user":{"login":"onRightSide","id":40866049,"node_id":"MDQ6VXNlcjQwODY2MDQ5","avatar_url":"https://avatars1.githubusercontent.com/u/40866049?v=4","gravatar_id":"","url":"https://api.github.com/users/onRightSide","html_url":"https://github.com/onRightSide","followers_url":"https://api.github.com/users/onRightSide/followers","following_url":"https://api.github.com/users/onRightSide/following{/other_user}","gists_url":"https://api.github.com/users/onRightSide/gists{/gist_id}","starred_url":"https://api.github.com/users/onRightSide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onRightSide/subscriptions","organizations_url":"https://api.github.com/users/onRightSide/orgs","repos_url":"https://api.github.com/users/onRightSide/repos","events_url":"https://api.github.com/users/onRightSide/events{/privacy}","received_events_url":"https://api.github.com/users/onRightSide/received_events","type":"User","site_admin":false},"repo":{"id":141058719,"node_id":"MDEwOlJlcG9zaXRvcnkxNDEwNTg3MTk=","name":"python_algorithms","full_name":"onRightSide/python_algorithms","owner":{"login":"onRightSide","id":40866049,"node_id":"MDQ6VXNlcjQwODY2MDQ5","avatar_url":"https://avatars1.githubusercontent.com/u/40866049?v=4","gravatar_id":"","url":"https://api.github.com/users/onRightSide","html_url":"https://github.com/onRightSide","followers_url":"https://api.github.com/users/onRightSide/followers","following_url":"https://api.github.com/users/onRightSide/following{/other_user}","gists_url":"https://api.github.com/users/onRightSide/gists{/gist_id}","starred_url":"https://api.github.com/users/onRightSide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onRightSide/subscriptions","organizations_url":"https://api.github.com/users/onRightSide/orgs","repos_url":"https://api.github.com/users/onRightSide/repos","events_url":"https://api.github.com/users/onRightSide/events{/privacy}","received_events_url":"https://api.github.com/users/onRightSide/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/onRightSide/python_algorithms","description":null,"fork":false,"url":"https://api.github.com/repos/onRightSide/python_algorithms","forks_url":"https://api.github.com/repos/onRightSide/python_algorithms/forks","keys_url":"https://api.github.com/repos/onRightSide/python_algorithms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/onRightSide/python_algorithms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/onRightSide/python_algorithms/teams","hooks_url":"https://api.github.com/repos/onRightSide/python_algorithms/hooks","issue_events_url":"https://api.github.com/repos/onRightSide/python_algorithms/issues/events{/number}","events_url":"https://api.github.com/repos/onRightSide/python_algorithms/events","assignees_url":"https://api.github.com/repos/onRightSide/python_algorithms/assignees{/user}","branches_url":"https://api.github.com/repos/onRightSide/python_algorithms/branches{/branch}","tags_url":"https://api.github.com/repos/onRightSide/python_algorithms/tags","blobs_url":"https://api.github.com/repos/onRightSide/python_algorithms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/onRightSide/python_algorithms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/onRightSide/python_algorithms/git/refs{/sha}","trees_url":"https://api.github.com/repos/onRightSide/python_algorithms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/onRightSide/python_algorithms/statuses/{sha}","languages_url":"https://api.github.com/repos/onRightSide/python_algorithms/languages","stargazers_url":"https://api.github.com/repos/onRightSide/python_algorithms/stargazers","contributors_url":"https://api.github.com/repos/onRightSide/python_algorithms/contributors","subscribers_url":"https://api.github.com/repos/onRightSide/python_algorithms/subscribers","subscription_url":"https://api.github.com/repos/onRightSide/python_algorithms/subscription","commits_url":"https://api.github.com/repos/onRightSide/python_algorithms/commits{/sha}","git_commits_url":"https://api.github.com/repos/onRightSide/python_algorithms/git/commits{/sha}","comments_url":"https://api.github.com/repos/onRightSide/python_algorithms/comments{/number}","issue_comment_url":"https://api.github.com/repos/onRightSide/python_algorithms/issues/comments{/number}","contents_url":"https://api.github.com/repos/onRightSide/python_algorithms/contents/{+path}","compare_url":"https://api.github.com/repos/onRightSide/python_algorithms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/onRightSide/python_algorithms/merges","archive_url":"https://api.github.com/repos/onRightSide/python_algorithms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/onRightSide/python_algorithms/downloads","issues_url":"https://api.github.com/repos/onRightSide/python_algorithms/issues{/number}","pulls_url":"https://api.github.com/repos/onRightSide/python_algorithms/pulls{/number}","milestones_url":"https://api.github.com/repos/onRightSide/python_algorithms/milestones{/number}","notifications_url":"https://api.github.com/repos/onRightSide/python_algorithms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/onRightSide/python_algorithms/labels{/name}","releases_url":"https://api.github.com/repos/onRightSide/python_algorithms/releases{/id}","deployments_url":"https://api.github.com/repos/onRightSide/python_algorithms/deployments","created_at":"2018-07-15T21:10:37Z","updated_at":"2018-07-15T21:13:41Z","pushed_at":"2018-07-26T06:00:57Z","git_url":"git://github.com/onRightSide/python_algorithms.git","ssh_url":"git@github.com:onRightSide/python_algorithms.git","clone_url":"https://github.com/onRightSide/python_algorithms.git","svn_url":"https://github.com/onRightSide/python_algorithms","homepage":null,"size":15,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"license":null,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"onRightSide:master","ref":"master","sha":"5d5ee91b778dee6bab1475eba16712bb90e3e0fb","user":{"login":"onRightSide","id":40866049,"node_id":"MDQ6VXNlcjQwODY2MDQ5","avatar_url":"https://avatars1.githubusercontent.com/u/40866049?v=4","gravatar_id":"","url":"https://api.github.com/users/onRightSide","html_url":"https://github.com/onRightSide","followers_url":"https://api.github.com/users/onRightSide/followers","following_url":"https://api.github.com/users/onRightSide/following{/other_user}","gists_url":"https://api.github.com/users/onRightSide/gists{/gist_id}","starred_url":"https://api.github.com/users/onRightSide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onRightSide/subscriptions","organizations_url":"https://api.github.com/users/onRightSide/orgs","repos_url":"https://api.github.com/users/onRightSide/repos","events_url":"https://api.github.com/users/onRightSide/events{/privacy}","received_events_url":"https://api.github.com/users/onRightSide/received_events","type":"User","site_admin":false},"repo":{"id":141058719,"node_id":"MDEwOlJlcG9zaXRvcnkxNDEwNTg3MTk=","name":"python_algorithms","full_name":"onRightSide/python_algorithms","owner":{"login":"onRightSide","id":40866049,"node_id":"MDQ6VXNlcjQwODY2MDQ5","avatar_url":"https://avatars1.githubusercontent.com/u/40866049?v=4","gravatar_id":"","url":"https://api.github.com/users/onRightSide","html_url":"https://github.com/onRightSide","followers_url":"https://api.github.com/users/onRightSide/followers","following_url":"https://api.github.com/users/onRightSide/following{/other_user}","gists_url":"https://api.github.com/users/onRightSide/gists{/gist_id}","starred_url":"https://api.github.com/users/onRightSide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onRightSide/subscriptions","organizations_url":"https://api.github.com/users/onRightSide/orgs","repos_url":"https://api.github.com/users/onRightSide/repos","events_url":"https://api.github.com/users/onRightSide/events{/privacy}","received_events_url":"https://api.github.com/users/onRightSide/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/onRightSide/python_algorithms","description":null,"fork":false,"url":"https://api.github.com/repos/onRightSide/python_algorithms","forks_url":"https://api.github.com/repos/onRightSide/python_algorithms/forks","keys_url":"https://api.github.com/repos/onRightSide/python_algorithms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/onRightSide/python_algorithms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/onRightSide/python_algorithms/teams","hooks_url":"https://api.github.com/repos/onRightSide/python_algorithms/hooks","issue_events_url":"https://api.github.com/repos/onRightSide/python_algorithms/issues/events{/number}","events_url":"https://api.github.com/repos/onRightSide/python_algorithms/events","assignees_url":"https://api.github.com/repos/onRightSide/python_algorithms/assignees{/user}","branches_url":"https://api.github.com/repos/onRightSide/python_algorithms/branches{/branch}","tags_url":"https://api.github.com/repos/onRightSide/python_algorithms/tags","blobs_url":"https://api.github.com/repos/onRightSide/python_algorithms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/onRightSide/python_algorithms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/onRightSide/python_algorithms/git/refs{/sha}","trees_url":"https://api.github.com/repos/onRightSide/python_algorithms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/onRightSide/python_algorithms/statuses/{sha}","languages_url":"https://api.github.com/repos/onRightSide/python_algorithms/languages","stargazers_url":"https://api.github.com/repos/onRightSide/python_algorithms/stargazers","contributors_url":"https://api.github.com/repos/onRightSide/python_algorithms/contributors","subscribers_url":"https://api.github.com/repos/onRightSide/python_algorithms/subscribers","subscription_url":"https://api.github.com/repos/onRightSide/python_algorithms/subscription","commits_url":"https://api.github.com/repos/onRightSide/python_algorithms/commits{/sha}","git_commits_url":"https://api.github.com/repos/onRightSide/python_algorithms/git/commits{/sha}","comments_url":"https://api.github.com/repos/onRightSide/python_algorithms/comments{/number}","issue_comment_url":"https://api.github.com/repos/onRightSide/python_algorithms/issues/comments{/number}","contents_url":"https://api.github.com/repos/onRightSide/python_algorithms/contents/{+path}","compare_url":"https://api.github.com/repos/onRightSide/python_algorithms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/onRightSide/python_algorithms/merges","archive_url":"https://api.github.com/repos/onRightSide/python_algorithms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/onRightSide/python_algorithms/downloads","issues_url":"https://api.github.com/repos/onRightSide/python_algorithms/issues{/number}","pulls_url":"https://api.github.com/repos/onRightSide/python_algorithms/pulls{/number}","milestones_url":"https://api.github.com/repos/onRightSide/python_algorithms/milestones{/number}","notifications_url":"https://api.github.com/repos/onRightSide/python_algorithms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/onRightSide/python_algorithms/labels{/name}","releases_url":"https://api.github.com/repos/onRightSide/python_algorithms/releases{/id}","deployments_url":"https://api.github.com/repos/onRightSide/python_algorithms/deployments","created_at":"2018-07-15T21:10:37Z","updated_at":"2018-07-15T21:13:41Z","pushed_at":"2018-07-26T06:00:57Z","git_url":"git://github.com/onRightSide/python_algorithms.git","ssh_url":"git@github.com:onRightSide/python_algorithms.git","clone_url":"https://github.com/onRightSide/python_algorithms.git","svn_url":"https://github.com/onRightSide/python_algorithms","homepage":null,"size":15,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"license":null,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/onRightSide/python_algorithms/pulls/4"},"html":{"href":"https://github.com/onRightSide/python_algorithms/pull/4"},"issue":{"href":"https://api.github.com/repos/onRightSide/python_algorithms/issues/4"},"comments":{"href":"https://api.github.com/repos/onRightSide/python_algorithms/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/onRightSide/python_algorithms/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/onRightSide/python_algorithms/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/onRightSide/python_algorithms/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/onRightSide/python_algorithms/statuses/fd541c1db2ce851488cb1fe58489b89396fccaa6"}},"author_association":"OWNER"}}
{"actor":{"display_login":"Dzhoker1"}}