Data Structures and Algorithms
posted by Steven .
Given integers R,M with M≠0, let S(R,M) denote the smallest positive integer x satisfying the congruence
Rx≡1(mod M)
if such an x exists. If such an x does not exist, put S(R,M)=0.
Each line of this text file contains a pair of space separated integers representing R and M, respectively.
Let L be the list of integers whose kth element is the value of S(R,M), where R and M are taken from the kth line of the text file.
Let T be the sum of all elements of L. What are the last three digits of T?
Respond to this Question
Similar Questions

Math
Let a be an integer, then there are integers X, Y such that aX+(a+1)Y=1. Find the smallest positive value of Y. 
math
there are three consecutive positive integers such that the sum of the squares of the smallest two is 221. write and equation to find the three consecutive positive integers let x= the smallest integer 
Math
N is an integer such that N≡179(mod233) and N≡233(mod179). Determine a three digit positive integer M such that N≡M(mod179×233). Details and assumptions You may use the fact that 179 and 233 are primes. 
Math (algebra)
Suppose a and b are positive integers satisfying 1≤a≤31, 1≤b≤31 such that the polynomial P(x)=x^3−ax^2+a^2b^3x+9a^2b^2 has roots r, s, and t. Given that there exists a positive integer k such that (r+s)(s+t)(r+t)=k^2, … 
Maths
Suppose a and b are positive integers satisfying 1≤a≤31, 1≤b≤31 such that the polynomial P(x)=x3−ax2+a2b3x+9a2b2 has roots r, s, and t. Given that there exists a positive integer k such that (r+s)(s+t)(r+t)=k2, … 
Math algebra
Let N be the sum of all positive integers q of the form q=p^k with prime p, such that for at least four different integer values of x from 1 to q, x^3−3x≡123(modq). What are the last 3 digits of N? 
algebra
Find the largest possible integer n such that there exists a nonconstant quadratic polynomial f(x) with integer coefficients satisfying f(1)∣f(2),f(2)∣f(3),…f(n−1)∣f(n). Details and assumptions: ~For (possibly … 
MATHS
Find the largest possible integer n such that there exists a nonconstant quadratic polynomial f(x) with integer coefficients satisfying f(1)∣f(2),f(2)∣f(3),…f(n−1)∣f(n). Details and assumptions For (possibly … 
maths
Find the smallest n such that for any prime p, at least 20 numbers 1,2, ..., n are quadratic residues not modulo p. k is quadratic residue modulo p if there exists an integer j such that j^2 ≡ k (mod p). 
maths
(x+y)(x+z)(y+z)=2017^n What is the minimum value n of such that there exist positive integers x,y and z satisfying the equation above?