Search   Memberlist   Usergroups
 Page 1 of 1 [5 Posts]
Author Message
William Elliot
science forum Guru

Joined: 24 Mar 2005
Posts: 1906

Posted: Fri Jul 21, 2006 12:07 pm    Post subject: Mod computer problem

What is the solution to
n mod 5 = n mod 7 ?
Pubkeybreaker
science forum Guru

Joined: 24 Mar 2005
Posts: 333

Posted: Fri Jul 21, 2006 12:22 pm    Post subject: Re: Mod computer problem

William Elliot wrote:
 Quote: What is the solution to n mod 5 = n mod 7 ?

"The" solution??? There are infinitely many.

Trivally, n= 1 is a solution. so is n = 2, so is n = 3. so is n =
4..
Now think about the Chinese Remainder Theorem....

(example: n = 74 is a solution; ask yourself what relation the number
74
has to one of the first 4 solutions that I gave)
Jussi Piitulainen
science forum beginner

Joined: 16 Jun 2005
Posts: 11

Posted: Fri Jul 21, 2006 12:53 pm    Post subject: Re: Mod computer problem

William Elliot writes:

 Quote: What is the solution to n mod 5 = n mod 7 ?

Guessing from the subject line that you want it solved
using a computer, here's a program to collect all k in a
given interval that satisfy the condition:

(define (loopy-do k n em)
(if (< k n)
(if (= (modulo k 5) (modulo k 7))
(loopy-do (+ k 1) n (cons k em))
(loopy-do (+ k 1) n em))
(reverse em)))

Running it for all k from -200, inclusive, to 200,
exclusive, we get a list of solutions:

 Quote: (loopy-do -200 200 '()) '(-175 -174 -173 -172 -171 -140 -139 -138 -137 -136 -105

-104 -103 -102 -101 -70 -69 -68 -67 -66 -35 -34 -33 -32
-31 0 1 2 3 4 35 36 37 38 39 70 71 72 73 74 105 106 107
108 109 140 141 142 143 144 175 176 177 178 179)

The general solution seems to be 35k + {0,1,2,3,4} where k
is any integer.
William Elliot
science forum Guru

Joined: 24 Mar 2005
Posts: 1906

Posted: Fri Jul 21, 2006 1:15 pm    Post subject: Re: Mod computer problem

On Fri, 21 Jul 2006, Jussi Piitulainen wrote:

 Quote: William Elliot writes: What is the solution to n mod 5 = n mod 7 ? Guessing from the subject line that you want it solved using a computer, here's a program to collect all k in a given interval that satisfy the condition: No I didn't. n mod 5 is computerese but is tossed around like it is real

math. Thus since computerese has pretense to math, the guess to make is a
computerese math solution.

 Quote: (define (loopy-do k n em) (if (< k n) (if (= (modulo k 5) (modulo k 7)) (loopy-do (+ k 1) n (cons k em)) (loopy-do (+ k 1) n em)) (reverse em))) Running it for all k from -200, inclusive, to 200, exclusive, we get a list of solutions: (loopy-do -200 200 '()) '(-175 -174 -173 -172 -171 -140 -139 -138 -137 -136 -105 -104 -103 -102 -101 -70 -69 -68 -67 -66 -35 -34 -33 -32 -31 0 1 2 3 4 35 36 37 38 39 70 71 72 73 74 105 106 107 108 109 140 141 142 143 144 175 176 177 178 179) The general solution seems to be 35k + {0,1,2,3,4} where k is any integer. That's why it's not a computer program problem, but a computerese problem,

depending upon what implementation of a mod n is in vogue That the
program won't ever give the solution set.

x mod -5 = x mod 7
is sheer computerese for there is no Z_-5 integers modulus -5
tho by scraping the bottom of the barrel, one could fantasy such.

The solution to the later equation is much more computer language
sensitive than the former equation.
Bill Dubuque
science forum Guru Wannabe

Joined: 04 May 2005
Posts: 236

Posted: Fri Jul 21, 2006 2:10 pm    Post subject: Re: Mod computer problem

William Elliot <marsh@hevanet.remove.com> wrote:
 Quote: What is the solution to n mod 5 = n mod 7 ?

HINT n mod a = n mod b, 0 < a <= b

<-> n = n mod a + ab/(a,b) Z

If a or b = 0 use |Z/a| <= |Z/b| vs. 0 < a <= b

--Bill Dubuque

 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
 Page 1 of 1 [5 Posts]
 The time now is Sun Nov 18, 2018 4:21 pm | All times are GMT
 Jump to: Select a forum-------------------Forum index|___Science and Technology    |___Math    |   |___Research    |   |___num-analysis    |   |___Symbolic    |   |___Combinatorics    |   |___Probability    |   |   |___Prediction    |   |       |   |___Undergraduate    |   |___Recreational    |       |___Physics    |   |___Research    |   |___New Theories    |   |___Acoustics    |   |___Electromagnetics    |   |___Strings    |   |___Particle    |   |___Fusion    |   |___Relativity    |       |___Chem    |   |___Analytical    |   |___Electrochem    |   |   |___Battery    |   |       |   |___Coatings    |       |___Engineering        |___Control        |___Mechanics        |___Chemical

 Topic Author Forum Replies Last Post Similar Topics help on problem brb003 Math 0 Mon Aug 28, 2006 3:31 am fraction problem mikerule Research 0 Thu Aug 24, 2006 5:10 am Divine apparitions in the tethered goat problem? jpalmour@gmail.com Math 6 Thu Jul 20, 2006 8:26 pm possible to use Generalized Method of Moments for this pr... comtech Math 1 Thu Jul 20, 2006 12:49 am Vector field flow problem - help? Daniel Nierro Math 1 Wed Jul 19, 2006 10:28 am