Question

Please help me answer, the last answer was incorrect. We want to prove that 119 has...

Please help me answer, the last answer was incorrect.

We want to prove that 119 has infinitely many multiplicative inverses modulo 198. (a) Prove that such a multiplicative inverse exists. (b) Verify that 5 is one of them. (c) Prove that there are infinitely many inverses. Hint: Consider the number (5 + n · 198) (d) Generalize the statement: Try to prove that for any two positive integers a and b that are relative primes, there are infinitely many multiplicative inverses of a modulo b.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

/*

Function: uppercaseMethod

Purpose: Converts all lower case letters found within the line to uppercase

*/

void * uppercaseMethod(void *arg)

{

int i;

for(i = 0; i < 63; i++)

{

if(islower(input[i]))

{

input[i] = toupper(input[i]);

}

}

}

/*

Function: writeMethod

Purpose: Writes formatted line to screen and file

*/

void * writeMethod(void *arg)

{

int m;

char e, d;

Queue obj;

if(input != " ")

{

for(m = 0; m < input.length(); m++)

{

e = input[m];

obj.Enqueue(e);

}

for(m = 0; m < input.length(); m++)

{

d=obj.Dequeue(d);

}

cout << " Line " << lineNum << ": ";

cout << input << endl;

outFile << input << endl;

lineNum++;

}

}

/*

Function: readerMethod

Purpose: Reads each line from file

*/

void * readerMethod(void *arg)

