{"author_url":"https://blog.hatena.ne.jp/inamori/","url":"https://inamori.hateblo.jp/entry/20090514/p1","blog_title":"inamori\u2019s diary","title":"Project Euler 120","description":"\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30aa\u30a4\u30e9\u30fc http://projecteuler.net/index.php Q120. (a-1)n + (a+1)n\u306ea2\u306e\u5270\u4f59\u306en\u3092\u632f\u3063\u305f\u3068\u304d\u306e\u6700\u5927\u5024\u3092rmax\u3068\u3059\u308b\u3068\u30013 \u2264 a \u2264 1000\u3067\u306e\u2211rmax n\u304c\u5076\u6570\u30fb\u5947\u6570\u3067\u5206\u3051\u308b\u3068\u3001 (a-1)n + (a+1)n \u2261 2 (mod a2) (n : even) (a-1)n + (a+1)n \u2261 2na (mod a2) (n : odd) n\u306f\u5947\u6570\u306e\u307f\u8003\u3048\u308c\u3070\u3088\u3044\u3002 a\u304c\u5947\u6570\u306e\u3068\u304d\u3001rmax = (a-1)a\u3001\u5076\u6570\u306e\u3068\u304d\u3001rmax = (a-2)a\u3068\u306a\u308b\u3002\u3055\u3089\u306b\u8a08\u7b97\u3092\u9032\u3081\u308b\u3068\u3001\u96fb\u5353\u30ec\u30d9\u30eb\u306b\u306a\u308b\u3002","type":"rich","width":"100%","provider_url":"https://hatena.blog","image_url":null,"categories":["\u6570\u5b66","Python"],"version":"1.0","published":"2009-05-14 00:00:00","provider_name":"Hatena Blog","blog_url":"https://inamori.hateblo.jp/","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Finamori.hateblo.jp%2Fentry%2F20090514%2Fp1\" title=\"Project Euler 120 - inamori\u2019s diary\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","author_name":"inamori","height":"190"}