it by induction and what is the H

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

This is the algorithm to check whether a number is Prine or not

def isPrime(n):
    for i in range(2,int(n**1/2)+1):
        if n%i==0:
            return False
    return True

How I can prove it by induction and what is the Hypothesis?

What is your Hypothesis?
Edit this cell to insert your statement
Your Induction
To submit your proof here, you have multiple options as follows:
• Write your proof here in the notebook using LaTeX [Preferred]
• Write your proof in any other application, any word processing application, and take a screenshot of your proof; then, put it here as an image
Write your proof by hand, and take a photo of your solution and put it here as an image [least preferred]
Make sure your write is clear enough; we would not return to ask for a clarification.
[write your proof here]
Transcribed Image Text:What is your Hypothesis? Edit this cell to insert your statement Your Induction To submit your proof here, you have multiple options as follows: • Write your proof here in the notebook using LaTeX [Preferred] • Write your proof in any other application, any word processing application, and take a screenshot of your proof; then, put it here as an image Write your proof by hand, and take a photo of your solution and put it here as an image [least preferred] Make sure your write is clear enough; we would not return to ask for a clarification. [write your proof here]
Problem Statement
In tasks 1, you wrote an algorithm to check whether a number is prime or not. Prove that your algorithm is actually correct.
In [ ]: # write your implementation from Task 1 here
def isPrime(n):
checks whether the positive integer n, which is at least 2, is prime or not
It takes
n: represnts the integer value to be checked
It should return
[-1 true or false
In [ ]: # use some inputs to empirically test your algorithm
isPrime(11)
Proof
What is your Hypothesis?
Transcribed Image Text:Problem Statement In tasks 1, you wrote an algorithm to check whether a number is prime or not. Prove that your algorithm is actually correct. In [ ]: # write your implementation from Task 1 here def isPrime(n): checks whether the positive integer n, which is at least 2, is prime or not It takes n: represnts the integer value to be checked It should return [-1 true or false In [ ]: # use some inputs to empirically test your algorithm isPrime(11) Proof What is your Hypothesis?
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Counting Problems
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education