[中譯] ProjectEuler 433 Steps in Euclid's algorithm

看板puzzle (益智遊戲 - 數獨,拼圖,推理,西洋棋)作者 (f0VMRgEBA)時間12年前 (2013/06/25 00:19), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
433. Steps in Euclid's algorithm http://projecteuler.net/problem=433 令 E(x_0, y_0) 表示求 x_0 與 y_0 的最大公因數時使用歐幾里得算法的步驟數。 形式上來說: x_1 = y_0, y_1 = x_0 mod y_0 x_n = y_{n-1}, y_n = x_{n-1} mod y_{n-1} E(x_0, y_0) 即是滿足 y_n = 0 的最小的 n 。 例如 E(1,1) = 1, E(10,6) = 3 及 E(6,10) = 4。 定義 S(N) 為所有 E(x,y) 的和,其中 1 ≦ x,y ≦ N。 給定 S(1) = 1, S(10) = 221 及 S(100) = 39826。 求 S(5*10^6)。 -- 'You've sort of made up for it tonight,' said Harry. 'Getting the sword. Finishing the Horcrux. Saving my life.' 'That makes me sound a lot cooler then I was,' Ron mumbled. 'Stuff like that always sounds cooler then it really was,' said Harry. 'I've been trying to tell you that for years.' -- Harry Potter and the Deathly Hollows, P.308 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 122.118.113.29
文章代碼(AID): #1Ho76ZQt (puzzle)
文章代碼(AID): #1Ho76ZQt (puzzle)