# Evenly divisible

(123^121+121^123) mod 122= ((122+1)^121) mod 122+ ((122-1)^123)mod 122= (1^121) mod 122 +((-1)^123) mod 122 = 1 mod 122+ (-1) mod 122= (1-1) mod 122 =0
###### Who is Participating?

x

Commented:
(123^121+121^123) mod 122
= ((122+1)^121) mod 122+ ((122-1)^123)mod 122  ----- simple arithmetic
= (1^121) mod 122 +((-1)^123) mod 122 ----- a^k % n = (a%n)^k
= 1 mod 122+ (-1) mod 122 ------ simple algebra
= (1-1) mod 122 --------- (a+b) % n = a%n + b%n
=0 --------- simple arithmetic and 0 mod a = 0 (where a not= 0)
0

Commented:
Where % ~ mod, it looks like you are using these principles:
aa % n = (a % n) (a % n)
a^k % n = (a%n)^k
(a+b) % n = a%n + b%n
More generally, you could write:
(n+1)^(n-1)  % n = [ (n+1) % n ] ^ (n-1) = [ n % n +1 % n ] ^ (n-1) = [ 0 + 1 ] ^ (n-1) = 1
(n-1)^(n+1)  % n = [ (n-1) % n ] ^ (n+1) = [ n % n - 1 % n ] ^ (n+1) = [ 0 - 1 ] ^ (n+1) = -1
0

Author Commented:
So to get the correct answer. Would I use this
(123^121+121^123) mod 122= ((122+1)^121) mod 122+ ((122-1)^123)mod 122= (1^121) mod 122 +((-1)^123) mod 122 = 1 mod 122+ (-1) mod 122= (1-1) mod 122 =0

or this?
(n+1)^(n-1)  % n = [ (n+1) % n ] ^ (n-1) = [ n % n +1 % n ] ^ (n-1) = [ 0 + 1 ] ^ (n-1) = 1
(n-1)^(n+1)  % n = [ (n-1) % n ] ^ (n+1) = [ n % n - 1 % n ] ^ (n+1) = [ 0 - 1 ] ^ (n+1) = -1

0

Commented:
I prefer symbols, but you can choose the approach you feel more comfortable with.

Let n = 122, then
(n+1)^(n-1)  % n = (122+1)^(122-1)  % 122 = (123^121) mod 122

and
(n-1)^(n+1)  % n = (122-1)^(122+1)  % 122 = (121^123) mod 122

Can you make the final conclusions from this substitution by comparing it with your OP?
0

Author Commented:
no :-(
0

Commented:
>> no :-(
Could you elaborate?
For example, what part of the substitution are you having trouble with?
0

Author Commented:
well all I really wanted to know was if my solution was correct
0

Commented:
Yes.
0

Commented:
Ok, let me check by using n=122 for your solution...

I checked it, and your solution is correct. However, I recommend adding extra steps.

0

Commented:
These are your steps with the justifications. Looks complete to me.
0

Commented:
Oh, that first step also used (a+b) % n = a%n + b%n
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.