Solved

Evenly divisible

Posted on 2010-11-30
11
335 Views
Last Modified: 2012-05-10
Read question. Is my answer correct? a

(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
0
Comment
Question by:Mickeys
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 3
11 Comments
 
LVL 32

Expert Comment

by:phoffric
ID: 34242672
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 Comment

by:Mickeys
ID: 34242725
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
 
LVL 32

Expert Comment

by:phoffric
ID: 34242841
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Mickeys
ID: 34242929
no :-(
0
 
LVL 32

Expert Comment

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

Author Comment

by:Mickeys
ID: 34243036
well all I really wanted to know was if my solution was correct
0
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 34243258
Yes.
0
 
LVL 32

Assisted Solution

by:phoffric
phoffric earned 250 total points
ID: 34243284
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
 
LVL 37

Accepted Solution

by:
TommySzalapski earned 250 total points
ID: 34243292
(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
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 34243301
These are your steps with the justifications. Looks complete to me.
0
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 34243324
Oh, that first step also used (a+b) % n = a%n + b%n
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to Win a Jar of Candy Corn: A Scientific Approach! I love mathematics. If you love mathematics also, you may enjoy this tip on how to use math to win your own jar of candy corn and to impress your friends. As I said, I love math, but I gu…
This article provides a brief introduction to tissue engineering, the process by which organs can be grown artificially. It covers the problems with organ transplants, the tissue engineering process, and the current successes and problems of the tec…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

687 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question