{"categories":["CS","Project Euler"],"height":"190","blog_title":"186 @ hatenablog","blog_url":"https://186.hatenablog.com/","image_url":null,"html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2F186.hatenablog.com%2Fentry%2F20080404%2F1207321059\" title=\" &lt;a href=&quot;http://projecteuler.net/index.php?section=problems&amp;id=188&quot;&gt;Problem 188&lt;/a&gt; - 186 @ hatenablog\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","title":" <a href=\"http://projecteuler.net/index.php?section=problems&id=188\">Problem 188</a>","published":"2008-04-04 23:57:39","provider_name":"Hatena Blog","author_url":"https://blog.hatena.ne.jp/smoking186/","provider_url":"https://hatena.blog","type":"rich","author_name":"smoking186","width":"100%","description":"\u30bf\u30ef\u30fc\u8868\u8a18\u304b\u3088. \u5b9f\u306f\u3042\u3063\u3055\u308a\u89e3\u3051\u308b\u554f\u984c. (define (find a b n) (define (order a n) (let loop ((i 1) (c a)) (if (= c 1) i (loop (+ i 1) (remainder (* c a) n))))) (if (= b 1) (remainder a n) (let1 o (order a n) (expt-mod a (find a (- b 1) o) n)))) ;(time (find 1777 1855 (expt 10 8))) ; real 1.938 ; user 1.719 ; sys 0.219","version":"1.0","url":"https://186.hatenablog.com/entry/20080404/1207321059"}