Pronic Numbers Challenge

A pronic number is a number which is the product of two consecutive integers.

For instance 42 is a pronic number because 42 = 6 x 7.

One appraoch to work out if a number n is a pronic number or not is to find out if there is a positive integer i lower than n that solve this equation: n = i(i+1).

If there is such a number i, then n is a pronic number.

Did you know?

Pronic numbers are also called oblong numbers or heteromecic numbers.

Python Challenge

Your task is to write new function called isPronic that takes one parameter, an integer value and returns True is the parameter is a pronic number, False otherwise.

You should then write a small program that will:

     Prompt the user to enter a number.
     Use the isPronic function to find out is the number entered is pronic or not.
     Produce a meaningful output to the end-user.

Extra Challenge

Reuse your function to write a new Python program that outputs all the pronic numbers between 0 and 1,000!

Python Code

unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Did you like this challenge?

Click on a star to rate it!

Average rating 3.9 / 5. Vote count: 9

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!