{"id":13605,"date":"2021-04-30T00:30:47","date_gmt":"2021-04-30T00:30:47","guid":{"rendered":"https:\/\/club.informatix.co.jp\/?p=13605"},"modified":"2025-05-16T10:46:00","modified_gmt":"2025-05-16T01:46:00","slug":"python%e3%81%a7%e6%95%b0%e8%ab%96%ef%bc%81%e6%9c%aa%e8%a7%a3%e6%b1%ba%e5%95%8f%e9%a1%8c%e3%80%8c%e3%82%b3%e3%83%a9%e3%83%83%e3%83%84%e3%83%bb%e8%a7%92%e8%b0%b7%e4%ba%88%e6%83%b3%e3%80%8d%ef%bc%88","status":"publish","type":"post","link":"https:\/\/club.informatix.co.jp\/?p=13605","title":{"rendered":"Python\u3067\u6570\u8ad6\uff01\u672a\u89e3\u6c7a\u554f\u984c\u300c\u30b3\u30e9\u30c3\u30c4\u30fb\u89d2\u8c37\u4e88\u60f3\u300d\uff5cPython\u3067\u6570\u5b66\u3092\u5b66\u307c\u3046\uff01 \u7b2c8\u56de"},"content":{"rendered":"\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_83 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-6a13527087bbb\" 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-6a13527087bbb\" 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=13605\/#%E3%82%B3%E3%83%A9%E3%83%83%E3%83%84%E4%BA%88%E6%83%B3\" >\u30b3\u30e9\u30c3\u30c4\u4e88\u60f3<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/club.informatix.co.jp\/?p=13605\/#%E3%82%B3%E3%83%A9%E3%83%83%E3%83%84%E3%83%BB%E3%82%A2%E3%83%AB%E3%82%B4%E3%83%AA%E3%82%BA%E3%83%A0\" >\u30b3\u30e9\u30c3\u30c4\u30fb\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/club.informatix.co.jp\/?p=13605\/#%E3%82%B3%E3%83%A9%E3%83%83%E3%83%84%E3%83%BB%E3%82%B7%E3%83%BC%E3%82%AF%E3%82%A8%E3%83%B3%E3%82%B9\" >\u30b3\u30e9\u30c3\u30c4\u30fb\u30b7\u30fc\u30af\u30a8\u30f3\u30b9<\/a><\/li><\/ul><\/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=13605\/#%E5%B0%8F%E5%AD%A6%E7%94%9F%E3%81%A7%E3%82%82%E6%95%B0%E8%AB%96%E3%81%AE%E9%9B%A3%E5%95%8F%E3%81%AB%E6%8C%91%E6%88%A6%EF%BC%81\" >\u5c0f\u5b66\u751f\u3067\u3082\u6570\u8ad6\u306e\u96e3\u554f\u306b\u6311\u6226\uff01<\/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=13605\/#Python%E3%81%AE%E5%87%BA%E7%95%AA\" >Python\u306e\u51fa\u756a<\/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=13605\/#%E8%A8%88%E7%AE%97%E7%B5%90%E6%9E%9C\" >\u8a08\u7b97\u7d50\u679c<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"%E3%82%B3%E3%83%A9%E3%83%83%E3%83%84%E4%BA%88%E6%83%B3\"><\/span>\u30b3\u30e9\u30c3\u30c4\u4e88\u60f3<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>1937\u5e74\u3001\u30c9\u30a4\u30c4\u306e\u6570\u5b66\u8005\u30ed\u30fc\u30bf\u30fc\u30fb\u30b3\u30e9\u30c3\u30c4\uff0819101-1990\uff09\u306b\u3088\u3063\u3066\u6b21\u306e\u3088\u3046\u306a\u554f\u984c\u304c\u63d0\u8d77\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"%E3%82%B3%E3%83%A9%E3%83%83%E3%83%84%E3%83%BB%E3%82%A2%E3%83%AB%E3%82%B4%E3%83%AA%E3%82%BA%E3%83%A0\"><\/span>\u30b3\u30e9\u30c3\u30c4\u30fb\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"padding-left: 40px;\">\u6b63\u306e\u6574\u6570n\u306b\u5bfe\u3057\u3066\u3001<br \/>\n\u5076\u6570\u306a\u30892\u3067\u5272\u308b<br \/>\n\u5947\u6570\u306a\u30893\u500d\u3057\u30661\u3092\u8db3\u3059<\/p>\n<p>\u30b3\u30e9\u30c3\u30c4\u30fb\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306b\u3088\u308a\u3001\u6b21\u306e\u3088\u3046\u306b\u6b63\u306e\u6574\u6570\u306b\u5bfe\u3057\u3066\u6570\u5217\uff08\u30b7\u30fc\u30af\u30a8\u30f3\u30b9\uff09\u304c\u751f\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"%E3%82%B3%E3%83%A9%E3%83%83%E3%83%84%E3%83%BB%E3%82%B7%E3%83%BC%E3%82%AF%E3%82%A8%E3%83%B3%E3%82%B9\"><\/span>\u30b3\u30e9\u30c3\u30c4\u30fb\u30b7\u30fc\u30af\u30a8\u30f3\u30b9<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"padding-left: 40px;\">2 \u2192 1<br \/>\n3 \u2192 10 \u2192 5 \u2192 16 \u2192 8 \u2192 4 \u2192 2 \u2192 1<br \/>\n4 \u2192 2 \u2192 1<br \/>\n5 \u2192 16 \u2192 8 \u2192 4 \u2192 2 \u2192 1<br \/>\n6 \u2192 3 \u2192 10 \u2192 5 \u2192 16 \u2192 8 \u2192 4 \u2192 2 \u2192 1<\/p>\n<p>\u300c\u4efb\u610f\u306e\u6b63\u306e\u6574\u6570\u306b\u5bfe\u3057\u3066\u3001\u30b3\u30e9\u30c3\u30c4\u30fb\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306b\u3088\u308a\u751f\u6210\u3055\u308c\u308b\u30b3\u30e9\u30c3\u30c4\u30fb\u30b7\u30fc\u30af\u30a8\u30f3\u30b9\u306f\u5fc5\u305a1\u3067\u7d42\u308f\u308b\u300d\u3068\u3044\u3046\u306e\u304c\u30b3\u30e9\u30c3\u30c4\u4e88\u60f3\u3067\u3059\u3002<\/p>\n<p>3n+1\u554f\u984c\u3068\u3082\u547c\u3070\u308c\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-13612\" src=\"https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/04\/0428-1.jpg\" alt=\"\" width=\"800\" height=\"450\" srcset=\"https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/04\/0428-1.jpg 800w, https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/04\/0428-1-300x169.jpg 300w, https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/04\/0428-1-768x432.jpg 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-13613\" src=\"https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/04\/0428-2.jpg\" alt=\"\" width=\"800\" height=\"450\" srcset=\"https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/04\/0428-2.jpg 800w, https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/04\/0428-2-300x169.jpg 300w, https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/04\/0428-2-768x432.jpg 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E5%B0%8F%E5%AD%A6%E7%94%9F%E3%81%A7%E3%82%82%E6%95%B0%E8%AB%96%E3%81%AE%E9%9B%A3%E5%95%8F%E3%81%AB%E6%8C%91%E6%88%A6%EF%BC%81\"><\/span>\u5c0f\u5b66\u751f\u3067\u3082\u6570\u8ad6\u306e\u96e3\u554f\u306b\u6311\u6226\uff01<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>84\u5e74\u7d4c\u3063\u305f\u73fe\u5728\u3067\u3082\u3001\u3059\u3079\u3066\u306e\u6b63\u306e\u6574\u6570\u306b\u5bfe\u3057\u3066\u3053\u306e\u3053\u3068\u304c\u6210\u308a\u7acb\u3064\u3053\u3068\u306f\u8a3c\u660e\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002<\/p>\n<p>\u3053\u306e\u6570\u8ad6\u306e\u96e3\u554f\u3092\u5b9f\u611f\u3059\u308b\u306e\u306b\u4f7f\u3046\u306e\u306f\u56db\u5247\u6f14\u7b97\u3060\u3051\u3067\u3059\u3002\u5c0f\u5b66\u751f\u3067\u3082\u89e6\u308c\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u5148\u65e5\u3082\u79c1\u304c\u4e3b\u50ac\u3059\u308bZoom\u30aa\u30f3\u30e9\u30a4\u30f3\u30bb\u30df\u30ca\u30fc\u3001\u685c\u4e95\u9032\u306ePython\u30fbUNIX\u30fbMath\u6559\u5ba4\u3001\u685c\u4e95\u9032\u306e\u9b54\u6cd5\u306e\u7b97\u6570\u6559\u5ba4\u3001\u685c\u4e95\u9032\u306e\u6570\u5b66\u6d6a\u6f2b\u7d00\u884c\u306b\u3066\u300c\u30b3\u30e9\u30c3\u30c4\u30fb\u89d2\u8c37\u4e88\u60f3\u300d\u3092\u30c6\u30fc\u30de\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u307e\u305a\u53c2\u52a0\u8005\uff085\u6b73\u304b\u308960\u4ee3\u307e\u3067\u306e\u5712\u5150\u30fb\u5c0f\u30fb\u4e2d\u30fb\u9ad8\u30fb\u5927\u5b66\u751f\u30fb\u4e3b\u5a66\u30fb\u6559\u54e1\u30fb\u4f1a\u793e\u54e1\uff09\u306b\u53d6\u308a\u7d44\u3093\u3067\u3082\u3089\u3063\u305f\u306e\u304c\u3001\u30b3\u30e9\u30c3\u30c4\u30fb\u30b7\u30fc\u30af\u30a8\u30f3\u30b9\u3092\u624b\u66f8\u304d\u3057\u3066\u3082\u3089\u3046\u3053\u3068\u3067\u3059\u3002<\/p>\n<p>\u306f\u305f\u3057\u306640\u5206\u304b\u3051\u3066n=30\u307e\u3067\u306e\u6570\u8868\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-13614\" src=\"https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/04\/0428-3.jpg\" alt=\"\" width=\"800\" height=\"600\" srcset=\"https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/04\/0428-3.jpg 800w, https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/04\/0428-3-300x225.jpg 300w, https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/04\/0428-3-768x576.jpg 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>\u306a\u304b\u3067\u3082\u5927\u5909\u306a\u306e\u306f27\u3067\u3059\u3002<\/p>\n<div class=\"st-mybox st-mybox-class\" style=\"background:#ffffff;border-color:#ccc;border-width:1px;border-radius:2px;margin: 25px 0 25px 0;\"><div class=\"st-in-mybox\">\n<p>27\u2192 82\u2192 41\u2192 124\u2192 62\u2192 31\u2192 94\u2192 47\u2192 142\u2192 71\u2192 214\u2192 107\u2192 322\u2192 161\u2192 484\u2192 242\u2192 121\u2192 364\u2192 182\u2192 91\u2192 274\u2192 137\u2192 412\u2192 206\u2192 103\u2192 310\u2192 155\u2192 466\u2192 233\u2192 700\u2192 350\u2192 175\u2192 526\u2192 263\u2192 790\u2192 395\u2192 1186\u2192 593\u2192 1780\u2192 890\u2192 445\u2192 1336\u2192 668\u2192 334\u2192 167\u2192 502\u2192 251\u2192 754\u2192 377\u2192 1132\u2192 566\u2192 283\u2192 850\u2192 425\u2192 1276\u2192 638\u2192 319\u2192 958\u2192 479\u2192 1438\u2192 719\u2192 2158\u2192 1079\u2192 3238\u2192 1619\u2192 4858\u2192 2429\u2192 7288\u2192 3644\u2192 1822\u2192 911\u2192 2734\u2192 1367\u2192 4102\u2192 2051\u2192 6154\u2192 3077\u21929232\u2192 4616\u2192 2308\u2192 1154\u2192 577\u2192 1732\u2192 866\u2192 433\u2192 1300\u2192 650\u2192 325\u2192 976\u2192 488\u2192 244\u2192 122\u2192 61\u2192 184\u2192 92\u2192 46\u2192 23\u2192 70\u2192 35\u2192 106\u2192 53\u2192 160\u2192 80\u2192 40\u2192 20\u2192 10\u2192 5\u2192 16\u2192 8\u2192 4\u2192 2\u2192 1<\/p>\n<\/div><\/div>\n<p>111\u30b9\u30c6\u30c3\u30d7\u304b\u304b\u3063\u30661\u306b\u305f\u3069\u308a\u7740\u304d\u307e\u3059\u3002<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Python%E3%81%AE%E5%87%BA%E7%95%AA\"><\/span>Python\u306e\u51fa\u756a<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u305f\u3063\u305f30\u307e\u3067\u3067\u3059\u304c\u3001\u624b\u8a08\u7b97\u3059\u308b\u3053\u3068\u3067\u30b3\u30e9\u30c3\u30c4\u30fb\u30b7\u30fc\u30af\u30a8\u30f3\u30b9\u306e\u30ea\u30ba\u30e0\u3092\u5b9f\u611f\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u30b9\u30c6\u30c3\u30d7\u6570\u304c\u9ad8\u3005\u6570\u5341\u3067\u3042\u308b\u3053\u3068\u3002n\u304c30\u307e\u3067\u306e\u4e2d\u3067\u30b9\u30c6\u30c3\u30d7\u6570\u304c100\u3092\u8d85\u3048\u308b\u306e\u306f27\u306e\u5834\u5408\u3060\u3051\u3002<\/li>\n<li>\u6570\u5217\u306e\u5024\u306fn\u306e\u5024\u304b\u3089\u5927\u304d\u304f\u306a\u308a\u6700\u5927\u5024\u3092\u3068\u308a\u3001\u6e1b\u5c11\u3057\u30661\u306b\u5230\u308b\u5c71\u578b\u306e\u30ab\u30fc\u30d6\u3092\u63cf\u304f\u3053\u3068\u3002<\/li>\n<\/ul>\n<p>\u305d\u3057\u3066\u4f55\u3088\u308a\u3001\u30b3\u30e9\u30c3\u30c4\u30fb\u30b7\u30fc\u30af\u30a8\u30f3\u30b9\u304c\u672c\u5f53\u306b1\u3067\u7d42\u308f\u308b\u3053\u3068\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>30\u500b\u306en\u306b\u3064\u3044\u3066\u8abf\u3079\u308b\u3060\u3051\u306730\u5206\u4ee5\u4e0a\u304b\u304b\u308b\u3053\u3068\u3092\u77e5\u3063\u305f\u5f8c\u306f\u624b\u8a08\u7b97\u3059\u308b\u6c17\u529b\u304c\u306a\u304f\u306a\u308a\u307e\u3059\u3002\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u30fc\u3067\u8a08\u7b97\u3067\u304d\u305f\u3089\u3068\u601d\u3046\u306f\u305a\u3067\u3059\u3002<\/p>\n<p>\u30b3\u30e9\u30c3\u30c4\u30fb\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306f\u30b7\u30f3\u30d7\u30eb\u3067\u3059\u304b\u3089\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3082\u30b7\u30f3\u30d7\u30eb\u3067\u3059\u3002<\/p>\n<p>\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u306e\u9055\u3044\u306f\u3001\u30b3\u30e9\u30c3\u30c4\u30fb\u30b7\u30fc\u30af\u30a8\u30f3\u30b9\u306e\u8a08\u7b97\u7d50\u679c\u3092\u51fa\u529b\u3059\u308b\u65b9\u6cd5\u306e\u9055\u3044\u3067\u3059\u3002<\/p>\n<ol>\n<li>\u4e0e\u3048\u3089\u308c\u305fn\u306b\u5bfe\u3059\u308b\u30b3\u30e9\u30c3\u30c4\u30fb\u30b7\u30fc\u30af\u30a8\u30f3\u30b9\u751f\u6210<\/li>\n<li>a\u2266n\u2266b\u306b\u5bfe\u3059\u308b\u30b3\u30e9\u30c3\u30c4\u30fb\u30b7\u30fc\u30af\u30a8\u30f3\u30b9\u751f\u6210<\/li>\n<li>a\u2266n\u2266b\uff08\u6570\u5f0f\u5165\u529b\u53ef\uff09\u306b\u5bfe\u3059\u308b\u30b9\u30c6\u30c3\u30d7\u6570\u8868\u793a\uff0b\u6642\u9593\u8a08\u6e2c<\/li>\n<li>\u30b3\u30e9\u30c3\u30c4\u30fb\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3092\u5909\u3048\u305f\u5834\u5408<\/li>\n<\/ol>\n<p>\u3053\u308c\u30894\u3064\u3092\u307e\u3068\u3081\u305f\u306e\u304c\u6b21\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u300ccol.py\u300d\u3067\u3059\u3002<\/p>\n<p>&gt;&gt;&gt; # col.py<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; while(1):<br \/>\n&gt;&gt;&gt; \u3000Model = input(&#8216;1.\u4e0e\u3048\u3089\u308c\u305fn\u306b\u5bfe\u3059\u308b\u30b3\u30e9\u30c3\u30c4\u30fb\u30b7\u30fc\u30af\u30a8\u30f3\u30b9\u751f\u6210\\r\\n&#8217;<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000&#8217;2.a\u2266n\u2266b\u306b\u5bfe\u3059\u308b\u30b3\u30e9\u30c3\u30c4\u30fb\u30b7\u30fc\u30af\u30a8\u30f3\u30b9\u751f\u6210\\r\\n&#8217;<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000&#8217;3.a\u2266n\u2266b\uff08\u6570\u5f0f\u5165\u529b\u53ef\uff09\u306b\u5bfe\u3059\u308b\u30b9\u30c6\u30c3\u30d7\u6570\u8868\u793a\uff0b\u6642\u9593\u8a08\u6e2c\\r\\n&#8217;<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000&#8217;4.\u30b3\u30e9\u30c3\u30c4\u30fb\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3092\u5909\u3048\u305f\u5834\u5408\\r\\n&#8217;<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000&#8217;1\u30012\u30013\u30014\u306e\u3069\u308c\u304b\u3092\u5165\u529b&gt;&gt;&gt; &#8216;)<br \/>\n&gt;&gt;&gt; \u3000if Model.isdecimal():<br \/>\n&gt;&gt;&gt; \u3000\u3000Model = int(Model)<br \/>\n&gt;&gt;&gt; \u3000\u3000if 1 &lt;= Model &lt;= 4:<br \/>\n&gt;&gt;&gt; \u3000\u3000break<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; def col(n):<br \/>\n&gt;&gt;&gt; \u3000\u3000N = n<br \/>\n&gt;&gt;&gt; \u3000\u3000s = 0<br \/>\n&gt;&gt;&gt; \u3000\u3000print(&#8216;n=&#8217;+&#8217;\\t&#8217;+str(N))<br \/>\n&gt;&gt;&gt; \u3000\u3000while True:<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000if n == 1:<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000\u3000\u3000break<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000if n % 2 == 0:<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000\u3000\u3000n = n\/2<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000\u3000\u3000s = s + 1<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000else:<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000\u3000\u3000n = 3*n + 1<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000\u3000\u3000s = s + 1<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000print(str(s)+&#8217;\\t&#8217;+'{:.0f}&#8217;.format(n))<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; if Model == 1:<br \/>\n&gt;&gt;&gt; \u3000\u3000n = int(input(&#8216;n=&#8217;))<br \/>\n&gt;&gt;&gt; \u3000\u3000col(n)<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; elif Model == 2:<br \/>\n&gt;&gt;&gt; \u3000\u3000a = int(input(&#8216;n\u306e\u59cb\u307e\u308a\u306f &#8216;))<br \/>\n&gt;&gt;&gt; \u3000\u3000b = int(input(&#8216;n\u306e\u7d42\u308f\u308a\u306f &#8216;))<br \/>\n&gt;&gt;&gt; \u3000\u3000for i in range(a, b + 1): \u3000\u3000# n\u306e\u7bc4\u56f2<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000col(i)<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000print()<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; elif Model == 3:<br \/>\n&gt;&gt;&gt; \u3000\u3000a = eval(input(&#8216;n\u306e\u59cb\u307e\u308a\u306f \u6570\u5f0fOK &#8216;))<br \/>\n&gt;&gt;&gt; \u3000\u3000b = eval(input(&#8216;n\u306e\u7d42\u308f\u308a\u306f \u6570\u5f0fOK &#8216;))<br \/>\n&gt;&gt;&gt;\u3000\u3000 import time<br \/>\n&gt;&gt;&gt; \u3000\u3000def col(n):<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000N = n<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000s = 0<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000while True:<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000\u3000\u3000if 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\u3000if n % 2 == 0:<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000n = n\/2<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000m = 0<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000s = s + 1<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000\u3000\u3000else:<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000n = 3*n + 1<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000m = 1<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000s = s + 1<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000print(str(N)+&#8217;\\t&#8217;+str(s))<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; \u3000\u3000start = time.time() \u3000\u3000# \u6642\u9593\u8a08\u6e2c\u958b\u59cb<br \/>\n&gt;&gt;&gt; \u3000\u3000print(&#8216;n&#8217;+&#8217;\\t&#8217;+&#8217;Step&#8217;)<br \/>\n&gt;&gt;&gt; \u3000\u3000for i in range(a, b + 1): \u3000\u3000# n\u306e\u7bc4\u56f2<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000col(i)<br \/>\n&gt;&gt;&gt; \u3000\u3000t = time.time() &#8211; start \u3000\u3000# \u6642\u9593\u8a08\u6e2c\u7d42\u4e86<br \/>\n&gt;&gt;&gt; \u3000\u3000print(&#8216;\u8a08\u7b97\u6642\u9593&#8217;+str(t)+&#8217;\u79d2&#8217;)<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt;<br \/>\n&gt;&gt;&gt; elif Model == 4:<br \/>\n&gt;&gt;&gt; \u3000\u3000siki = input(&#8216;\u30b3\u30e9\u30c3\u30c4\u30fb\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0 3*n+1 \u2192 &#8216;)<br \/>\n&gt;&gt;&gt; \u3000\u3000S = int(input(&#8216;Step\u6570\u306e\u4e0a\u9650\u306f &#8216;))<br \/>\n&gt;&gt;&gt; \u3000\u3000a = int(input(&#8216;n\u306e\u59cb\u307e\u308a\u306f &#8216;))<br \/>\n&gt;&gt;&gt; \u3000\u3000b = int(input(&#8216;n\u306e\u7d42\u308f\u308a\u306f &#8216;))<br \/>\n&gt;&gt;&gt; \u3000\u3000for i in range(a, b + 1): \u3000\u3000# n\u306e\u7bc4\u56f2<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000col(i)<br \/>\n&gt;&gt;&gt; \u3000\u3000\u3000\u3000print()<\/p>\n<p>\u3053\u306e\u30b3\u30fc\u30c9\u306e\u6838\u306f\u95a2\u6570col(n)\u3067\u3059\u3002\u5909\u6570n\u304c\u30b3\u30e9\u30c3\u30c4\u30fb\u30b7\u30fc\u30af\u30a8\u30f3\u30b9\u306e\u9805\u3001\u5909\u6570s\u304c\u30b9\u30c6\u30c3\u30d7\u6570\u3067\u3059\u3002<\/p>\n<p>\u300cif n % 2 == 0:\u300d\u304c\u300cn\u30922\u3067\u5272\u3063\u305f\u4f59\u308a\u304c0\u306a\u3089\u3070\u300d\u3092\u8868\u3057\u3001\u7d9a\u304f\u300celse:\u300d\u304c\u300cn\u30922\u3067\u5272\u3063\u305f\u4f59\u308a\u304c0\u3067\u306a\u3044\u306a\u3089\u3070\u300d\u3059\u306a\u308f\u3061n\u304c\u5947\u6570\u3067\u3042\u308b\u5834\u5408\u3092\u8868\u3057\u307e\u3059\u3002<\/p>\n<p>\u30b3\u30e9\u30c3\u30c4\u30fb\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306f\u7c21\u5358\u306a\u306e\u3067\u30a8\u30af\u30bb\u30eb\u306e\u95a2\u6570\u3092\u7528\u3044\u3066\u30b3\u30e9\u30c3\u30c4\u30fb\u30b7\u30fc\u30af\u30a8\u30f3\u30b9\u3092\u8868\u793a\u3055\u305b\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002\u305f\u3060\u3001\u30a8\u30af\u30bb\u30eb\u306e\u5834\u5408\u3001\u6841\u6570\u304c\u5927\u304d\u3044\u5834\u5408\u306b\u306f\u8a08\u7b97\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<p>\u305d\u306e\u70b9Python\u306a\u3089\u5fc3\u914d\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E8%A8%88%E7%AE%97%E7%B5%90%E6%9E%9C\"><\/span>\u8a08\u7b97\u7d50\u679c<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ol>\n<li>\u4e0e\u3048\u3089\u308c\u305fn\u306b\u5bfe\u3059\u308b\u30b3\u30e9\u30c3\u30c4\u30fb\u30b7\u30fc\u30af\u30a8\u30f3\u30b9\u751f\u6210<\/li>\n<li>a\u2266n\u2266b\u306b\u5bfe\u3059\u308b\u30b3\u30e9\u30c3\u30c4\u30fb\u30b7\u30fc\u30af\u30a8\u30f3\u30b9\u751f\u6210<\/li>\n<li>a\u2266n\u2266b\uff08\u6570\u5f0f\u5165\u529b\u53ef\uff09\u306b\u5bfe\u3059\u308b\u30b9\u30c6\u30c3\u30d7\u6570\u8868\u793a\uff0b\u6642\u9593\u8a08\u6e2c<br \/>\n\u306e\u30a2\u30a6\u30c8\u30d7\u30c3\u30c8\u306f\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/li>\n<\/ol>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-13609\" src=\"https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/04\/0428-4.jpg\" alt=\"\" width=\"534\" height=\"568\" srcset=\"https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/04\/0428-4.jpg 534w, https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/04\/0428-4-282x300.jpg 282w\" sizes=\"(max-width: 534px) 100vw, 534px\" \/> <img decoding=\"async\" class=\"aligncenter size-full wp-image-13610\" src=\"https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/04\/0428-5.jpg\" alt=\"\" width=\"534\" height=\"827\" srcset=\"https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/04\/0428-5.jpg 534w, https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/04\/0428-5-194x300.jpg 194w\" sizes=\"(max-width: 534px) 100vw, 534px\" \/> <img decoding=\"async\" class=\"aligncenter size-full wp-image-13611\" src=\"https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/04\/0428-6.jpg\" alt=\"\" width=\"534\" height=\"439\" srcset=\"https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/04\/0428-6.jpg 534w, https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/04\/0428-6-300x247.jpg 300w\" sizes=\"(max-width: 534px) 100vw, 534px\" \/><\/p>\n<p>\u3053\u306e\u3088\u3046\u306b\u5927\u304d\u306an\u306b\u5bfe\u3057\u3066\u3082\u7c21\u5358\u306bPython\u3092\u4f7f\u3063\u3066\u30b3\u30e9\u30c3\u30c4\u4e88\u60f3\u304c\u6b63\u3057\u3044\u3053\u3068\u3092\u5b9f\u969b\u306b\u78ba\u304b\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/club.informatix.co.jp\/?p=13940\" target=\"_blank\" rel=\"noopener\">\u6b21\u56de<\/a>\u306f\u3055\u3089\u306b\u30b3\u30e9\u30c3\u30c4\u30fb\u30b7\u30fc\u30af\u30a8\u30f3\u30b9\u3092\u5206\u6790\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30b3\u30e9\u30c3\u30c4\u4e88\u60f3 1937\u5e74\u3001\u30c9\u30a4\u30c4\u306e\u6570\u5b66\u8005\u30ed\u30fc\u30bf\u30fc\u30fb\u30b3\u30e9\u30c3\u30c4\uff0819101-1990\uff09\u306b\u3088\u3063\u3066\u6b21\u306e\u3088\u3046\u306a\u554f\u984c\u304c\u63d0\u8d77\u3055\u308c\u307e\u3057\u305f\u3002 \u30b3\u30e9\u30c3\u30c4\u30fb\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0 \u6b63\u306e\u6574\u6570n\u306b\u5bfe\u3057\u3066\u3001 \u5076\u6570\u306a\u30892\u3067\u5272\u308b \u5947\u6570\u306a\u30893\u500d &#8230; <\/p>\n","protected":false},"author":4,"featured_media":13612,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,464,526],"tags":[65,787],"class_list":["post-13605","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-4","category-hito-star-mathmatics","category-526","tag-python","tag-787"],"jetpack_featured_media_url":"https:\/\/club.informatix.co.jp\/wp-content\/uploads\/2021\/04\/0428-1.jpg","_links":{"self":[{"href":"https:\/\/club.informatix.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/13605","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=13605"}],"version-history":[{"count":20,"href":"https:\/\/club.informatix.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/13605\/revisions"}],"predecessor-version":[{"id":20732,"href":"https:\/\/club.informatix.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/13605\/revisions\/20732"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/club.informatix.co.jp\/index.php?rest_route=\/wp\/v2\/media\/13612"}],"wp:attachment":[{"href":"https:\/\/club.informatix.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=13605"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/club.informatix.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=13605"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/club.informatix.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=13605"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}