number-crunching

Need to devise a number crunching algorithm

I stumbled upon this question: 7 power 7 is 823543. Which higher power of 7 ends with 823543 ? How should I go about it ? The one I came up with is very slow, it keeps on multiplying by 7 and checks last 6 digits of the result for a match. I tried with Lou's code: int x=1; for (int i=3;i<=100000000;i=i+4){ x=(x*7)...

Efficient Cancel Event Implementation for Number Crunching Threads

What is the most efficient way to create a “cancel” event in a C# program that is crunching a large set of data in a loop on a separate thread? For now, I am simply using a cancel event that is triggered from my UI thread, which subsequently calls an “onCancel” function on the number crunching thread. That cancel function sets a variable...