{"provider_url":"https://hatena.blog","description":"4n+1\u578b\u306e\u7d20\u6570\u3092\u5e73\u65b9\u6570\u306e\u548c\u306b\u5206\u89e3\u3059\u308b\u3002 e.g. 5 = 1+4=1^2+4^2 1249 = 15^2+32^2 17669 = 70^2+113^2 225221 = 410^2+239^2 import Number import Data.List pRoot p = g.foldl1' f $ [1..div (p-1) 2] where f a b = mod (a*b) p g x = min x $ p-x sqSum p = let r = pRoot p in fst.until((==1).snd) next$ ((1,r),div (r*r+1) p) next ((\u2026","version":"1.0","blog_url":"https://jeneshicc.hatenadiary.org/","title":"4n+1\u7d20\u6570\u306e\u5e73\u65b9\u548c\u5206\u89e3","image_url":null,"height":"190","author_name":"jeneshicc","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fjeneshicc.hatenadiary.org%2Fentry%2F20081221%2F1229835537\" title=\"4n+1\u7d20\u6570\u306e\u5e73\u65b9\u548c\u5206\u89e3 - \u843d\u66f8\u304d\u3001\u6642\u3005\u843d\u5b66\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","width":"100%","categories":["Haskell"],"url":"https://jeneshicc.hatenadiary.org/entry/20081221/1229835537","author_url":"https://blog.hatena.ne.jp/jeneshicc/","published":"2008-12-21 13:58:57","provider_name":"Hatena Blog","type":"rich","blog_title":"\u843d\u66f8\u304d\u3001\u6642\u3005\u843d\u5b66"}