hardy-ramanujan

    4熱度

    2回答

    我試圖找出第n個Hardy-Ramanujan號碼(一個可以以多個方式表示爲2個立方和的數字)的算法。除了我基本上檢查每個立方體與另一個立方體,看看它是否等於另一個2立方體的總和。任何提示如何使這更高效?我很難過。 public static long nthHardyNumber(int n) { PriorityQueue<Long> sums = new PriorityQueu

    14熱度

    7回答

    查找首個n出租車計程車號碼。給定值n。我想找到前n個計程車號碼。 出租車是一個數字,可以用多種方式表示爲兩個完美立方體的總和。 (請注意,有兩個相關但不同的被稱爲 「的士數」集:在sums of 2 cubes in more than 1 way,並the smallest numbers that are the sum of 2 positive integral cubes in n wa