MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Congruences


At 4:07 -0400 24-05-2001, Flip wrote:
>Hi All,
>
>I was having a difficult time find this in the documentation and was hoping
>someone here could help.
>
>1.  How do you solve the congruence 19 x = 1 mod 140?
>
>2.  I am trying to verify that x = 12 mod 16 (where x is a 1024-bit number).
>How do I do that (essentially the same as question 1.)?
>
>Thank you ... Flip

1. You can use LinearSolve[ M, c, Modulus->p]
where M is the 1 x 1 matrix {{19}}, c the 1-dimensional vector {1} and p=140:


In[29]:= LinearSolve[{{19}},{1},Modulus->140]

Out[29]= {59}

2. Being 16=2^4 use this

FromDigits[#, 2] &[Take[IntegerDigits[x, 2], -4]] == 12


Adriano Pascoletti



  • Prev by Date: Re: Congruences
  • Next by Date: RE: A tricky equation
  • Previous by thread: Re: Congruences
  • Next by thread: Re: Congruences