Question

Find the smallest strong pseudoprime to the base 3 in the interval [700, 800]. Kindly show...

Find the smallest strong pseudoprime to the base 3 in the interval [700, 800]. Kindly show all trials without using any programming language code.

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

code in cpp:


#include <bits/stdc++.h>
using namespace std;

// Function to check if the given number is composite
bool checkcomposite(int n)
{
   // Check if there is any divisor of n less than sqrt(n)
   for (int i = 2; i <= sqrt(n); i++) {
       if (n % i == 0)
           return 1;
   }
   return 0;
}

// Effectively calculate (x^y) modulo mod
int power(int x, int y, int mod)
{

   // Initialize result
   int res = 1;

   while (y) {

       // If power is odd, then update the answer
       if ((y %2)== 1)
           res = (res * x) % mod;

       // Square the number and reduce
       // the power to its half
       y = y >> 1;
       x = (x * x) % mod;
   }

   // Return the result
   return res;
}

// Function to check for Fermat(strong) Pseudoprime
bool Check(int n, int a)
{

   // If it is composite and satisfy Fermat criterion
   if (a>1 && checkcomposite(n) && power(a, n - 1, n) == 1)
       return 1;

   // Else return 0
   return 0;
}


int main()
{

   int a=3;//to the base which we want to find
  
// Function call
   for(int i=700;i<=800;i++){
       if(Check(i, a)){
           cout<<i<<endl;
           break;
       }
   }
  

output:-

703

   return 0;
}

Add a comment
Know the answer?
Add Answer to:
Find the smallest strong pseudoprime to the base 3 in the interval [700, 800]. Kindly show...
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
  • OS X 3). Kindly draw the graph of each function. ). Find and show the x...

    OS X 3). Kindly draw the graph of each function. ). Find and show the x and y intercepts. Find and show all asymptotes, if they exest a). fox) =-3x+q b). 3®) = (x-3/x+2) x²+3x-10 x-1 d). før) = 3 /09(x+4)–1 e). M(x) = -4 sin(3x-7)+ 7 (one c). h) = period

  • Hello, please kindly show all your steps without skipping any part. Please also cite any defintions...

    Hello, please kindly show all your steps without skipping any part. Please also cite any defintions if necessary generously to help me understand this question. Thanks in advance. 4) [3 marks) Recall that in Question 2a from Assignment 6, you proved that H = {{0), (4), (8]} is a subgroup of Zi2. Write out all of the distinct cosets of H in Z12. Determine (Z12: H).

  • 3) Solve the following Economic Dispatch problem using Dynamic Programming to find total minimum ...

    3) Solve the following Economic Dispatch problem using Dynamic Programming to find total minimum cost and P, P2, Ps, for load 300 MW? (25 points) 0 50 75 100 125 800 850 975 1000 1000 1250 1400 500 600 700 3) Solve the following Economic Dispatch problem using Dynamic Programming to find total minimum cost and P, P2, Ps, for load 300 MW? (25 points) 0 50 75 100 125 800 850 975 1000 1000 1250 1400 500 600 700

  • (3) Assuming that any strong base encountered in the following selections is completely soluble, which of...

    (3) Assuming that any strong base encountered in the following selections is completely soluble, which of these are buffers, possibly after reaction? (1) 2.00 mmoL HI3 4.00 mmoL NH3 (2) 5.00 mmol NaHSO3 /4.00 mmol Li2SO3 (3) 3.00 mmoL HNO3 4.00 mmoL NH3 (4) 2.00 mmol Ca(OH)2 / 4.00 mmoL HNO2 (a) 3 only (b) 1,4 (c) all except 4 (d) 2,3 (c) all are buffers (1) 1,4

  • Please show steps with explanations 3. Find the smallest positive integer k such that 1222+32++ n2...

    Please show steps with explanations 3. Find the smallest positive integer k such that 1222+32++ n2 is big-O of nk. Explain.

  • Question 2 (1 point) For the following equation,find all solutions exactly on the interval 0 0<360°...

    Question 2 (1 point) For the following equation,find all solutions exactly on the interval 0 0<360° 6sin(0) 3V2 Enter your answers in degrees without units or other marks; place the smaller angle in blank #1 and the larger angle in blank #2. Blank # 1 Blank # 2 Question 3 (1 point) Determine the smallest positive angle that satisfies the following equation. 3 sec(a) 8 Enter your answer in radians, using pi to denote π

  • For each of the following strong base solutions, determine [OH−],[H3O+], pH, and pOH. A.) 8.61x10-3 M...

    For each of the following strong base solutions, determine [OH−],[H3O+], pH, and pOH. A.) 8.61x10-3 M LiOH Express your answer to three decimal places. Enter your answers numerically separated by commas. [OH−],[H3O+] = 8.61x10-3,1.16x10-12 (this is what I got and it said it was correct) pH ,pOH = ? B.) 1.7×10−4 M KOH Express your answer using two significant figures. Enter your answers numerically separated by commas. [OH−],[H3O+] = ?          pH, pOH = ? C.) 5.3×10−4 M Ca(OH)2 Express...

  • could you kindly help me with exercise 9K all questions ? expression on each side of...

    could you kindly help me with exercise 9K all questions ? expression on each side of the equation the argument of a Make the expressie carithm with baseb. los al = log, yog, a = log, log, logx bringing the power down on the left-hand side) (dividing both sides by log,a ) Therefore, log. x e when a, b, x > 0. log x= where a, b, x>0. log, Example 13 Functions Find the value of log, 20 to 3...

  • Problem: Write program with GUI in at least two programming languages for the following number guessing game. All students should use different languages.

    Any language you wantProblem: Write program with GUI in at least two programming languages for the following number guessing game. All students should use different languages.To guess the number chosen by the player How to play:Show the six cards to the player and ask him to pick any number that is included in at least one card, without revealing the number2. Ask the player to point out which cards contain the chosen number3. Take the chosen cards and add the numbers in the...

  • 100 300 400 200 A>G 800 500 AGGUA 600 exon 1 Hexon 2 exon 3 700...

    100 300 400 200 A>G 800 500 AGGUA 600 exon 1 Hexon 2 exon 3 700 exon 4 CAG UGA AUG UAA AAAAA Lane: 1 2 3 Lane: 1 2 3 4 5 4 5 approx. size (bp) -900 approx. size (Da) -12,000 -11,000 -800 -700 - 10,000 -600 -9000 -500 -8000 -7000 -400 -300 -6000 Northern Blot Western Blot (fig56) At the top of the figure above is a gene diagram for a hypothetical gene, noting the length of...

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