-
Code this better...
This program was developed as a brute-force method of a previous post (by me) that nobody seemed to care to try.
http://www.vbforums.com/showthread.php?s=&threadid=300549
I need 2 things.
1) try to make it more efficient
2) find a way to make sure that a(0) thru a(9) has a different value for each array value. (Make sure that it uses 0-9) with NO duplicates
Then, it will be correct. I used a break statement to make sure that it would calculate the right answer, but it took too long!
Here is my code.
Enjoy! :D
-
I have concluded that it would not be of any use to waste cycles filling in a array of value-flags, except in some circumstances, like when it would save thousands of cycles. Plus, I don't know if all values are used in numbers that don't add up?
I do know that there is only one answer that computes, and also uses all of the digits. [I have checked them all]
Plus, I didn't compile it, so that I could use the break key.
Maybe I will try to see if the first 4 arrays are unique, and if so, then skip the inner loops. This would save a bunch of cycles, but I'm not sure of the most efficient AND fast way to do it is.
I will post the new code when I have it finished, so that it will stop at the correct number. Then I can compile it and time its operation as I make changes.
I wasn't sure how to go about solving the problem programmatically, and it feels good having accurate results.
:D
-
uh... where is the form?? it not included
-
sorry about that. here it is. I've added it to the project.
:D
haven't done anything to it, though. sorry again.
-
this was also discussed in detail in math forum.
Here...
It has become so common that it was hardly worth it.