{"id":15132,"date":"2021-10-29T07:53:51","date_gmt":"2021-10-29T07:53:51","guid":{"rendered":"https:\/\/club.informatix.co.jp\/?p=15132"},"modified":"2024-10-31T05:12:54","modified_gmt":"2024-10-31T05:12:54","slug":"python%e3%81%a7%e3%82%aa%e3%82%a4%e3%83%a9%e3%83%bc%e3%80%80%e3%82%bc%e3%83%bc%e3%82%bf%e3%81%ae%e3%82%aa%e3%82%a4%e3%83%a9%e3%83%bc%e7%a9%8d%ef%bd%9cpython%e3%81%a7%e6%95%b0%e5%ad%a6%e3%82%92-2","status":"publish","type":"post","link":"https:\/\/club.informatix.co.jp\/?p=15132","title":{"rendered":"Python\u3067\u30aa\u30a4\u30e9\u30fc\u3000\u30bc\u30fc\u30bf\u306e\u30aa\u30a4\u30e9\u30fc\u7a4d<\u5f8c\u7de8>\uff5cPython\u3067\u6570\u5b66\u3092\u5b66\u307c\u3046\uff01 \u7b2c14\u56de"},"content":{"rendered":"<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-15136\" src=\"https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/10\/20211029-5.jpg\" alt=\"\" width=\"800\" height=\"500\" srcset=\"https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/10\/20211029-5.jpg 800w, https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/10\/20211029-5-300x188.jpg 300w, https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/10\/20211029-5-768x480.jpg 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p>\n<p><a href=\"https:\/\/club.informatix.co.jp\/?p=14788\" target=\"_blank\" rel=\"noopener\">\u524d\u7de8<\/a>\u3067\u306f\u30aa\u30a4\u30e9\u30fc\u306e<a href=\"https:\/\/club.informatix.co.jp\/?p=3326\" target=\"_blank\" rel=\"noopener\">\u30bc\u30fc\u30bf\u95a2\u6570<\/a>\u306ePython\u30b3\u30fc\u30c9mpmath.zeta()\u3068\u30aa\u30a4\u30e9\u30fc\u7a4d\u306e\u7c21\u5358\u306a\u8aac\u660e\u3092\u884c\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\u5f8c\u7de8\u3067\u306f<a href=\"https:\/\/club.informatix.co.jp\/?p=3060\" target=\"_blank\" rel=\"noopener\">\u30aa\u30a4\u30e9\u30fc<\/a>\u306e\u7a4d\u8a08\u7b97\u7528\u30b3\u30fc\u30c9\uff085\u3064\uff09\u3068\u305d\u306e\u8a08\u7b97\u7d50\u679c\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">\u76ee\u6b21<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69e69ac783eac\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69e69ac783eac\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/club.informatix.co.jp\/?p=15132\/#%E3%82%B3%E3%83%BC%E3%83%891%E3%80%80%E3%80%8Ceulerpdoductipynb%E3%80%8DJupyter_Notebook%E7%94%A8%EF%BC%89\" >\u30b3\u30fc\u30c91\u3000\u300ceulerpdoduct.ipynb\u300d(Jupyter Notebook\u7528\uff09<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/club.informatix.co.jp\/?p=15132\/#%E3%82%B3%E3%83%BC%E3%83%891%E3%80%80%E5%AE%9F%E8%A1%8C%E7%B5%90%E6%9E%9C\" >\u30b3\u30fc\u30c91\u3000\u5b9f\u884c\u7d50\u679c<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/club.informatix.co.jp\/?p=15132\/#%E3%82%B3%E3%83%BC%E3%83%892%E3%80%80%E3%80%8Ceulerproduct_zeta2_nolistpy%E3%80%8D\" >\u30b3\u30fc\u30c92\u3000\u300ceulerproduct_zeta2_nolist.py\u300d<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/club.informatix.co.jp\/?p=15132\/#%E3%82%B3%E3%83%BC%E3%83%893%E3%80%80%E3%80%8Cprimelist_file_primepy%E3%80%8D\" >\u30b3\u30fc\u30c93\u3000\u300cprimelist_file_prime.py\u300d<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/club.informatix.co.jp\/?p=15132\/#%E3%82%B3%E3%83%BC%E3%83%893%E3%80%80%E5%AE%9F%E8%A1%8C%E7%B5%90%E6%9E%9C\" >\u30b3\u30fc\u30c93\u3000\u5b9f\u884c\u7d50\u679c<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/club.informatix.co.jp\/?p=15132\/#%E3%82%B3%E3%83%BC%E3%83%894%E3%80%80%E3%80%8Cprimelist_file_eratosthenespy%E3%80%8D\" >\u30b3\u30fc\u30c94\u3000\u300cprimelist_file_eratosthenes.py\u300d<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/club.informatix.co.jp\/?p=15132\/#%E3%82%B3%E3%83%BC%E3%83%894%E3%80%80%E5%AE%9F%E8%A1%8C%E7%B5%90%E6%9E%9C\" >\u30b3\u30fc\u30c94\u3000\u5b9f\u884c\u7d50\u679c<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/club.informatix.co.jp\/?p=15132\/#%E3%82%B3%E3%83%BC%E3%83%895%E3%80%80%E3%80%8Ceulerproduct_zeta2_listpy%E3%80%8D\" >\u30b3\u30fc\u30c95\u3000\u300ceulerproduct_zeta2_list.py\u300d<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/club.informatix.co.jp\/?p=15132\/#%E3%82%B3%E3%83%BC%E3%83%895%E3%80%80%E5%AE%9F%E8%A1%8C%E7%B5%90%E6%9E%9C\" >\u30b3\u30fc\u30c95\u3000\u5b9f\u884c\u7d50\u679c<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n\n<h2><span class=\"ez-toc-section\" id=\"%E3%82%B3%E3%83%BC%E3%83%891%E3%80%80%E3%80%8Ceulerpdoductipynb%E3%80%8DJupyter_Notebook%E7%94%A8%EF%BC%89\"><\/span>\u30b3\u30fc\u30c91\u3000\u300ceulerpdoduct.ipynb\u300d(Jupyter Notebook\u7528\uff09<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-15137\" src=\"https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/10\/20211029-1.jpg\" alt=\"\" width=\"800\" height=\"1009\" srcset=\"https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/10\/20211029-1.jpg 800w, https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/10\/20211029-1-238x300.jpg 238w, https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/10\/20211029-1-768x969.jpg 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>\u307e\u305a\u306f\u304a\u624b\u8efd\u306a\u30b3\u30fc\u30c91\u3067\u3059\u3002Jupyter Notebook\u7528\u3067\u3059\u304b\u3089\u6c17\u8efd\u306b\u30aa\u30a4\u30e9\u30fc\u7a4d\u306e\u8a08\u7b97\u3092\u8a66\u3057\u3066\u307f\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u6838\u306b\u306a\u308b\u30b3\u30fc\u30c9\u306f\u30aa\u30a4\u30e9\u30fc\u7a4d\u306e\u95a2\u6570\u5b9a\u7fa9\u90e8\u5206\u3067\u3059\u3002<\/p>\n<p>&gt;&gt;&gt; #\u3010\u518d\u5e30\u7684\u5b9a\u7fa9\u3011\u30ce\u30fc\u30de\u30eb\u6f14\u7b97 \u4efb\u610f\u7cbe\u5ea6\u6f14\u7b97 mp.mpf()\u306a\u3057<br \/>\n&gt;&gt;&gt; def eulerproduct0(N):<br \/>\n&gt;&gt;&gt;\u3000\u3000 if N == 0:<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000return 1<br \/>\n&gt;&gt;&gt; \u3000\u3000else:<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000product = 1\/(1-1\/(prime(N)**2))<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000return eulerproduct(N-1)*product<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; # \u3010\u518d\u5e30\u7684\u5b9a\u7fa9\u3011\u4efb\u610f\u7cbe\u5ea6\u6f14\u7b97 mp.mpf()\u4f7f\u7528<br \/>\n&gt;&gt;&gt; def eulerproduct(N):<br \/>\n&gt;&gt;&gt; \u3000\u3000if N == 0:<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000return 1<br \/>\n&gt;&gt;&gt; \u3000\u3000else:<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000product = 1\/(1-mp.mpf(&#8216;1&#8217;)\/(prime(N)**2))<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000return eulerproduct(N-1)*product<\/p>\n<p><a href=\"https:\/\/drive.google.com\/file\/d\/1yC9lnFOG1JJRRltl1hAng7zMfT4F7y0v\/view?usp=sharing\" target=\"_blank\" rel=\"noopener\">\u30d5\u30a1\u30a4\u30eb\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u306f\u30b3\u30c1\u30e9<\/a><\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-15133\" src=\"https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/10\/20211029-2.jpg\" alt=\"\" width=\"800\" height=\"62\" srcset=\"https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/10\/20211029-2.jpg 800w, https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/10\/20211029-2-300x23.jpg 300w, https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/10\/20211029-2-768x60.jpg 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>\u7d20\u6570\u7a4dproduct = 1\/(1-1\/(prime(N)**2)) \u306e\u8a08\u7b97\u7cbe\u5ea6\u304c\u5fc3\u914d\u306a\u306e\u3067\u3001\u30ce\u30fc\u30de\u30eb\u6f14\u7b97\u306eeulerproduct0(N)\u3068\u4efb\u610f\u7cbe\u5ea6\u6f14\u7b97mp.mpf()\u3092\u4f7f\u3063\u305feulerproduct(N)\u306e2\u3064\u3092\u5b9a\u7fa9\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u524d\u7de8\u3067\u3082\u8aac\u660e\u3057\u305f\u3088\u3046\u306b\u3001n\u756a\u76ee\u306e\u7d20\u6570\u3092\u4e0e\u3048\u308b\u95a2\u6570sympy.prime(n)\u306e\u304a\u304b\u3052\u3067\u9762\u5012\u306a\u30b3\u30fc\u30c9\u304c\u4e0d\u8981\u306a\u306e\u3067\u3059\u3002<\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E3%82%B3%E3%83%BC%E3%83%891%E3%80%80%E5%AE%9F%E8%A1%8C%E7%B5%90%E6%9E%9C\"><\/span>\u30b3\u30fc\u30c91\u3000\u5b9f\u884c\u7d50\u679c<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<table style=\"height: 164px; width: 100%; border-collapse: collapse; border-style: none; border-color: #ffffff;\" border=\"0\">\n<tbody>\n<tr style=\"height: 18px;\">\n<td style=\"width: 36.7225%; height: 18px; border-style: none; border-color: #ffffff; text-align: right;\">\u03b6(2) =<\/td>\n<td style=\"width: 63.2775%; height: 18px; border-style: none; border-color: #ffffff;\">1.6449340668482264061\uff08\u771f\u5024\uff09<\/td>\n<\/tr>\n<tr style=\"height: 18px;\">\n<td style=\"width: 36.7225%; height: 18px; border-style: none; border-color: #ffffff;\">10\u500b\u306e\u7d20\u6570 mp.mpf()\u306a\u3057<\/td>\n<td style=\"width: 63.2775%; height: 18px; border-style: none; border-color: #ffffff;\"><span style=\"color: #ff0000;\">1.6<\/span>330704904957392<span style=\"color: #3366ff;\">1342651542005<\/span><\/td>\n<\/tr>\n<tr style=\"height: 18px;\">\n<td style=\"width: 36.7225%; height: 20px; border-style: none; border-color: #ffffff;\">10\u500b\u306e\u7d20\u6570 mp.mpf()\u3042\u308a<\/td>\n<td style=\"width: 63.2775%; height: 20px; border-style: none; border-color: #ffffff;\"><span style=\"color: #ff0000;\">1.6<\/span>330704904957392<span style=\"color: #3366ff;\">2032524534874<\/span><\/td>\n<\/tr>\n<tr style=\"height: 18px;\">\n<td style=\"width: 36.7225%; height: 18px; border-style: none; border-color: #ffffff;\">100\u500b\u306e\u7d20\u6570 mp.mpf()\u306a\u3057<\/td>\n<td style=\"width: 63.2775%; height: 18px; border-style: none; border-color: #ffffff;\"><span style=\"color: #ff0000;\">1.644<\/span>515221724293<span style=\"color: #3366ff;\">61657641986079<\/span><\/td>\n<\/tr>\n<tr style=\"height: 18px;\">\n<td style=\"width: 36.7225%; height: 18px; border-style: none; border-color: #ffffff;\">100\u500b\u306e\u7d20\u6570 mp.mpf()\u3042\u308a<\/td>\n<td style=\"width: 63.2775%; height: 18px; border-style: none; border-color: #ffffff;\"><span style=\"color: #ff0000;\">1.644<\/span>515221724293<span style=\"color: #3366ff;\">75358545680644<\/span><\/td>\n<\/tr>\n<tr style=\"height: 18px;\">\n<td style=\"width: 36.7225%; height: 18px; border-style: none; border-color: #ffffff;\">1000\u500b\u306e\u7d20\u6570 mp.mpf()\u306a\u3057<\/td>\n<td style=\"width: 63.2775%; height: 18px; border-style: none; border-color: #ffffff;\"><span style=\"color: #ff0000;\">1.6449<\/span>131747063419<span style=\"color: #3366ff;\">9212269796783<\/span><\/td>\n<\/tr>\n<tr style=\"height: 18px;\">\n<td style=\"width: 36.7225%; height: 18px; border-style: none; border-color: #ffffff;\">1000\u500b\u306e\u7d20\u6570 mp.mpf()\u3042\u308a<\/td>\n<td style=\"width: 63.2775%; height: 18px; border-style: none; border-color: #ffffff;\"><span style=\"color: #ff0000;\">1.6449<\/span>131747063419<span style=\"color: #3366ff;\">8691867721661<\/span><\/td>\n<\/tr>\n<tr style=\"height: 18px;\">\n<td style=\"width: 36.7225%; height: 18px; border-style: none; border-color: #ffffff;\">2000\u500b\u306e\u7d20\u6570 mp.mpf()\u306a\u3057<\/td>\n<td style=\"width: 63.2775%; height: 18px; border-style: none; border-color: #ffffff;\"><span style=\"color: #ff0000;\">1.6449<\/span>252388472761<span style=\"color: #3366ff;\">4514999850439<\/span><\/td>\n<\/tr>\n<tr style=\"height: 18px;\">\n<td style=\"width: 36.7225%; height: 18px; border-style: none; border-color: #ffffff;\">2000\u500b\u306e\u7d20\u6570 mp.mpf()\u3042\u308a<\/td>\n<td style=\"width: 63.2775%; height: 18px; border-style: none; border-color: #ffffff;\"><span style=\"color: #ff0000;\">1.6449<\/span>252388472761<span style=\"color: #3366ff;\">3002462327701<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u7d20\u6570\u306e\u500b\u6570\u309210\u3001100\u30011000\u306810\u500d\u306b\u5897\u3084\u3057\u3066\u3044\u304f\u3068\u3001\u03b6(2)\u306e\u6b63\u3057\u3044\u5024\u304c1\u6841\u306a\u3044\u30572\u6841\u305a\u3064\u5897\u3048\u3066\u3044\u304f\u306e\u304c\u308f\u304b\u308a\u307e\u3059\u30021000\u500b\u306e\u7d20\u6570\u3092\u4f7f\u3063\u3066\u30825\u6841\u3092\u5f97\u308b\u306e\u304c\u3084\u3063\u3068\u3067\u3042\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u308c\u306b\u3057\u3066\u3082\u30011000\u756a\u76ee\u306e\u7d20\u6570prime(1000)=7919\u307e\u30671000\u500b\u306e\u7d20\u6570\u3092\u4f7f\u3063\u305f\u7a4d\u304c\u3042\u3063\u3068\u3044\u3046\u9593\u306b\u8a08\u7b97\u3067\u304d\u308b\u3053\u3068\u306b\u9a5a\u304b\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-15134\" src=\"https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/10\/20211029-3.jpg\" alt=\"\" width=\"800\" height=\"92\" srcset=\"https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/10\/20211029-3.jpg 800w, https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/10\/20211029-3-300x35.jpg 300w, https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/10\/20211029-3-768x88.jpg 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E3%82%B3%E3%83%BC%E3%83%892%E3%80%80%E3%80%8Ceulerproduct_zeta2_nolistpy%E3%80%8D\"><\/span>\u30b3\u30fc\u30c92\u3000\u300ceulerproduct_zeta2_nolist.py\u300d<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u30b3\u30fc\u30c92\u306f\u30b3\u30fc\u30c91\u306e\u901a\u5e38Python\u30b3\u30fc\u30c9\u3067\u3059\u3002<\/p>\n<p>Jupyter Notebook\u3067\u306f2000\u500b\u306e\u7d20\u6570\u306e\u8a08\u7b97\u304c\u3067\u304d\u307e\u3057\u305f\u3002\u901a\u5e38\u306ePython\uff08Python3.8\u3068Python3.9\u3067\u5b9f\u884c\uff09\u3067\u8a66\u3057\u3066\u307f\u308b\u3068900\u500b\u306e\u7d20\u6570\u307e\u3067\u3057\u304b\u8a08\u7b97\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002<\/p>\n<p>\u7686\u3055\u3093\u306ePython\u3067\u306f\u4f55\u500b\u306e\u7d20\u6570\u307e\u3067\u8a08\u7b97\u3067\u304d\u308b\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<p>&gt;&gt;&gt; # eulerproduct_zeta2_nolist.py<br \/>\n&gt;&gt;&gt; # \u03b6(2)=1.6449340668482264364724&#8230;\u306e\u30aa\u30a4\u30e9\u30fc\u7a4d\u306b\u3088\u308b\u6570\u5024\u8a08\u7b97<br \/>\n&gt;&gt;&gt; # \u7d20\u6570\u30ea\u30b9\u30c8\u306f\u4f7f\u308f\u305a\u3001sympy.prime(n)\u3092\u4f7f\u7528<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; from sympy import * # \u6570\u5024\u8a08\u7b97 sympy.N()<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; # \u4efb\u610f\u7cbe\u5ea6\u6f14\u7b97 \u6841\u6570\u8a2d\u5b9a<br \/>\n&gt;&gt;&gt; from mpmath import mp<br \/>\n&gt;&gt;&gt; mp.dps = 100 # \u5c0f\u6570\u70b9\u4ee5\u4e0b100\u6841<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; # \u30bc\u30fc\u30bf\u95a2\u6570\u03b6(x) = mpmath.zeta(x)<br \/>\n&gt;&gt;&gt; from mpmath import zeta<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; print(&#8216;\u03b6(2)=1.6449340668482264364724&#8230;\u306e\u30aa\u30a4\u30e9\u30fc\u7a4d\u306b\u3088\u308b\u6570\u5024\u8a08\u7b97 sympy.prime(n)\u5229\u7528&#8217;)<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; #\u3010\u518d\u5e30\u7684\u5b9a\u7fa9\u3011\u30ce\u30fc\u30de\u30eb\u6f14\u7b97 \u4efb\u610f\u7cbe\u5ea6\u6f14\u7b97 mp.mpf()\u306a\u3057<br \/>\n&gt;&gt;&gt; def eulerproduct0(N):<br \/>\n&gt;&gt;&gt; \u3000\u3000if N == 0:<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000return 1<br \/>\n&gt;&gt;&gt; \u3000\u3000else:<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000product = 1\/(1-1\/(prime(N)**2))<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000return eulerproduct0(N-1)*product<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; print(&#8216;\\n\u30ce\u30fc\u30de\u30eb\u6f14\u7b97 \u4efb\u610f\u7cbe\u5ea6\u6f14\u7b97 mp.mpf()\u306a\u3057&#8217;)<br \/>\n&gt;&gt;&gt; print(&#8216;\u03b6(2)=\\t&#8217;, N(zeta(2),30), &#8216;\uff08\u771f\u5024\uff09&#8217;)<br \/>\n&gt;&gt;&gt; print(&#8217;10\u30b3\\t&#8217;, N(eulerproduct0(10), 30))<br \/>\n&gt;&gt;&gt; print(&#8216;100\u30b3\\t&#8217;, N(eulerproduct0(100), 30))<br \/>\n&gt;&gt;&gt; print(&#8216;900\u30b3\\t&#8217;, N(eulerproduct0(900), 30))<br \/>\n&gt;&gt;&gt; # print(&#8216;1000\u30b3\\t&#8217;, N(eulerproduct0(1000), 30)) # NG<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; # \u3010\u518d\u5e30\u7684\u5b9a\u7fa9\u3011\u4efb\u610f\u7cbe\u5ea6\u6f14\u7b97 mp.mpf()\u4f7f\u7528<br \/>\n&gt;&gt;&gt; def eulerproduct(N):<br \/>\n&gt;&gt;&gt; \u3000\u3000if N == 0:<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000return 1<br \/>\n&gt;&gt;&gt; \u3000\u3000else:<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000product = 1\/(1-mp.mpf(&#8216;1&#8217;)\/(prime(N)**2)) # mpf\u306fReal float\u7528<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000return eulerproduct(N-1)*product<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; print(&#8216;\\n\u4efb\u610f\u7cbe\u5ea6\u6f14\u7b97 mp.mpf()\u4f7f\u7528&#8217;)<br \/>\n&gt;&gt;&gt; print(&#8216;\u03b6(2)=\\t&#8217;, N(zeta(2),30), &#8216;\uff08\u771f\u5024\uff09&#8217;)<br \/>\n&gt;&gt;&gt; print(&#8217;10\u30b3\\t&#8217;, N(eulerproduct(10), 30))<br \/>\n&gt;&gt;&gt; print(&#8216;100\u30b3\\t&#8217;, N(eulerproduct(100), 30))<br \/>\n&gt;&gt;&gt; print(&#8216;900\u30b3\\t&#8217;, N(eulerproduct(900), 30))<br \/>\n&gt;&gt;&gt; # print(&#8216;1000\u30b3\\t&#8217;, N(eulerproduct(1000), 30)) # NG<\/p>\n<p><a href=\"https:\/\/drive.google.com\/file\/d\/1CTu1uoW7fH5hM1l8el-aKUk3pcUclJom\/view?usp=sharing\" target=\"_blank\" rel=\"noopener\">\u30d5\u30a1\u30a4\u30eb\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u306f\u30b3\u30c1\u30e9<\/a><\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E3%82%B3%E3%83%BC%E3%83%893%E3%80%80%E3%80%8Cprimelist_file_primepy%E3%80%8D\"><\/span>\u30b3\u30fc\u30c93\u3000\u300cprimelist_file_prime.py\u300d<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>sympy.prime()\u3092\u4f7f\u3063\u305f\u30b3\u30fc\u30c9\u3067\u306f2000\u500b\u306e\u7d20\u6570\u304c\u9650\u754c\u3067\u3057\u305f\u3002\u305d\u3053\u3067\u3001\u5225\u306a\u4f5c\u6226\u3067\u30aa\u30a4\u30e9\u30fc\u7a4d\u306b\u6311\u3093\u3067\u307f\u307e\u3059\u3002<\/p>\n<p>\u7d20\u6570\u30ea\u30b9\u30c8\u3092\u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u51fa\u3057\u3066\u7d20\u6570\u3092\u4f7f\u3046\u65b9\u6cd5\u3067\u3059\u3002\u3053\u308c\u3082\u5b9f\u969b\u306b\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3057\u3066\u307f\u308b\u307e\u3067\u306f\u3044\u304f\u3064\u7d20\u6570\u304c\u3064\u304f\u308c\u308b\u304b\u306f\u308f\u304b\u308a\u307e\u305b\u3093\u3002\u307e\u305a\u306fsympy.prime()\u3092\u4f7f\u3063\u3066\u7d20\u6570\u30ea\u30b9\u30c8\u306e\u30d5\u30a1\u30a4\u30eb\u4f5c\u6210\u3092\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u30ea\u30b9\u30c8\u3092\u30d5\u30a1\u30a4\u30eb\u3068\u3057\u3066\u4fdd\u5b58\u3059\u308b\u305f\u3081\u306b\u6a19\u6e96\u30e9\u30a4\u30d6\u30e9\u30eapickle\u3092\u4f7f\u3044\u307e\u3059\u3002<br \/>\nprimelist_file_prime.py\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u4f55\u500b\u306e\u7d20\u6570\u3092\u30ea\u30b9\u30c8\u5316\u3059\u308b\u306e\u304b\u304d\u304b\u308c\u307e\u3059\u3002\u5927\u304d\u306a\u6570\u3092\u5165\u529b\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u305f\u3081\u3001\u3079\u304d\u4e57**\u304c\u4f7f\u3048\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>n\u306b\u5bfe\u3057\u3066\u300110**4\u3092\u5165\u529b\u3057\u305f\u3068\u3059\u308b\u3068\u300110000\u500b\u306e\u7d20\u6570\u30ea\u30b9\u30c8\u304c\u30d5\u30a1\u30a4\u30eb\u540d\u300cprimelist_10to_power4_ko.binaryfile\u300d\u3068\u3057\u3066\u4fdd\u5b58\u3055\u308c\u307e\u3059\u3002<br \/>\n\u3053\u308c\u306f\u30d0\u30a4\u30ca\u30ea\u30fc\u30d5\u30a1\u30a4\u30eb\u3067\u3059\u3002\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u306e\u3088\u3046\u306b\u30a8\u30c7\u30a3\u30bf\u30fc\u3067\u958b\u3044\u3066\u3082\u3001\u7d20\u6570\u3092\u78ba\u8a8d\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<p>\u7d20\u65702,3,5,\u2026\u3092\u305d\u306e\u307e\u307e\u30ea\u30b9\u30c8\u5316\u3057\u3066\u30d5\u30a1\u30a4\u30eb\u4fdd\u5b58\u3057\u3066\u3057\u307e\u3046\u3068\u30010\u756a\u76ee\u306e\u7d20\u6570\u304c2\u30011\u756a\u76ee\u306e\u7d20\u6570\u304c3\u3068\u306a\u308a\u4f7f\u3044\u52dd\u624b\u304c\u826f\u304f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>\u305d\u3053\u3067\u3001\u7d20\u6570\u30ea\u30b9\u30c8\u306e\u5148\u982d\uff080\u756a\u76ee\uff09\u30921\u3068\u3057\u3066\u3001\u7d9a\u3051\u30662,3,5,\u2026\u3068\u7d20\u6570\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002\u3053\u3046\u3059\u308b\u3053\u3068\u3067\u30d5\u30a1\u30a4\u30eb\u306e1\u756a\u76ee\u306e\u7d20\u6570\u304c2\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>&gt;&gt;&gt; # primelist_file_prime.py<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; from sympy import *<br \/>\n&gt;&gt;&gt; import pickle<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; a = input(&#8216;sympy.prime()\u3092\u4f7f\u3063\u3066n\u500b\u306e\u7d20\u6570\u30ea\u30b9\u30c8\\nprimelist_n_ko.binaryfile \u3092\u751f\u6210\u3057\u307e\u3059\u3002**\u4f7f\u7528\u53ef n &gt;&gt; &#8216;) # a = 10**4<br \/>\n&gt;&gt;&gt; n = eval(a) # n = 10000<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; primelist = [1] # \u7d20\u6570\u306e\u30ca\u30f3\u30d0\u30ea\u30f3\u30b0\u30921\u30b9\u30bf\u30fc\u30c8\u306b\u5408\u308f\u305b\u308b\u305f\u3081\u5148\u982d0\u756a\u76ee\u30921\u306b\u3057\u3066\u304a\u304f<br \/>\n&gt;&gt;&gt; for i in range(1,n+1):<br \/>\n&gt;&gt;&gt; \u3000\u3000primelist.append(prime(i))<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; file = &#8216;primelist_&#8217;+a+&#8217;_ko.binaryfile&#8217; # \u751f\u6210\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u306e\u30d5\u30a1\u30a4\u30eb\u540d primelist_10**4_ko.binaryfile<br \/>\n&gt;&gt;&gt; file = file.replace(&#8216;**&#8217;, &#8216;to_power&#8217;) # \u30d5\u30a1\u30a4\u30eb\u540d\u306e**\u90e8\u5206\u304c\u3042\u308c\u3070\u30ea\u30cd\u30fc\u30e0 primelist_10to_power4_ko.binaryfile<br \/>\n&gt;&gt;&gt; f = open(file,&#8217;wb&#8217;) # \u30ea\u30b9\u30c8\u3092\u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u51fa\u3057<br \/>\n&gt;&gt;&gt; pickle.dump(primelist, f) # \u30c7\u30fc\u30bf\u4e0a\u66f8\u304d<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; # \u751f\u6210\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u307f\u8fbc\u307f<br \/>\n&gt;&gt;&gt; f = open(file,&#8217;rb&#8217;)<br \/>\n&gt;&gt;&gt; primelist = pickle.load(f)<br \/>\n&gt;&gt;&gt; # \u5185\u5bb9\u30c1\u30a7\u30c3\u30af<br \/>\n&gt;&gt;&gt; # print(primelist) # \u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\uff1an\u304c\u5927\u306a\u3089\u975e\u8868\u793a\u3001\u30b3\u30e1\u30f3\u30c8\u89e3\u9664\uff1an\u304c\u5c0f\u306a\u3089\u30ea\u30b9\u30c8\u5168\u51fa\u529b<br \/>\n&gt;&gt;&gt; print(&#8216;\\n\u30c7\u30fc\u30bf\u6570&#8217;,len(primelist),&#8217;\u500b&#8217;) # \u5168\u8981\u7d20\u6570\u51fa\u529b<br \/>\n&gt;&gt;&gt; print(&#8216;0\u756a\u76ee&#8217;, primelist[0]) # 0\u756a\u76ee\u306e\u30c7\u30fc\u30bf\u51fa\u529b<br \/>\n&gt;&gt;&gt; print(&#8216;1\u756a\u76ee&#8217;, primelist[1]) # 1\u756a\u76ee\u306e\u30c7\u30fc\u30bf\u51fa\u529b<br \/>\n&gt;&gt;&gt; print(&#8216;\u6700\u5f8c&#8217;, len(primelist)-1,&#8217;\u756a\u76ee&#8217;,primelist[len(primelist)-1]) # \u6700\u5f8c\u306e\u30c7\u30fc\u30bf\u51fa\u529b<br \/>\n&gt;&gt;&gt; print(file,&#8217;\\n\u304c\u751f\u6210\u3055\u308c\u307e\u3057\u305f\u3002&#8217;) # \u751f\u6210\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u540d\u51fa\u529b<\/p>\n<p><a href=\"https:\/\/drive.google.com\/file\/d\/14aJlm3PyLKLr9N-vsLJPPBKKIT6btajT\/view?usp=sharing\" target=\"_blank\" rel=\"noopener\">\u30d5\u30a1\u30a4\u30eb\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u306f\u30b3\u30c1\u30e9<\/a><\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E3%82%B3%E3%83%BC%E3%83%893%E3%80%80%E5%AE%9F%E8%A1%8C%E7%B5%90%E6%9E%9C\"><\/span>\u30b3\u30fc\u30c93\u3000\u5b9f\u884c\u7d50\u679c<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u79c1\u306e\u74b0\u5883\u3067\u306f\u300110\u5206\u307b\u3069\u306710000\u500b\u306e\u7d20\u6570\u30ea\u30b9\u30c8\u751f\u6210\u304c\u9650\u754c\u3067\u3057\u305f\u3002\u30b3\u30fc\u30c91\u306e2000\u500b\u3088\u308a\u3082\u5927\u304d\u3044\u306e\u3067\u9032\u6b69\u3057\u307e\u3057\u305f\u304c\u3001\u3061\u3087\u3063\u3068\u304c\u3063\u304b\u308a\u3067\u3059\u3002<\/p>\n<p>\u3055\u3089\u306b\u591a\u304f\u306e\u7d20\u6570\u30ea\u30b9\u30c8\u751f\u6210\u3092\u3081\u3056\u3057\u307e\u3059\u3002<\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E3%82%B3%E3%83%BC%E3%83%894%E3%80%80%E3%80%8Cprimelist_file_eratosthenespy%E3%80%8D\"><\/span>\u30b3\u30fc\u30c94\u3000\u300cprimelist_file_eratosthenes.py\u300d<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u6700\u5f8c\u306fsympy.prime()\u306b\u983c\u3089\u305a\u3001\u7d20\u6570\u3092\u4e00\u304b\u3089\u751f\u6210\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/club.informatix.co.jp\/?p=13457\" target=\"_blank\" rel=\"noopener\">\u9023\u8f09\u7b2c\uff17\u56de<\/a>\u3067\u3082\u7d39\u4ecb\u3057\u305f\u30a8\u30e9\u30c8\u30b9\u30c6\u30cd\u30b9\u306e\u7be9\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306b\u3088\u308b\u7d20\u6570\u751f\u6210\u3067\u3059\u3002\u5358\u7d14\u306b\u3057\u3066\u610f\u5916\u306b\u5f37\u529b\u306a\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3067\u3059\u3002<\/p>\n<p>&gt;&gt;&gt; # primelist_file_eratosthenes.py<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; from sympy import *<br \/>\n&gt;&gt;&gt; import pickle<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; a = input(&#8216;\u30a8\u30e9\u30c8\u30b9\u30c6\u30cd\u30b9\u306e\u7be9\u3092\u4f7f\u3063\u3066n\u500b\u306e\u7d20\u6570\u30ea\u30b9\u30c8\\nprimelist_n_ko.binaryfile \u3092\u751f\u6210\u3057\u307e\u3059\u3002**\u4f7f\u7528\u53ef n &gt;&gt; &#8216;) # a = 10**4<br \/>\n&gt;&gt;&gt; b = int(eval(a))<br \/>\n&gt;&gt;&gt; n = prime(b) # n\u756a\u76ee\u306e\u7d20\u6570 sympy.prime(n)<br \/>\n&gt;&gt;&gt; p = [i for i in range(n+1)]<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; for i in p[3:]:<br \/>\n&gt;&gt;&gt; \u3000\u3000if p[i] % 2 == 0:<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000p[i] = 0<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; # \u30a8\u30e9\u30c8\u30b9\u30c6\u30cd\u30b9\u306e\u7be9\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306b\u3088\u308b\u7d20\u6570\u751f\u6210<br \/>\n&gt;&gt;&gt; root_n = n**0.5<br \/>\n&gt;&gt;&gt; for i in range(3, n):<br \/>\n&gt;&gt;&gt; \u3000\u3000if i &gt; root_n:<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000break<br \/>\n&gt;&gt;&gt; \u3000\u3000if p[i] != 0:<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000for j in range(i, n + 1, 2):<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000\u3000\u3000if i * j &gt;= n + 1 :<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000break<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000\u3000\u3000p[i * j] = 0<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; primelist = sorted(list(set(p)))[2:]<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; # \u7d20\u6570\u306e\u30ca\u30f3\u30d0\u30ea\u30f3\u30b0\u30921\u30b9\u30bf\u30fc\u30c8\u306b\u5408\u308f\u305b\u308b<br \/>\n&gt;&gt;&gt; primelist.insert(0, 1) # \u7d20\u6570\u30ea\u30b9\u30c8\u306e\u5148\u982d\u306b\u8981\u7d201\u3092\u8ffd\u52a0<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; # \u30d5\u30a1\u30a4\u30eb\u51fa\u529b<br \/>\n&gt;&gt;&gt; file = &#8216;primelist_&#8217;+a+&#8217;_ko.binaryfile&#8217; # \u751f\u6210\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u306e\u30d5\u30a1\u30a4\u30eb\u540d primelist_10**4_ko.binaryfile<br \/>\n&gt;&gt;&gt; file = file.replace(&#8216;**&#8217;, &#8216;to_power&#8217;) # \u30d5\u30a1\u30a4\u30eb\u540d\u306e**\u90e8\u5206\u3092\u30ea\u30cd\u30fc\u30e0 primelist_10to_power4_ko.binaryfile<br \/>\n&gt;&gt;&gt; f = open(file,&#8217;wb&#8217;) # \u30ea\u30b9\u30c8\u3092\u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u51fa\u3057<br \/>\n&gt;&gt;&gt; pickle.dump(primelist, f) # \u30c7\u30fc\u30bf\u4e0a\u66f8\u304d<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; # \u751f\u6210\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u307f\u8fbc\u307f<br \/>\n&gt;&gt;&gt; f = open(file,&#8217;rb&#8217;)<br \/>\n&gt;&gt;&gt; primelist = pickle.load(f)<br \/>\n&gt;&gt;&gt; # \u5185\u5bb9\u30c1\u30a7\u30c3\u30af<br \/>\n&gt;&gt;&gt; # print(primelist) # \u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\uff1an\u304c\u5927\u306a\u3089\u975e\u8868\u793a\u3001\u30b3\u30e1\u30f3\u30c8\u89e3\u9664\uff1an\u304c\u5c0f\u306a\u3089\u30ea\u30b9\u30c8\u5168\u51fa\u529b<br \/>\n&gt;&gt;&gt; print(&#8216;\\n\u30c7\u30fc\u30bf\u6570&#8217;,len(primelist),&#8217;\u500b&#8217;) # \u5168\u8981\u7d20\u6570\u51fa\u529b<br \/>\n&gt;&gt;&gt; print(&#8216;0\u756a\u76ee&#8217;, primelist[0]) # 0\u756a\u76ee\u306e\u30c7\u30fc\u30bf\u51fa\u529b<br \/>\n&gt;&gt;&gt; print(&#8216;1\u756a\u76ee&#8217;, primelist[1]) # 1\u756a\u76ee\u306e\u30c7\u30fc\u30bf\u51fa\u529b<br \/>\n&gt;&gt;&gt; print(&#8216;\u6700\u5f8c&#8217;, len(primelist)-1,&#8217;\u756a\u76ee&#8217;,primelist[len(primelist)-1]) # \u6700\u5f8c\u306e\u30c7\u30fc\u30bf\u51fa\u529b<br \/>\n&gt;&gt;&gt; print(file,&#8217;\\n\u304c\u751f\u6210\u3055\u308c\u307e\u3057\u305f\u3002&#8217;) # \u751f\u6210\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u540d\u51fa\u529b<\/p>\n<p><a href=\"https:\/\/drive.google.com\/file\/d\/1Geze47X3CY0B1s14AZ-TDScPcaUrAfZZ\/view?usp=sharing\" target=\"_blank\" rel=\"noopener\">\u30d5\u30a1\u30a4\u30eb\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u306f\u30b3\u30c1\u30e9<\/a><\/p>\n<p>\u3053\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001\u3044\u3063\u305f\u30932,3,5,\u2026\u3068\u7d20\u6570\u30ea\u30b9\u30c8\u3092\u3064\u304f\u3063\u305f\u4e0a\u3067\u3001\u6700\u5f8c\u306b\u30ea\u30b9\u30c8\u306e\u5148\u982d\u306b1\u3092\u8ffd\u52a0\u3057\u3066\u3044\u307e\u3059\u3002\u51fa\u6765\u4e0a\u304c\u308b\u30d5\u30a1\u30a4\u30eb\u306f\u30b3\u30fc\u30c93\u306e\u3082\u306e\u3068\u540c\u3058\u3067\u3059\u3002<\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E3%82%B3%E3%83%BC%E3%83%894%E3%80%80%E5%AE%9F%E8%A1%8C%E7%B5%90%E6%9E%9C\"><\/span>\u30b3\u30fc\u30c94\u3000\u5b9f\u884c\u7d50\u679c<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u6570\u6642\u9593\u304b\u3051\u306610**8\u500b\uff081\u5104\u500b\uff09\u306e\u7d20\u6570\u30ea\u30b9\u30c8\u300cprimelist_10to_power8_ko.binaryfile\u300d\u304c\u51fa\u529b\u3055\u308c\u307e\u3057\u305f\u3002<br \/>\n\u51fa\u6765\u4e0a\u304c\u308b\u306e\u306f500MB\u306e\u30d0\u30a4\u30ca\u30ea\u30fc\u30d5\u30a1\u30a4\u30eb\u3067\u3059\u3002<\/p>\n<p>\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u3067\u306f\u306a\u3044\u306e\u3067\u30c0\u30d6\u30eb\u30af\u30ea\u30c3\u30af\u3057\u3066\u4e2d\u8eab\u3092\u76f4\u63a5\u898b\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E3%82%B3%E3%83%BC%E3%83%895%E3%80%80%E3%80%8Ceulerproduct_zeta2_listpy%E3%80%8D\"><\/span>\u30b3\u30fc\u30c95\u3000\u300ceulerproduct_zeta2_list.py\u300d<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u3044\u3088\u3044\u3088\u3001\u30b3\u30fc\u30c94\u3067\u3064\u304f\u3063\u305f1\u5104\u500b\u306e\u7d20\u6570\u30ea\u30b9\u30c8\u3092\u4f7f\u3063\u3066\u30aa\u30a4\u30e9\u30fc\u7a4d\u306e\u8a08\u7b97\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<p>\u30d0\u30a4\u30ca\u30ea\u30fc\u30d5\u30a1\u30a4\u30ebprimelist_n_ko.binaryfile \u3092\u8aad\u307f\u8fbc\u3080\u5834\u5408\u3082\u6a19\u6e96\u30e9\u30a4\u30d6\u30e9\u30eapickle\u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u307e\u3059\u3002<\/p>\n<p>&gt;&gt;&gt; # eulerproduct_zeta2_list.py<br \/>\n&gt;&gt;&gt; # \u03b6(2)=1.6449340668482264364724&#8230;\u306e\u30aa\u30a4\u30e9\u30fc\u7a4d\u306b\u3088\u308b\u6570\u5024\u8a08\u7b97<br \/>\n&gt;&gt;&gt; # \u751f\u6210\u3057\u305fn\u500b\u306e\u7d20\u6570\u30ea\u30b9\u30c8 primelist_n_ko.binaryfile \u3092\u6307\u5b9a\u3057\u3066\u4f7f\u7528<br \/>\n&gt;&gt;&gt; # n\u3092\u4e0a\u9650\u306b\u3001\u30aa\u30a4\u30e9\u30fc\u7a4d\u306e\u7d20\u6570\u306e\u500b\u6570\u3092\u6307\u5b9a\u3059\u308b<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; from sympy import * # \u6570\u5024\u8a08\u7b97 sympy.N()<br \/>\n&gt;&gt;&gt; import pickle # \u30d5\u30a1\u30a4\u30eb\u8aad\u307f\u8fbc\u307f pickle.load()<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; # \u4efb\u610f\u7cbe\u5ea6\u6f14\u7b97 \u6841\u6570\u8a2d\u5b9a<br \/>\n&gt;&gt;&gt; from mpmath import mp<br \/>\n&gt;&gt;&gt; mp.dps = 100 # \u5c0f\u6570\u70b9\u4ee5\u4e0b100\u6841<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; # \u30bc\u30fc\u30bf\u95a2\u6570\u03b6(x) = mpmath.zeta(x)<br \/>\n&gt;&gt;&gt; from mpmath import zeta<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; print(&#8216;\u03b6(2)=1.6449340668482264364724&#8230;\u306e\u30aa\u30a4\u30e9\u30fc\u7a4d\u306b\u3088\u308b\u6570\u5024\u8a08\u7b97 \u7d20\u6570\u30ea\u30b9\u30c8\u4f7f\u7528&#8217;)<br \/>\n&gt;&gt;&gt; a = input(&#8216;\u8aad\u307f\u8fbc\u3080\u7d20\u6570\u30ea\u30b9\u30c8\uff1aprimelist_n_ko.binaryfile \u306en\u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u4f8b 1000\u308410**4\u306a\u3069 n &gt;&gt; &#8216;) # 1\u5104\u500b\u306e\u7d20\u6570\u30ea\u30b9\u30c8\u4f7f\u7528\u306e\u5834\u5408\u306f10**8<br \/>\n&gt;&gt;&gt; file = &#8216;primelist_&#8217;+a+&#8217;_ko.binaryfile&#8217; # primelist_10**8_ko.binaryfile<br \/>\n&gt;&gt;&gt; file = file.replace(&#8216;**&#8217;, &#8216;to_power&#8217;) # file\u306e**\u3092to_power\u306b\u30ea\u30cd\u30fc\u30e0 primelist_10to_power8_ko.binaryfile<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; # \u4f5c\u6210\u3057\u305f\u7d20\u6570\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u307f\u8fbc\u307f\u30ea\u30b9\u30c8\u5316\u3059\u308b<br \/>\n&gt;&gt;&gt; f = open(file,&#8217;rb&#8217;) # primelist_10to_power8_ko.binaryfile \u3092\u8aad\u307f\u8fbc\u3080<br \/>\n&gt;&gt;&gt; prime = pickle.load(f)<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; # \u30ce\u30fc\u30de\u30eb\u6f14\u7b97 \u4efb\u610f\u7cbe\u5ea6\u6f14\u7b97 mp.mpf()\u306a\u3057<br \/>\n&gt;&gt;&gt; def eulerproduct0(N):<br \/>\n&gt;&gt;&gt; \u3000\u3000P = 1<br \/>\n&gt;&gt;&gt; \u3000\u3000for i in range(1, N):<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000p = 1\/(1-1\/(prime[i]**2)) # mpf \u4e0d\u4f7f\u7528<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000P = P * p<br \/>\n&gt;&gt;&gt; \u3000\u3000return P<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; # \u8a08\u7b97\u7cbe\u5ea6\u3092\u6bd4\u8f03\u3059\u308b\u5834\u5408\u306b\u306f\u4ee5\u4e0b6\u884c\u3092\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8<br \/>\n&gt;&gt;&gt; # print(&#8216;\\n\u30ce\u30fc\u30de\u30eb\u6f14\u7b97 \u4efb\u610f\u7cbe\u5ea6\u6f14\u7b97 mp.mpf()\u306a\u3057&#8217;)<br \/>\n&gt;&gt;&gt; # print(&#8216;\u03b6(2)=\\t&#8217;, N(zeta(2),30), &#8216;\uff08\u771f\u5024\uff09&#8217;)<br \/>\n&gt;&gt;&gt; # print(&#8217;10\u30b3\\t&#8217;, N(eulerproduct0(10), 30))<br \/>\n&gt;&gt;&gt; # print(&#8216;100\u30b3\\t&#8217;, N(eulerproduct0(100), 30))<br \/>\n&gt;&gt;&gt; # print(&#8216;1000\u30b3\\t&#8217;, N(eulerproduct0(1000), 30))<br \/>\n&gt;&gt;&gt; # print(&#8217;10^4\u30b3\\t&#8217;, N(eulerproduct0(10000), 30))<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; # \u4efb\u610f\u7cbe\u5ea6\u6f14\u7b97 mp.mpf()\u4f7f\u7528<br \/>\n&gt;&gt;&gt; def eulerproduct(N):<br \/>\n&gt;&gt;&gt; \u3000\u3000P = 1<br \/>\n&gt;&gt;&gt; \u3000\u3000for i in range(1, N):<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000p = 1\/(1-mp.mpf(&#8216;1&#8217;)\/(prime[i]**2)) # mpf\u306fReal float\u7528<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000P = P * p<br \/>\n&gt;&gt;&gt; \u3000\u3000return P<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; # \u8aad\u307f\u8fbc\u3080\u7d20\u6570\u30ea\u30b9\u30c8\u306e\u500b\u6570n\u3092\u4e0a\u9650\u306b\u3001\u8a08\u7b97\u3059\u308b\u7d20\u6570\u306e\u500b\u6570\u3092\u6307\u5b9a<br \/>\n&gt;&gt;&gt; # 1\u5104\u500b\u306e\u7d20\u6570\u30ea\u30b9\u30c8\u4f7f\u7528\u306e\u5834\u5408\u306b\u306f\u4ee5\u4e0b\u3059\u3079\u3066\u3092\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8<br \/>\n&gt;&gt;&gt; print(&#8216;\\n\u4efb\u610f\u7cbe\u5ea6\u6f14\u7b97 mp.mpf()\u4f7f\u7528&#8217;)<br \/>\n&gt;&gt;&gt; print(&#8216;\u03b6(2)=\\t&#8217;, N(zeta(2),30), &#8216;\uff08\u771f\u5024\uff09&#8217;)<br \/>\n&gt;&gt;&gt; print(&#8217;10\u30b3\\t&#8217;, N(eulerproduct(10), 30))<br \/>\n&gt;&gt;&gt; print(&#8216;100\u30b3\\t&#8217;, N(eulerproduct(100), 30))<br \/>\n&gt;&gt;&gt; # print(&#8216;1000\u30b3\\t&#8217;, N(eulerproduct(1000), 30))<br \/>\n&gt;&gt;&gt; # print(&#8217;10^4\u30b3\\t&#8217;, N(eulerproduct(10000), 30))<br \/>\n&gt;&gt;&gt; # print(&#8217;10^5\u30b3\\t&#8217;, N(eulerproduct(100000), 30))<br \/>\n&gt;&gt;&gt; # print(&#8217;10^6\u30b3\\t&#8217;, N(eulerproduct(1000000), 30))<br \/>\n&gt;&gt;&gt; # print(&#8217;10^7\u30b3\\t&#8217;, N(eulerproduct(10000000), 30))<br \/>\n&gt;&gt;&gt; # print(&#8217;10^8\u30b3\\t&#8217;, N(eulerproduct(100000000), 30))<\/p>\n<p><a href=\"https:\/\/drive.google.com\/file\/d\/11tFAg5Jepd8di_zEPZzARUABY4Dc91ZY\/view?usp=sharing\" target=\"_blank\" rel=\"noopener\">\u30d5\u30a1\u30a4\u30eb\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u306f\u30b3\u30c1\u30e9<\/a><\/p>\n<p>\u30b3\u30fc\u30c95\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u300c\u8aad\u307f\u8fbc\u3080\u7d20\u6570\u30ea\u30b9\u30c8\uff1aprimelist_n_ko.binaryfile \u306en\u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u300d\u3068\u304d\u304b\u308c\u307e\u3059\u3002<\/p>\n<p>1000\u308410**4\u306e\u3088\u3046\u306b\u30b3\u30fc\u30c93\u307e\u305f\u306f\u30b3\u30fc\u30c94\u3067\u3064\u304f\u3063\u305f\u7d20\u6570\u30ea\u30b9\u30c8\u306e\u500b\u6570\u3092\u5165\u529b\u3057\u307e\u3059\u30021\u5104\u500b\u306e\u7d20\u6570\u30ea\u30b9\u30c8\u3092\u4f7f\u3046\u5834\u5408\u306b\u306f10**8\u3068\u5165\u529b\u3057\u307e\u3059\u3002<\/p>\n<p>\u3042\u3068\u306f\u3001\u305d\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u8aad\u307f\u8fbc\u307e\u308c\u3001\u30aa\u30a4\u30e9\u30fc\u7a4d\u304c\u8a08\u7b97\u3055\u308c\u307e\u3059\u3002\u305d\u306e\u969b\u306b\u3001\u6700\u5f8c\u306e\u30b3\u30fc\u30c9\u90e8\u5206\u306e\u30b3\u30e1\u30f3\u30c8#\u3092\u8abf\u6574\u3057\u3066\u4f55\u500b\u306e\u7d20\u6570\u307e\u3067\u8a08\u7b97\u3059\u308b\u304b\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<p>&gt;&gt;&gt; print(&#8216;\\n\u4efb\u610f\u7cbe\u5ea6\u6f14\u7b97 mp.mpf()\u4f7f\u7528&#8217;)<br \/>\n&gt;&gt;&gt; print(&#8216;\u03b6(2)=\\t&#8217;, N(zeta(2),30), &#8216;\uff08\u771f\u5024\uff09&#8217;)<br \/>\n&gt;&gt;&gt; print(&#8217;10\u30b3\\t&#8217;, N(eulerproduct(10), 30))<br \/>\n&gt;&gt;&gt; print(&#8216;100\u30b3\\t&#8217;, N(eulerproduct(100), 30))<br \/>\n&gt;&gt;&gt; # print(&#8216;1000\u30b3\\t&#8217;, N(eulerproduct(1000), 30))<br \/>\n&gt;&gt;&gt; # print(&#8217;10^4\u30b3\\t&#8217;, N(eulerproduct(10000), 30))<br \/>\n&gt;&gt;&gt; # print(&#8217;10^5\u30b3\\t&#8217;, N(eulerproduct(100000), 30))<br \/>\n&gt;&gt;&gt; # print(&#8217;10^6\u30b3\\t&#8217;, N(eulerproduct(1000000), 30))<br \/>\n&gt;&gt;&gt; # print(&#8217;10^7\u30b3\\t&#8217;, N(eulerproduct(10000000), 30))<br \/>\n&gt;&gt;&gt; # print(&#8217;10^8\u30b3\\t&#8217;, N(eulerproduct(100000000), 30))<\/p>\n<h3><span class=\"ez-toc-section\" id=\"%E3%82%B3%E3%83%BC%E3%83%895%E3%80%80%E5%AE%9F%E8%A1%8C%E7%B5%90%E6%9E%9C\"><\/span>\u30b3\u30fc\u30c95\u3000\u5b9f\u884c\u7d50\u679c<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>1\u5104\u500b\u306e\u7d20\u6570\u30ea\u30b9\u30c8\u3092\u4f7f\u3063\u305f\u30aa\u30a4\u30e9\u30fc\u7a4d\u306e\u8a08\u7b97\u7d50\u679c\u3067\u3059\u3002<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-15135\" src=\"https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/10\/20211029-4.jpg\" alt=\"\" width=\"600\" height=\"324\" srcset=\"https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/10\/20211029-4.jpg 600w, https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/10\/20211029-4-300x162.jpg 300w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>1\u756a\u76ee\u306e\u7d20\u65702\u304b\u30891\u5104\u756a\u76ee\u306e\u7d20\u65702038074743\u307e\u3067\u3092\u7528\u3044\u305f\u03b6(2)\u306e\u30aa\u30a4\u30e9\u30fc\u7a4d\u306e\u8a08\u7b97\u7d50\u679c\u306f\u300111\u6841\u306e\u6b63\u3057\u3044\u5024\u3067\u3057\u305f\u3002<\/p>\n<p>\u305c\u3072\u81ea\u5206\u306ePC\u3092\u4f7f\u3063\u3066\u7d20\u6570\u30ea\u30b9\u30c8\u3092\u3064\u304f\u3063\u3066\u307f\u307e\u3057\u3087\u3046\u3002\u4e00\u5ea6\u4f5c\u3063\u3066\u304a\u304f\u3068\u7d20\u6570\u3092\u4f7f\u3063\u305f\u5b9f\u9a13\u306b\u3044\u308d\u3044\u308d\u3068\u4f7f\u3048\u3066\u4fbf\u5229\u3067\u3059\u3002<\/p>\n<p>\u30bc\u30fc\u30bf\u306e\u6570\u5024\u8a08\u7b97\u306e\u65c5\u306f\u3064\u3065\u304d\u307e\u3059\u3002\u6b21\u56de\u306f\u96fb\u5b50\u8a08\u7b97\u6a5f\u304c\u306a\u304b\u3063\u305f300\u5e74\u524d\u3001\u3044\u304b\u306b\u3057\u3066\u30aa\u30a4\u30e9\u30fc\u304c\u30bc\u30fc\u30bf\u3092\u8a08\u7b97\u3057\u305f\u306e\u304b\u3001\u305d\u306e\u79d8\u5bc6\u306bPython\u3068\u3068\u3082\u306b\u8feb\u308a\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u7de8\u3067\u306f\u30aa\u30a4\u30e9\u30fc\u306e\u30bc\u30fc\u30bf\u95a2\u6570\u306ePython\u30b3\u30fc\u30c9mpmath.zeta()\u3068\u30aa\u30a4\u30e9\u30fc\u7a4d\u306e\u7c21\u5358\u306a\u8aac\u660e\u3092\u884c\u3044\u307e\u3057\u305f\u3002 \u5f8c\u7de8\u3067\u306f\u30aa\u30a4\u30e9\u30fc\u306e\u7a4d\u8a08\u7b97\u7528\u30b3\u30fc\u30c9\uff085\u3064\uff09\u3068\u305d\u306e\u8a08\u7b97\u7d50\u679c\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002 \u30b3\u30fc\u30c91\u3000\u300ceu &#8230; <\/p>\n","protected":false},"author":4,"featured_media":15136,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,464,526],"tags":[65],"class_list":["post-15132","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-4","category-hito-star-mathmatics","category-526","tag-python"],"jetpack_featured_media_url":"https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/10\/20211029-5.jpg","_links":{"self":[{"href":"https:\/\/club.informatix.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/15132","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/club.informatix.co.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/club.informatix.co.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/club.informatix.co.jp\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/club.informatix.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=15132"}],"version-history":[{"count":16,"href":"https:\/\/club.informatix.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/15132\/revisions"}],"predecessor-version":[{"id":20738,"href":"https:\/\/club.informatix.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/15132\/revisions\/20738"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/club.informatix.co.jp\/index.php?rest_route=\/wp\/v2\/media\/15136"}],"wp:attachment":[{"href":"https:\/\/club.informatix.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=15132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/club.informatix.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=15132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/club.informatix.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=15132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}