Ok so we know after dividing bu 100, 1000, 10000, 100000 by 41 we get-- 18, 16, 37, 1
Thus 99999 is divisible by 41.
Let x=90 000 800 007 000 060 000 500 004 000 030 000 200 001
=9* 10power40 + 8* 10power35 +7* 10power30 + 6* 10power25 + 5* 10power20 + 4* 10power15 + 3* 10power10 + 2* 10power5 + 1
From the above, 10power5 leaves a remainder of 1 when divided by 41.
Thus the remainders of each term of the sum are 9,8,7,6,5,4,3,2,1 !!
The sum of the remainders is 45 and so the remainder when x is divided by 41 is 4 !!
Originally posted by phgaoa^(p-1) - 1 = 0 (mod p) where a is a positive integer and p is a prime.
Fermat's Little Throrem? The problem does not relate to it.
In your problem, a = 10 and p = 41
Therefore the number 10^40 - 1 is divisble by 41
As you didn't ask for the smallest such number, this answers your first question rather more quickly than your trial-and-error method.
Originally posted by THUDandBLUNDEROh thanks for that insight T&B! I appreciate it.
a^(p-1) - 1 = 0 (mod p) where a is a positive integer and p is a prime.
In your problem, a = 10 and p = 41
Therefore the number 10^40 - 1 is divisble by 41
As you didn't ask for the smallest such number, this answers your first question rather more quickly than your trial-and-error method.