Chinese Remainder Theorem CRT programming - PowerPoint PPT Presentation

1 / 5
About This Presentation
Title:

Chinese Remainder Theorem CRT programming

Description:

Reconstruct integers in a certain range from their residues modulo a set of ... by Euclid's algorithm, compute inv(m1) and inv(m2) Calculate x by equation. return x; ... – PowerPoint PPT presentation

Number of Views:96
Avg rating:3.0/5.0
Slides: 6
Provided by: rtdsC
Category:

less

Transcript and Presenter's Notes

Title: Chinese Remainder Theorem CRT programming


1
Chinese Remainder Theorem (CRT) programming
  • Jonas Tan
  • jonastan_at_cs.tamu.edu

2
Chinese Remainder Theorem
  • Used for speeding up modulo computations
  • Reconstruct integers in a certain range from
    their residues modulo a set of pairwise
    relatively prime number.
  • The 10 integers in Z10(0,1,,9) can be
    constructed from their two residues modulo 2 and
    5 (the relatively prime factors of 10).
  • x mod 2 0 x mod 5 3 gt The unique solution is
    8

3
Example
4
Multiplicative Inverse
  • If gcd(d, f) 1, then d has a multiplicative
    inverse modulo f.
  • For positive integer dltf, there exists a
    such that
  • In addition to finding gcd(d, f), if gcd(d ,f)1,
    Euclidean algorithm can return the multiplicative
    inverse of d.

5
Program Exercise
  • Add your codes into Crt.cs
  • BigInteger CRT(BigInteger r1, BigInteger r2,
    BigInteger m1, BigInteger m2)
  • BigInteger x
  • by Euclids algorithm, compute inv(m1) and
    inv(m2)
  • Calculate x by equation
  • return x
Write a Comment
User Comments (0)
About PowerShow.com