Polite Number Calculator

Posted by Dinesh on

In mathematics, A polite number n is an integer that is the sum of two or more consecutive nonnegative integers in at least one way.

For example, 42 is a polite number since it is the sum of the integers from 3 to 9. The first few polite numbers are 3, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, etc.

Obviously all triangular numbers are polite numbers. So are all odd numbers. In fact, the numbers that are not polite are the powers of 2.

Polite numbers have also been called staircase numbers.

Polite Number Calculation

Formula:

f(n) = n + [log2(n+log2 n)]