This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
7 ϕ ( 1 0 0 0 ) = 1 mod 1000
7 4 0 0 = 1 mod 1000
7 1 0 0 0 0 = 1 mod 1000
7 9 9 9 9 = 1001/7 mod 1000
7 9 9 9 9 = 143 mod 1000
Although you have done the same, but I am just sharing it in a 'simple' form, I think.
Hey, @mathh mathh do you know what to do when (10^n + 1) is a prime or not divisible by the number(here, 7)? I read in A. Engel's book about it but I didn't get it.
Log in to reply
You just add 1 0 0 0 's, like 1 0 0 1 , 2 0 0 1 , 3 0 0 1 , etc., until the number is divisible by 7 .
My method is simple given you have in mind that the denominator can't be simplified when it is not coprime to the modulus. This is the only rule, but isn't difficult to forget when working. In our example we couldn't scale anything by an even number or a multiple of 5 .
Log in to reply
Thank You!
Log in to reply
@Kartik Sharma – @Kartik Sharma In case adding 1 0 0 0 's doesn't help (this can easily happen when all the numbers are big; when they're small, because of the law of small numbers we have that they're often easily simplifiable), we can usually use the Extended Euclidean algorithm, which will almost always help. See my response to Rishabh Jain.
I didnt understand the last few parts. :/
Log in to reply
If the text under the line is not fully understandable, then sorry - I wanted to edit it to make it more clear, but brilliant doesn't seem to let me edit it.
Anyway, what it's saying is just that you must have the denominator and the modulus coprime if you want to reduce the denominator using the modulus. That's the only restriction if you're working with fractions.
E.g.
7 1 ≡ × 3 2 1 3 ≡ 1 3 ≡ 3 ( m o d 1 0 )
But you couldn't have scaled it by 2 , since g cd ( 2 , 1 0 ) = 2 = 1 .
what should we do if it is 7 9 9 9 6
Log in to reply
In this case, as you can see, we'd need to find 7 4 1 ≡ 4 0 1 1 ( m o d 1 0 0 0 )
Now, having modulus as big as 1 0 0 0 , solving this without using the Extended Euclidean Algorithm would be quite tough. In this problem's case, we were very lucky that 7 ∣ 1 0 0 1 , but we don't really, in your case, have 7 4 ∣ 1 0 0 1 or 2 0 0 1 or anything similar, so it's quite tough.
To find the modular multiplicative inverse of 4 0 1 modulo 1 0 0 0 (which exists since g cd ( 1 0 0 0 , 4 0 1 ) = 1 ), we can use the Extended Euclidean Algorithm.
1 0 0 0 ( 1 6 0 ) + 4 0 1 ( − 3 9 9 ) = 1
Hence 4 0 1 1 ≡ − 3 9 9 ≡ 6 0 1 ( m o d 1 0 0 0 ) .
The Extended Euclidean Algorithm will find you the inverse of any number modulo another that is coprime to it (if not coprime, the inverse does not exist. Always scale the fractions by a number coprime to the modulus).
Log in to reply
Very nicely explained mathh mathh .. Loved ur solution.. :)
its my doubt since a long time that how can we calculate the numbers equal to or less than N which are co-prime to N plz can u explain @mathh mathh
Log in to reply
@sakshi rathore Please ask, if you have any questions.
Log in to reply
our teacher told us that to find the last three digits we have to know the binomial expansion of it is it really necessary ??not any other method @mathh mathh
Log in to reply
@Sakshi Rathore – @sakshi rathore Well, above answer found the last three digits of 7 9 9 9 9 without using Binomial theorem.
There are many methods of finding the last three digits of a b . One of them is using Euler's theorem (or the stronger Carmichael function ), like I did above. Read the end of my answer for a simplified solution.
Sometimes Euler's theorem or Carmichael function is enough, like it was in my answer. If not, then after reducing, you can use Binomial theorem, especially in the following cases:
1) If a = 1 0 k ± 1 , then
a b ≡ ( ± 1 + 1 0 k ) b ≡ ( ± 1 ) b + ( 1 b ) ( ± 1 ) ( 1 0 k ) + ( 2 b ) ( ± 1 ) ( 1 0 0 k ) ( m o d 1 0 0 0 )
2) If (1) can't be used, then if a = 5 k ± 1 , then
a b ≡ ( ± 1 + 5 k ) b ≡ ( ± 1 ) b + ( 1 b ) ( ± 1 ) ( 5 k ) + ( 2 b ) ( ± 1 ) ( 2 5 k ) ( m o d 1 2 5 )
a b m o d 8 is easy to calculate. Then use Chinese Remainder theorem .
Never forget you can use Chinese Remainder theorem, Euler's theorem. It makes some problems extremely simple. E.g., 1 2 6 8 9 1 ≡ 1 ( m o d 1 2 5 ) and 1 2 6 8 9 1 ≡ 0 ( m o d 8 ) , so by Chinese Remainder theorem the last three digits of 1 2 6 8 9 1 are 3 7 6 . Another example: 4 5 3 1 0 1 9 9 ≡ 4 5 3 1 0 1 9 9 ( m o d 1 0 0 ) ≡ 4 5 3 ( m o d 1 2 5 ) and 4 5 3 1 0 1 9 9 ≡ 4 5 3 1 0 1 9 9 ( m o d 4 ) ≡ 4 5 3 ( m o d 8 ) , so 4 5 3 1 0 1 9 9 ≡ 4 5 3 ( m o d 1 0 0 0 ) . So you don't always need Binomial Theorem - never forget Chinese Remainder theorem, Euler's theorem (sometimes Carmichael function).
Log in to reply
@Mathh Mathh – oh thank you sir for explaining so well
@sakshi rathore I think you want to find ϕ ( 1 0 0 0 ) ?
Let's calculate ϕ ( n ) . Let n = p 1 α 1 p 2 α 2 ⋯ p k α k (remember Fundamental theorem of arithmetic ).
Below formula can be proved:
ϕ ( n ) = ϕ ( p 1 α 1 p 2 α 2 ⋯ p k α k ) = ( p 1 α 1 − p 1 α 1 − 1 ) ⋯ ( p k α k − p k α k − 1 )
Another formula (above formula written in a different way):
ϕ ( p 1 α 1 p 2 α 2 ⋯ p k α k ) = n ( 1 − p 1 1 ) ⋯ ( 1 − p k 1 )
So you can just use the formulas instead of searching for all the numbers ≤ 1 0 0 0 coprime to 1 0 0 0 .
ϕ ( 1 0 0 0 ) = ϕ ( 2 3 ⋅ 5 3 ) = ( 2 3 − 2 2 ) ( 5 3 − 5 2 ) = 4 0 0
So there are 4 0 0 numbers less than or equal to 1 0 0 0 that are coprime to 1 0 0 0 .
If you understand Chinese Remainder Theorem, the proof of the formulas is very simple - see Wikipedia .
Just observation!
Consider 7^{N}.
Unit place digit has a cycle of 4: 7, 9, 3, 1, 7, 9, 3, 1, ...
Tens place digit has a cycle of 4: 0, 4, 4, 0, 0, 4, 4, 0, ...
Hundredth place digit has a cycle of 20:
0, 0, 3, 4, 8, 6, 5, 8, 6, 2, 7, 2, 4, 8, 9, 6, 2, 4, 1, 0,
0, 0, 3, 4, 8, 6, ...
Now, 100 or 1000 or 10000 etc. are all divisible by 20 (and therfore by 4 as well).
Hence, for each of N = 99, 999, 9999, 99999, etc
7^{N} ends in 143 .
First of all, 7 and 10 are relatively prime, so Euler's theorem applies. You are essentially wanting 7^9999 modulo 1000. Now, the totient function of 1000=2^3 5^3 is (2-1) 2^2 (5-1)^5^2, which is 400. Hence, 7^400=1 mod 1000. So the question is what 9999 is modulo 400. Clearly, it is -1. So what you really want is 7^(-1) mod 1000. In other words, you want an x so that 7x=1 mod 1000. But, it turns out that 7 11 13=1001 is 1 mod 1000, so x=11*13=143.
Thus, the last 3 digits of 7^9999 are 143.
Problem Loading...
Note Loading...
Set Loading...
g cd ( 7 , 1 0 0 0 ) = 1 , thus we can use Euler's theorem .
7 9 9 9 9 ≡ 7 9 9 9 9 m o d ϕ ( 1 0 0 0 ) ≡ 7 9 9 9 9 m o d 4 0 0 ≡ 7 − 1
Two ways to continue:
≡ 7 1 ≡ 7 ⋅ 1 4 3 1 ⋅ 1 4 3 ≡ 1 0 0 1 1 4 3 ≡ 1 1 4 3 ≡ 1 4 3 ( m o d 1 0 0 0 )
≡ 7 1 ≡ 7 1 0 0 1 ≡ 1 4 3 ( m o d 1 0 0 0 )
Using fractional notation like above makes sense if and only if the denominator is coprime to the modulus.
If the fraction makes sense, its denominator can always be reduced mod the modulus. In this case note g cd ( 7 , 1 0 0 0 ) = g cd ( 1 4 3 , 1 0 0 0 ) = 1 , so everything makes sense and can be reduced.
In simpler terms: the second method was:
7 x ≡ 7 ⋅ 7 9 9 9 9 ≡ 7 1 0 0 0 0 ( m o d 4 0 0 ) ≡ 7 0
\equiv 1\equiv 1001\stackrel{:7}\iff x\equiv 143\pmod{\! 1000}
The first method was:
7x\equiv \cdots\equiv 1\stackrel{\cdot 143}\iff 1001x\equiv x\equiv 143\pmod{\! 1000}