{"id":8,"date":"2012-04-08T23:22:00","date_gmt":"2012-04-08T15:22:00","guid":{"rendered":"http:\/\/fishinbox.tk\/?p=7"},"modified":"2012-04-08T23:22:00","modified_gmt":"2012-04-08T15:22:00","slug":"find-the-perfect-number","status":"publish","type":"post","link":"https:\/\/zhuangzr.me\/wordpress\/2012\/04\/find-the-perfect-number\/","title":{"rendered":"Find the Perfect Number"},"content":{"rendered":"<p>First of all, we have the conclusion from Euclid that define an integer n, and if 2^n &#8211; 1 is a prime, the number 2^(n-1)*(2^n &#8211; 1) must be a Perfect Number.<\/p>\n<p>Here follows my source code on finding 5 the smallest Perfect Number.It\u2019s written by C++.<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">using namespace std;\nbool IsPrime (long long s)\n{\n\tfor(long long i=2;i&lt;sqrt((long double)s);i++)\n\t{\n\t\tif(s%i==0) return false;\n\t}\n\treturn true;\n}\nlong long Power(int n)\n{\n\tif(n!=0) return 2*Power(n-1);\n\telse return 1;\n}\nint main()\n{\n\tint cnt=0;\n\tfor(int i=2;cnt&lt;9;i++)\n\t{\n\t\tif(IsPrime(Power(i)-1)) cout&lt;&lt;++cnt&lt;&lt;&quot;) &quot;&lt;&lt;power(i-1)*(Power(i)-1)&lt;&lt;endl;\n\t}\n\treturn 0;\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>First of all, we have the conclusion from Euclid that define an integer n, and if 2^n &#8211; 1 is a prime, the number 2^(n-1)*(2^n &#8211; 1) must be a Perfect Number. Here follows my source code on finding 5 the smallest Perfect Number.It\u2019s written by C++. using namespace std; bool IsPrime (long long s) &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/zhuangzr.me\/wordpress\/2012\/04\/find-the-perfect-number\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Find the Perfect Number&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[25,39,63],"class_list":["post-8","post","type-post","status-publish","format-standard","hentry","category-programming","tag-c","tag-math","tag-programming"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/zhuangzr.me\/wordpress\/wp-json\/wp\/v2\/posts\/8","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zhuangzr.me\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zhuangzr.me\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zhuangzr.me\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zhuangzr.me\/wordpress\/wp-json\/wp\/v2\/comments?post=8"}],"version-history":[{"count":0,"href":"https:\/\/zhuangzr.me\/wordpress\/wp-json\/wp\/v2\/posts\/8\/revisions"}],"wp:attachment":[{"href":"https:\/\/zhuangzr.me\/wordpress\/wp-json\/wp\/v2\/media?parent=8"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zhuangzr.me\/wordpress\/wp-json\/wp\/v2\/categories?post=8"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zhuangzr.me\/wordpress\/wp-json\/wp\/v2\/tags?post=8"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}