Solved

Evenly divisible

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

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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

This article seeks to propel the full implementation of geothermal power plants in Mexico as a renewable energy source.
Lithium-ion batteries area cornerstone of today's portable electronic devices, and even though they are relied upon heavily, their chemistry and origin are not of common knowledge. This article is about a device on which every smartphone, laptop, an…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video discusses moving either the default database or any database to a new volume.

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now