All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Just Math
Cubic Equation (Posted on 2013-06-09) Difficulty: 4 of 5
Determine all triplets (a,b,c) of nonzero integers satisfying:
987654321*a + 123456789*b + c = (a + b + c)3

Prove that there are no others.

No Solution Yet Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Some Thoughts an open letter to Charlie | Comment 7 of 13 |

Charlie, you are a gifted and skilled programmer, one of the best I've encountered during my long professional life. Your programs are nicely structured, they are concise and mostly easily readable, even uncommented. They generally map the problem, trying to assume as little as possible, avoiding shortcuts and caring very little about the runtime .

This proves counterproductive facing a puzzle which performs a certain subroutine a zillion times – I do not intend to calculate what the word zillion represents here, but for every possible number within   about 30k range you exhaust all possible compositions (6 times the number of partitions(!) , which is HUGE by itself).

In this case – time matters.

 So I humbly suggest a minor modification which will reduce your total runtime by (ROM estimate) 80-90%:  instead of multiplying a * 9876..and b *1234…use one addition instead of one long  multiplication – just add 98765…to the previous sum in the loop, same for 1234…and see what happens.

I would appreciate it very much if   you follow my advice – since you have an" a+b+c = 30,000"  segment ready, you may apply the changes there and compare the runtimes in both versions. It really interests me, how significant those modifications are.

This is also an opportunity to thank you for your tremendous contribution to the site –

I admit that I have learned from you a lot.

 


Edited on June 10, 2013, 6:06 pm
  Posted by Ady TZIDON on 2013-06-10 17:36:28

Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (1)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information