- 3

Write a python program to find Hardy Ramanujan number

26th Jan 2017, 10:38 AM
jitendra vishwakarma
2 odpowiedzi
+ 1
def sai(a): c=0 for i in range(1,2000): for j in range(1,2000): if (j*j*j)+(i*i*i)==a: c=c+1 if c==2: return "yes" break else: return "no" a=int(input()) b=sai(a) print(b)
26th Jun 2019, 6:50 AM
Sai Rachapudi
Sai Rachapudi - avatar
0
The obvious and dirty way (only positive values): def dirty_hdn(): for x in range(1, 2000): for y in range(1, 2000): for z in range(1, 2000): for g in range(1, 2000): if g * g * g + z * z * z == x * x * x + y * y * y: if (g == z)|(g == y)|(g == x)|(z == y)|(z == x)|(y == x): continue else: print ("x=", x) print ("y=", y) print ("z=", z) print ("g=", g) print (g * g * g + z *z* z) return "Taxidriver"
28th Feb 2017, 1:44 AM
siebenWinkel
siebenWinkel - avatar