Solved

Evenly divisible

Posted on 2010-11-30
11
333 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Math Stumper 6 59
Need a nodal sequencing tool 3 119
Two Dice Roll Probabilities 3 76
Calculation of speed from point A to point B. 4 31
Introduction On a scale of 1 to 10, how would you rate our Product? Many of us have answered that question time and time again. But only a few of us have had the pleasure of receiving a stack of the filled out surveys and being asked to do somethi…
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…
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

735 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