I've recently came across an interesting paper : ON FINITE SUMS OF RECIPROCALS OF DISTINCT n-th POWERS by R. L. GRAHAM. At the end of the paper he gives some exemples: $$ \frac{1}2 = \frac1{2^2}+\frac1{3^2}+\frac1{4^2}+\frac1{5^2}+\frac1{6^2}+\frac1{15^2}+\frac1{18^2}+\frac1{36^2}+\frac1{60^2}+\frac1{180^2}$$ I've tried my best to make a program to find that result but i can't find a solution. I found this [solution](https://math.stackexchange.com/questions/1921652/can-every-number-be-represented-as-a-sum-of-different-reciprocal-numbers) to an easier problem : the representation of a fraction as the sum of distinct reciprocals. I tried to expend this algorithm to solve my problem but when i execute my program the numbers given get too large: ```python def pgcd(a,b): return a if b==0 else pgcd(b,a%b) def subFrac(p1,q1,p2,q2): u,v=p1*q2-p2*q1,q1*q2 d=pgcd(u,v) return (u//d,v//d) def dec(p,q): print(p,q) frac=[] k=2 while p/q>1/(k**2): p,q=subFrac(p,q,1,k**2) frac.append(k) print(k,p,q) k+=1 while p>0: while 1/(k**2)>p/q: k+=1 p,q=subFrac(p,q,1,k**2) print(k,p,q) frac.append(k) k+=1 return frac ``` Gives : $$ \frac{1}2 = \frac1{2^2}+\frac1{3^2}+\frac1{4^2}+\frac1{5^2}+\frac1{6^2}+\frac1{11^2}+\frac1{54^2}+\frac1{519^2}+\frac1{59429^2}+...$$ In general, I'd like to make a program that gives a representation with reasonable number like the one given or this one from Wikipedia: $$ \frac{1}2 = \frac1{2^2}+\frac1{3^2}+\frac1{4^2}+\frac1{5^2}+\frac1{7^2}+\frac1{12^2}+\frac1{15^2}+\frac1{20^2}+\frac1{28^2}+\frac1{35^2}$$ Thanks in advance!