Using the Fermat primality test, calculate how many Fermat witnesses AND how many Fermat liars there are for 341 using computer programming.
}
Copyable Code
//Include the needed headers
#include <cstring>
#include <iostream>
#include <cstdlib>
#define longlong long long
using namespace std;
//Method modulo()
longlong modulo(longlong base, longlong expo, longlong mod)
{
// Declare and initialize variables
longlong c = 1;
longlong d = base;
//Loop till the condition satisfies
while (expo > 0)
{
//Check condition
if (expo % 2 == 1)
//Compute
c
c = (c * d) %
mod;
//Compute d
d = (d * d) % mod;
//Compute exponent
expo = expo / 2;
}
//Return value
return c % mod;
}
//Method Fermat()
bool Fermat(longlong p, int noOfIterations)
{
// Declare and initialize variables
int fLiars = 0;
int fWitness = 0;
//Check condition
if (p == 1)
{
//Return
return false;
}
//Loop through noOfIterations
for (int i = 0; i < noOfIterations; i++)
{
//Declare and initialize a
longlong a = rand() % (p - 1) +
1;
//Check condition
if (modulo(a, p - 1, p) != 1)
{
//Increment
fermat liars
fLiars++;
//Display
fermat liar
cout << "
Number of Fermat lairs: " << fLiars;
//Return
return
false;
}
}
//Increment fermat witness
fWitness++;
//Display fermat witness
cout << " Number of Fermat witness: " <<
fLiars;
//Return
return true;
}
//Method main()
int main()
{
//Declare and initialize iteration
int iteration = 50;
//Declare a variable for input
longlong input;
//Prompt for input
cout << " Enter an input to test primality:
";
//Read input
cin >> input;
//Check condition
if (Fermat(input, iteration))
//Display result
cout << " " << input
<< " is prime" << endl;
//Otherwise
else
//Display result
cout << " " << input
<< " is not prime" << endl;
//Pause
getchar(); getchar();
//Return
return 0;
}
Using the Fermat primality test, calculate how many Fermat witnesses AND how many Fermat liars there...
c1-c4 answer plz C. To test the null hypothesis that computer programmers' college major is not related to their programming capabilities, the work of 100 randomly chosen programmers was rated as either weak or strong. The following crosstabulation was obtained: Programming Capability Major Weak Strong Humanities: 1212 Science: 12 24 Business: 24 16 1. If the null hypothesis is correct, how many humanities majors with strong programming capability would we expect to find in our sample? That is, what is...
we are conducting many hypothesis tests to test a claim. Approximately how many of the tests will yield significant results by chance, if the null hypothesis is true? a. 600 tests using a significance level of 5%. b. 70 tests using a significance level of 10%.
5. Consider 2n=1,5 SOO a. Using the remainder theorem for the integral test, how many terms are needed to provide an accuracy of 20 to within .001 4 pts. b. Using the n from part a, estimate the sum. (Find S). 4 pts.
Using value of 1.1×10−10 for the Ksp, calculate how many milligrams of Ag2CrO4 will dissolve in 13.5 mL of H2O?
Please Write in C programming Language For Questions below. write computer code in any programming language or mathematical software to estimate dz using the given method. Then calculate the absolute and relative errors for each. Use exact value p 0.6044 戰,omposite Trapezoidal Rule with N = 6. For Questions below. write computer code in any programming language or mathematical software to estimate dz using the given method. Then calculate the absolute and relative errors for each. Use exact value p...
How many six-symbol computer passwords can be formed using the letters A to J and the digits 2 to 5? passwords Find the number of combinations. 8C4
Please do it only when you can do it correctly, and do not just copy the wrong answer! 5. Determine the number of elements of the group (Z/1729)*. Out of these, how many are Solovay-Strassen witnesses that 1729 is composite? 5. Determine the number of elements of the group (Z/1729)*. Out of these, how many are Solovay-Strassen witnesses that 1729 is composite?
Many mutual exclusion algorithms are verified using computer programs. Briefly outline how these programs manage to verify that a certain algorithm is correct.
how do you calculate the q test for this question using the values provided? D8 112 131 132 ८) b0) 10 (05 106 106 5. Use the Q-test on the outlier in the Part B equilibrium constant results. Can that trial's result be thrown out of the data set at 90% confidence? Show this calculation even if the result is retained. If you decide to throw out a specific trial result(s) before averaging, you must state a valid reason or...
Using the balanced equation, calculate how many grams of CO2 are produced from the combustion of 30.06 g of C2H6 with 128.00 g of oxygen gas. 2 C2H6 (g) + 7 O2 (g) -> 4 CO2 (g) + 6 H2O (g) a) 176.04 g b) 88.02 g c) 44.01 g d) 100.6 g