{

ifstream infile("file.txt");

cout << "The file is now opened!" << endl;

cout << "\nReading input file now..." << endl;

cout <<" _________________________________\n" << endl;

for(m = 0; m < input.length(); m++)

{

e = input[m];

obj.Enqueue(e);

}

for(m = 0; m < input.length(); m++)

{

d = obj.Dequeue(d);

cout << " Line " << lineNum << " : ";

cout << input << endl;

outFile << input << endl;

lineNum++;

}

/*

Function: readerMethod

Purpose: Reads each line from file

*/

void * readerMethod(void *arg)

{

ifstream inFile("file.txt");

cout << "The file is now opened!" << endl;

cout << "\nReading input file now..." << endl;

cout <<" _________________________________\n" << endl;

while(!inFile.eof())

{

getline(inFile, input);

int i;

for(i = 0; i < input.length(); i++)

{

if(i >= 63)

{

string j;

j = "";

input[i] = j[0];

}

}

symbolMethod(NULL);

uppercaseMethod(NULL);

writeMethod(NULL);

}

inFile.close();

outFile.close();

return NULL;

}

pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;

int main(int argc, char **argv)

{

int argc, char **argv

pthread_t reader, munch1, munch2, writer; //Create the four threads

pthread_mutex_lock(&mutex1);

// produces error messages when a thread cannot be created

if(pthread_create(&reader, NULL, readerMethod, Null))

{

cout << "\n!!Reader Thread could not be created!!\n;

return -1;

}

pthread_mutex_unlock(&mutex1);

else if(pthread_create(&munch1, NULL, symbolMethod, NULL))

{

cout << "\n!!Reader Thread could not be created!!\n;

return -1;

}

else if(pthread_create(&munch2, NULL, uppercaseMethod, NULL))

{

cout << "\n!!Reader Thread could not be created!!\n;

return -1;

}

else if(pthread_create(&writer, NULL, writeMethod, NULL))

{

cout << "\n!!Reader Thread could not be created!!\n;

return -1;

}

//Produces error messages when a thread cannot be joined

if(pthread_join(reader, NULL)

{

cout << "\n!!Could not join thread!!\n";

}

else if(pthread_join(munch1, NULL))

{

cout << "\n!!Could not join thread!!\n;

return -1;

}

else if(pthread_join(munch2, NULL))

{

cout << "\n!!Could not join thread!!\n;

return -1;

}

else if(pthread_join(writer, NULL))

{

cout << "\n!!Could not join thread!!\n;

return -1;

}

cout << "\nThe file contains " << lineNum-1 << "line(s) of input.\n";

cout << "----------------------------------------------------\n" << endl;

return 0;

}

Add a comment
Know the answer?
Add Answer to:
Please help me answer, the last answer was incorrect. We want to prove that 119 has...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please answer question 3 Find all (infinitely many) solutions of the system of congruence's: Use Fermata...

    Please answer question 3 Find all (infinitely many) solutions of the system of congruence's: Use Fermata little theorem to find 8^223 mod 11. (You are not allowed to use modular exponentiation.) Show that if p f a, then a^y-2 is an inverse of a modulo p. Use this observation to compute an inverse 2 modulo 7. What is the decryption function for an affine cipher if the encryption function is 13x + 17 (mod 26)? Encode and then decode the...

  • Please help me with these questions. The last I am on my last try. Constantly get...

    Please help me with these questions. The last I am on my last try. Constantly get it wrong. Thank you Your spaceship, traveling at 0.91c, needs to launch a probe out the forward hatch so that its speed relative to the planet that you are approaching is 0.94c. Part A With what speed must it leave your ship? Express your answer to two significant figures. Η ΑΣφ PS F1 ? uz с Submit Previous Answers Request Answer X Incorrect; Try...

  • Please help me with understandable solutions for question 6(a), 7, 8 and 10. ( Use Chinese...

    Please help me with understandable solutions for question 6(a), 7, 8 and 10. ( Use Chinese remainder theorem where applicable). 78 CHAPTER 5. THE CHINESE REMAINDER THEOREM 6. (a) Let m mi,m2 Then r a (mod mi), ag (mod m2) can be solved if and only if (m, m2) | a1-a2. The solution, when it exists, is unique modulo m. (b) Using part (a) prove the Chinese remainder theorem by induction. 7. There is a number. It has no remainder...

  • please help me solve all parts 5. We want to prove the proportion of athletes who...

    please help me solve all parts 5. We want to prove the proportion of athletes who use illegal drugs is less for high schools with drug testing than for high schools without drug testing. A sample of 135 athletes from high schools with drug testing gives 7 who use illegal drugs, and a random sample of 141 athletes from high schools without drug testing gives 27 who use illegal drugs. Use a = 0.05. a) (3 pts.) State the appropriate...

  • Can someone answer number 4 for me? (60 pt., 12 pt. each) Prove each of the...

    Can someone answer number 4 for me? (60 pt., 12 pt. each) Prove each of the following statements using induction. For each statement, answer the following questions. a. (2 pt.) Complete the basis step of the proof b. (2 pt.) What is the inductive hypothesis? c. (2 pt.) What do you need to show in the inductive step of the proof? d. (6 pt.) Complete the inductive step of the proof. 1. Prove that Σ(-1). 2"+1-2-1) for any nonnegative integer...

  • The last answer given for this question was incorrect, please help! Part A Estimate the smallest...

    The last answer given for this question was incorrect, please help! Part A Estimate the smallest range of speeds 0 <0, <vo you might find for a proton in the nucleus. Express your answer with the appropriate units. HA ? m = 7.01 • 106 S Submit Previous Answers Request Answer X Incorrect; Try Again; 5 attempts remaining < Return to Assignment Provide Feedback 29 AN <28 advanced - Attempt 2 Problem 28.49 A proton is confined within an atomic...

  • please help me with all question 10 p der the ring of polynomials Zaler), and let...

    please help me with all question 10 p der the ring of polynomials Zaler), and let f denoté the element 4 +1. powe raot o demote theoRegarding F as a vector splace over 7z, fin a badls for P e) (6 points) How many elements does F have? Justify your answer. ow that the quotient ring P) is a field. b) (5 points) Let a consisting of powers of o. rding F as a vector space over 72, the (5...

  • Please help me solve 3,4,5 3- For all n € N, let an = 1. Let...

    Please help me solve 3,4,5 3- For all n € N, let an = 1. Let S = {an in€ N}. 3-1) Use the fact that lim - = 0 and the result of Exercise 1 to show that 0 ES'. Ron 3-2) Use the result of Exercise 2 to show that S = {0}. 4- Prove that 4-1) N' = 0. 4-2) Q =R. 5- Recall that a set KCR is said to be compact if every open cover...

  • can someone help me , most of the answer are incorrect and its not complete ....

    can someone help me , most of the answer are incorrect and its not complete . thank you 7100 =this number is incorect . it can't be negative or positive. and the last line its totally incorrect it's not 16450 7100 for machine is incorrect . it can't be result positive or negative . i tried already . and it's incorrect accumulated Depreciation 26.000 Machine 0.000 31.000 - - Stock 12.000 + 35,000 NA - In 2020, Tower Company spent...

  • i have tried posting 5 times Already and every answer has been incorrect. Please help me...

    i have tried posting 5 times Already and every answer has been incorrect. Please help me get this right I only get one chance before it changes the question A Voltage Doubler circuit can be built by combining a clamped capacitor circuit with a peak detector circuit. Select one O True O False Check Vi ld In the diode circuit shown the value for R was chosen to set the DC bias current, ld, equal to 1.4 mA by using...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT