/* sample example: * having inane equation n(n+sqrt(n))=L where: * n increments as m=1; n=(++m)**2 .. so only integers are used * the highest value of sqrt(n) is FFFF (255) so n could be up to 255**2 * * you're getting L and need to determine n * in example below we increments n and break() until we reach equality with L * * is it bloody correct ?? */ #include #include unsigned main(void) /* also debug, it won't be main but something like `unsigned foo(double L)` */ { unsigned m, n, l; m = n = 1; l = pow(255, 2); unsigned long long L = 2439853704; for(n = 1; n <= l; n = pow(++m, 2)) { if(n * (n + sqrt(n)) == L) break; }; printf("%u\n", n); /* just only for debug to can chec number */ return(n); }