# Pronic number in Python

Hi Pythoneers, In this tutorial, we will learn how to check if a number is a pronic number or not in Python.

How many of you know what is a **Pronic** number?

According to *Wikipedia*,

A

pronic numberis anumberwhich is the product of two consecutive integers, that is, anumberof the form n(n + 1).

Pronic numbers are also known as *oblong* or *heteromecic* numbers.

In this tutorial, we will find out whether a given number is a Pronic number or not in Python.

## Python Program to check pronic number

n = int(input("Enter a number: ")) f = 0 for i in range(n): if i * (i + 1) == n: f = 1 break if f==1: print("Pronic number") else: print("Not a Pronic number")

Some examples of Pronic number are 0, 2, 6, 12, 20, 30, 42, 56, 72, 90, 110, 132, 156, 182, 210, 240, 272, 306, 342, 380, 420, 462 .

The above code will produce the following output:

Enter a number: 3 Not a Pronic number

Enter a number: 20 Pronic number

So here it is. A very simple program to check whether a given number is Pronic or not.

### Some facts about Pronic numbers

The nth Pronic number is the sum of the first n even integers.

- All Pronic numbers are even
- 2 is the only prime Pronic number.
- The sum of the reciprocals of Pronic numbers is 1.

You may also read,

A simple Candy Machine in Python

## Leave a Reply