Re: Find the minimum of a set in modulo n
- From: Gerry Myerson <gerry@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 12 Oct 2006 23:10:41 GMT
In article <1160646497.819962.278900@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
"Dani Camps" <danicamps81@xxxxxxxxx> wrote:
Thanks !
Please don't top-post.
PS: Some hint to understand? ;)
Sure. What don't you understand? meaning of gcd? method of computation
of gcd? meaning of division-with-remainder? method of computation of
division-with-remainder? meaning of answer? something else?
Dani
Gerry Myerson wrote:
In article <1160604284.472066.73650@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
"Dani Camps" <danicamps81@xxxxxxxxx> wrote:
I have the following problem. Imagine that you generate a set in modulo
n in the following way:
s_k = (a*k + b) mod n
where a >= n and 0 <= b <= n. And we can assume all of them, a,b,n are
integers
Let's give an example, imagine that:
a=90, b=5, n=54
If we start increasing k we will obtain the following set of numbers:
{5, 41, 23, 5, 41, 23, 5, 41, 23, 5, 41, 23,...}
We will always obtain periodic sequences where if:
lcm(a,n)=N*a=M*n
The period of the sequences is N, in our previous case
lcm(90,54)=270=3*90=5*54.
The actual numbers that we have in our basic period depend on the value
of b, thus if in our previous example b=13, then the basic sequence
that we obtain is {13, 49, 31}.
We can say that given (a*k + b) mod n we can generate a set of N
elements that will have values between 0 and n.
So my problem is, given (a*k + b) mod n, is it possible to compute the
minimum of this set of N elements as a function of a,b and n ?
1. Compute d = gcd(a, n).
2. Compute the remainder on dividing b by d. That's your answer.
--
Gerry Myerson (gerry@xxxxxxxxxxxxxxx) (i -> u for email)
--
Gerry Myerson (gerry@xxxxxxxxxxxxxxx) (i -> u for email)
.
- Follow-Ups:
- Re: Find the minimum of a set in modulo n
- From: Dani Camps
- Re: Find the minimum of a set in modulo n
- References:
- Find the minimum of a set in modulo n
- From: Dani Camps
- Re: Find the minimum of a set in modulo n
- From: Gerry Myerson
- Re: Find the minimum of a set in modulo n
- From: Dani Camps
- Find the minimum of a set in modulo n
- Prev by Date: Re: need proof hint,
- Next by Date: Re: Linear Algebra
- Previous by thread: Re: Find the minimum of a set in modulo n
- Next by thread: Re: Find the minimum of a set in modulo n
- Index(es):
Relevant Pages
|