4
$\begingroup$

I know that $\sqrt[3]{2744} = 2 + 7 + 4 + 4 - 3$, $\sqrt[3]{3375} = 3 + 3 + 7 + 5 - 3$, and $\sqrt[3]{4096} = 4 + 0 + 9 + 6 - 3$ by

 Solve[{a + b + c + d + e - 3 == CubeRoot[10000 a + 1000 b + 100 c + 10 d + e], 1 <= a <= 9, 0 <= b <= 9, 0 <= c <= 9, 0 <= d <= 9, 0 <= e <= 9}, {a, b, c, d, e}, Integers]

I am trying to solve

Solve[{a + b + c + d + e - 3 == 
   CubeRoot[10000 a + 1000 b + 100 c + 10 d + e], 1 <= a <= 9, 
  0 <= b <= 9, 0 <= c <= 9, 0 <= d <= 9, 0 <= e <= 9}, {a, b, c, d, 
  e}, Integers]

But the time run too long and I can not get the result. How can I reduce the time to solve this equation?

$\endgroup$

3 Answers 3

6
$\begingroup$

Try

x=10^4;
While[(Total[IntegerDigits[x]]-3)^3!=x&&x<10^5,x++];
If[x==10^5,"No solution",x]

which finishes in a second and displays No solution

But there is a solution for (Total[IntegerDigits[x]]+3)^3

$\endgroup$
1
  • $\begingroup$ If you start with x=1 your code finds the solution 125, But your code has to be restarted with last x-value to find all solution. $\endgroup$ Sep 2, 2022 at 8:00
7
$\begingroup$

The fastest way: Use Table!

Flatten[Table[
   If[(a + b + c + d + e - 3)^3 == 
     10000 a + 1000 b + 100 c + 10 d + e, {a, b, c, d, e}, 
    Nothing], {a, 0, 9}, {b, 0, 9}, {c, 0, 9}, {d, 0, 9}, {e, 0, 
    9}] , 5 - 1  ] // AbsoluteTiming
(*{0.34782, {{0, 0, 1, 2, 5}, {0, 0, 2, 1, 6}, {0, 0, 3, 4, 3}, {0,2, 7, 4, 4}, {0, 3, 3, 7, 5}, {0, 4, 0, 9, 6}}}*)

Adapting @Bill's interesting answer we get the short problemdescription

Table[If[(Total[IntegerDigits[x]] - 3)^3 == x, x,Nothing], {x, 10^5}]
(*{125, 216, 343, 2744, 3375, 4096}*)
$\endgroup$
6
$\begingroup$
Reduce[{(a + b + c + d + e - 3)^3 == 
   a*10^4 + b*10^3 + c*10^2 + d*10 + e, 
  0 <= {a, b, c, d, e} <= 9}, {a, b, c, d, e}, Integers]
(a == 0 && b == 0 && c == 1 && d == 2 && e == 5) || (a == 0 && 
   b == 0 && c == 2 && d == 1 && e == 6) || (a == 0 && b == 0 && 
   c == 3 && d == 4 && e == 3) || (a == 0 && b == 2 && c == 7 && 
   d == 4 && e == 4) || (a == 0 && b == 3 && c == 3 && d == 7 && 
   e == 5) || (a == 0 && b == 4 && c == 0 && d == 9 && e == 6)

It means that there no solution for a!=0. The same as

Solve[{(a + b + c + d + e - 3)^3 == 
   a*10^4 + b*10^3 + c*10^2 + d*10 + e, 
  0 <= {a, b, c, d, e} <= 9}, {a, b, c, d, e}, Integers]

and

Reduce[{(a + b + c + d + e - 3)^3 == 
   a*10^4 + b*10^3 + c*10^2 + d*10 + e, 0 <= {a, b, c, d, e} <= 9, 
  a != 0}, {a, b, c, d, e}, Integers]

False

and there three solutions for the first case.

Solve[{(a + b + c + d - 3)^3 == a*10^3 + b*10^2 + c*10 + d, 
  0 <= {a, b, c, d} <= 9, a != 0}, {a, b, c, d}, Integers]

{{a -> 2, b -> 7, c -> 4, d -> 4}, {a -> 3, b -> 3, c -> 7, d -> 5}, {a -> 4, b -> 0, c -> 9, d -> 6}}

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.