Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function that given a number determines if the number is near prime. To understand what is near prime let us first understand what

Write a function that given a number determines if the number is near prime. To understand what is near prime let us first understand what a prime number is.

A number is prime is it is only divisible by 1 and itself. 2,5,13,23 are examples of prime numbers. 4,22,100,60 are examples of numbers which are not prime numbers. Consider a number such as 49. It is not a prime number because it is divisible by 7. However, it is not divisible by anything else apart from 1, 7 and 49.

We call a number near prime if it is divisible by 1, itself and at most 2 other numbers. To illustrate: 49 is near prime as only 1,7 and 49 divide it. 22 is near prime as only 1,2,11,22 divide it. 4 is near prime as only 1,2,4 divide it. 60 is not near prime as 1,2,3,5,6,10,12,20,30,60 divide it. 17 is near prime as only 1,17 divide it 20 is not near prime as 1,2,4,5,10,20 divide it.

Write a function which determines if a number is near prime or not. Your function should take in a number and return yes or no depending if its a near prime or not.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Sham Navathe,Ramez Elmasri

5th Edition

B01FGJTE0Q, 978-0805317558

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago