[Tutor] why?

Robert William Hanks astroultraman at gmail.com
Thu May 29 02:43:01 CEST 2008


 Need ti find out whem a number o this form i**3+j**3+1 is acube.
 tryed a simple brute force code but, why this not work?

def iscube(n):
    cubed_root = n**(1/3.0)
    if round(cubed_root)**3 == n:
        return True
    else:
        return False

for i in range(1,10000000):
    for j in range(1,10000000):
         soma= i**3 +j**3 +1
         if isCube(soma):
             print i
             print j
             print soma
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080529/b4c60fa2/attachment.htm>


More information about the Tutor mailing list