Let me try. Any thing involving n would leave no remainder. so (1 + 2 ! + ... + n ! + .... + N !) mod n = (1 + 2 ! + ... + (n-1)! ) mod n
This should be computed from a loop. I don't know how to reduce it further. Ashim. On Wed, Dec 8, 2010 at 6:49 PM, ankit sablok <[email protected]> wrote: > Q) can anyboy find me the solution to this problem > > Given an integer N and an another integer n we have to write a program > to find the remainder of the following problems > (1! + 2! + 3! + 4! + ..................... + N!)mod(n) > > N<=1000000 > n<=1000; > > please help me write a program for this problem > thanx in advance > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<algogeeks%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
