# Special Number problem

• ### Question

• The number 153 is a special number in that 153 = 1^3 + 5^3 + 3^3. There are three other numbers between 100 and 500 which are also special in the same way. Write a program which will enable you to find these numbers.
Saturday, October 31, 2020 8:09 PM

### All replies

• solution:

• Edited by Sunday, November 1, 2020 7:42 AM
• Proposed as answer by Sunday, November 1, 2020 9:42 AM
Sunday, November 1, 2020 7:41 AM
• Hi emma5533, nice challenge problem.  My answer is:

```For n = 100 To 500
x = Text.GetSubText(n, 1, 1)
y = Text.GetSubText(n, 2, 1)
z = Text.GetSubText(n, 3, 1)
m = x * x * x + y * y * y + z * z * z
If n = m Then
TextWindow.WriteLine(n + " = " + x + "^3 + " + y + "^3 + " + z + "^3")
EndIf
EndFor```

And the result is:

```153 = 1^3 + 5^3 + 3^3
370 = 3^3 + 7^3 + 0^3
371 = 3^3 + 7^3 + 1^3
407 = 4^3 + 0^3 + 7^3```

Nonki Takahashi

Sunday, November 1, 2020 9:38 AM
• Another program:

```For n = 100 To 500
x3 = Math.Power(Math.Floor(n / 100), 3)
y3 = Math.Power(Math.Floor(Math.Remainder(n, 100) / 10), 3)
z3 = Math.Power(Math.Remainder(n, 10), 3)
If n = x3 + y3 + z3 Then
TextWindow.WriteLine(n + " = " + x3 + " + " + y3 + " + " + z3)
EndIf
EndFor```

The result:

```153 = 1 + 125 + 27
370 = 27 + 343 + 0
371 = 27 + 343 + 1
407 = 64 + 0 + 343```

Nonki Takahashi

Sunday, November 1, 2020 12:06 PM