View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Dana DeLouis Dana DeLouis is offline
external usenet poster
 
Posts: 947
Default Calculate Last Digits

Well, I apologize. I just attacked the problem from a different method and
got the time down to about 2 minutes.
However, I now get the same solution as you. I really don't see where the
error was in my previous code.
Are you trying to use Excel to verify the solution? I'm curious where you
got the answers.
Anyway, I'm not sure how long Excel would take to arrive at a solution, but
I'm guessing a very long time.

LastDigit = i - 10 * Int(i) / 10


I can't follow your code to well, but in the above, the variable 'I' is
already an integer, so you are not doing much to "I"
It "appears" you meant something like "Int(I/10)*10 to extract the last
digit.
Just to mention, the last digit is also = Mod(n,10)

Your initial set are the numbers 1-49. After generating all 13,983,816
subsets, you extract the last digit of each.
That's =6*COMBIN(49,6), or 83,902,896 different Mod () operations alone.
I suggest starting with a set with just the last digit. (ie apply the Mod to
each of the 49 numbers.)
Then go into your Subset routine.

Anyway, I get the same solution as you, so please disregard my previous
attempt.
--
Dana DeLouis

<snip