math riddle
February 23, 2009 4:24 PM Subscribe
I am looking for a six digit number that would satisfy theses conditions: each digit is between 2 and 9
and the sum of each number exponement 6 yeild the very same number. Anyone ?
Hey, I would have had it faster if there hadn't been a typo in my python script.
If you're interested:
posted by demiurge at 4:40 PM on February 23, 2009 [2 favorites]
If you're interested:
for x in range(2,999999): sum = 0 for d in [int(y) for y in str(x)]: sum = sum + d**6 if sum == x: print sum
posted by demiurge at 4:40 PM on February 23, 2009 [2 favorites]
Response by poster: nah it was for a geocaching freak
thank you guys
posted by selfsck at 4:52 PM on February 23, 2009
thank you guys
posted by selfsck at 4:52 PM on February 23, 2009
is there a way to solve a problem like this analytically instead of numerically?
posted by randomstriker at 5:46 PM on February 23, 2009
posted by randomstriker at 5:46 PM on February 23, 2009
You represent each digit with a separate variable. The value of a six-digit number, if the digits are a b c d e f respectively, is 100000a+10000b+1000c+100d+10e+f. Each digit has to be between zero and nine. So you'd be looking for a solution to the following system of equations:
posted by nebulawindphone at 6:43 PM on February 23, 2009 [1 favorite]
100000a+10000b+1000c+100d+10e+f=(a^6)+(b^6)+(c^6)+(d^6)+(e^6)+(f^6)Have fun!
0 <= a <= 9
0 <= b <= 9
0 <= c <= 9
0 <= d <= 9
0 <= e <= 9
0 <= f <= 9
posted by nebulawindphone at 6:43 PM on February 23, 2009 [1 favorite]
Isn't that solvable with linear programming?
Well, no. For two reasons:
The first is that we'd have to restrict our unknown variables to integers (which is actually much harder to solve than unknowns that can be irrational. Whoa!)
The second, more important reason, is that our objective function (100000a+10000b+1000c+100d...) isn't actually linear. Note the a^6 term, for example, which means that linear programming is out. So you're looking at nonlinear programming, which doesn't have nearly as many shortcuts as linear programming does.
So ... nonlinear integer programming. Ouch. For only $135, Springer-Verlag will sell you a book that tells you how to solve this problem, or you could just use the solution in Python above ;-)
posted by oostevo at 7:58 AM on February 24, 2009
Well, no. For two reasons:
The first is that we'd have to restrict our unknown variables to integers (which is actually much harder to solve than unknowns that can be irrational. Whoa!)
The second, more important reason, is that our objective function (100000a+10000b+1000c+100d...) isn't actually linear. Note the a^6 term, for example, which means that linear programming is out. So you're looking at nonlinear programming, which doesn't have nearly as many shortcuts as linear programming does.
So ... nonlinear integer programming. Ouch. For only $135, Springer-Verlag will sell you a book that tells you how to solve this problem, or you could just use the solution in Python above ;-)
posted by oostevo at 7:58 AM on February 24, 2009
I should really think these things through before I post.
posted by archagon at 8:56 AM on February 24, 2009
posted by archagon at 8:56 AM on February 24, 2009
This thread is closed to new comments.
This isn't a homework problem is it?
posted by demiurge at 4:34 PM on February 23, 2009 [1 favorite]