fork download
  1. def issumofsqcube(n, count=0, b=2):
  2. while count <= 5 and (b in range(2, 1 + int(pow(n - 4, 1.0/3)))):
  3. if sqrt(n - pow(b, 3))%1 == 0:
  4. count = count + 1
  5. b = b + 1
  6. else:
  7. b = b + 1
  8. return count == 4
  9.  
  10. def nextpal(n):
  11. while True:
  12. n = n+1
  13. r = str(n)[::-1]
  14. if int(r) == n:
  15. return int(r)
  16.  
  17. def sumofpal(n, count=0, s=0, i=11):
  18. while count <= n:
  19. if issumofsqcube(i):
  20. s = s + i
  21. count += 1
  22. i = nextpal(i)
  23. else:
  24. i = nextpal(i)
  25. return s
  26.  
  27. print(sumofpal(1))
Runtime error #stdin #stdout #stderr 0.03s 42064KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Warning: cannot find your CPU L2 cache size in /proc/cpuinfo
Traceback (most recent call last):
  File "app_main.py", line 75, in run_toplevel
  File "prog.py", line 1
    def issumofsqcube(n, count=0, b=2):
                                      ^
IndentationError: unexpected indent