Sum of perfect squares and cubes $< 10^6$

Your argument shows that there are at most $100,000$ numbers up to $1,000,000$ that can be represented as the sum of a square and a positive cube. This is enough to answer your question.


your answer works as is and in fact the approximation is really good. I tried to get a tighter result by bounding it by the following sum:

$\sum\limits_{i=1}^{100} \sqrt{10^6-i^3}$. This expression can be bounded by the integral of the curve

$\int\limits_{x=0}^{100}\sqrt{10^6-x^3}dx$, however, since the function $x^3$ is convex and $\sqrt{x}$ is concave the improvement is really small:

enter image description here

we only obtain the slightly better bound of $84130$.

On the other hand, the actual result is $76356$ as can be found with the following code:

#include <bits/stdc++.h>
using namespace std;

const int MAX=1000000;
int A[MAX];

int main(){
    int res=0;
    for(int x=0;x*x<MAX;x++){
        for(int y=1;x*x+y*y*y<MAX;y++){
            A[x*x+y*y*y]=1;
        }
    }
    for(int i=1;i<MAX;i++){
        res+=A[i];
    }
    printf("%d\n",res);
}