FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Forum index » Science and Technology » Math
Mod computer problem
Post new topic   Reply to topic Page 1 of 1 [5 Posts] View previous topic :: View next topic
Author Message
William Elliot
science forum Guru


Joined: 24 Mar 2005
Posts: 1906

PostPosted: Fri Jul 21, 2006 12:07 pm    Post subject: Mod computer problem Reply with quote

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


Joined: 24 Mar 2005
Posts: 333

PostPosted: Fri Jul 21, 2006 12:22 pm    Post subject: Re: Mod computer problem Reply with quote

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)
Back to top
Jussi Piitulainen
science forum beginner


Joined: 16 Jun 2005
Posts: 11

PostPosted: Fri Jul 21, 2006 12:53 pm    Post subject: Re: Mod computer problem Reply with quote

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.
Back to top
William Elliot
science forum Guru


Joined: 24 Mar 2005
Posts: 1906

PostPosted: Fri Jul 21, 2006 1:15 pm    Post subject: Re: Mod computer problem Reply with quote

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.
Back to top
Bill Dubuque
science forum Guru Wannabe


Joined: 04 May 2005
Posts: 236

PostPosted: Fri Jul 21, 2006 2:10 pm    Post subject: Re: Mod computer problem Reply with quote

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
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [5 Posts] View previous topic :: View next topic
The time now is Thu Jun 29, 2017 2:24 pm | All times are GMT
Forum index » Science and Technology » Math
Jump to:  

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

Copyright © 2004-2005 DeniX Solutions SRL
Other DeniX Solutions sites: Electronics forum |  Medicine forum |  Unix/Linux blog |  Unix/Linux documentation |  Unix/Linux forums  |  send newsletters
 


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0706s ][ Queries: 16 (0.0510s) ][ GZIP on - Debug on ]