I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
COST (GBP)
this unit 1.40
sub units 0.00
+
0

Pentagonal Number

Calculates the pentagonal number of the given order.
Controller: CodeCogs

add cart

Interface

C++
Excel
HTML

Pentagonal Number

 
intpentagonal_numberintn )[inline]
This function computes the pentagonal number of order n. The pentagonal number P(n) counts the number of dots in a figure of n nested pentagons. The pentagonal numbers are defined for both positive and negative orders.

Example:

#include <codecogs/maths/combinatorics/sequences/pentagonal_number.h>
#include <iostream>
int main()
{
  std::cout << "Pentagonal numbers for 0 <= n < 10" << std::endl;
  for (int i = 0; i < 10; i++)
    std::cout << i << "  " << Maths::Combinatorics::Sequences::pentagonal_number(i) << std::endl;
  return 0;
}

Output:

Pentagonal numbers for 0 <= n < 10
0  0
1  1
2  5
3  12
4  22
5  35
6  51
7  70
8  92
9  117

References:

SUBSET, a C++ library of combinatorial routines, http://www.csit.fsu.edu/~burkardt/cpp_src/subset/subset.html

Parameters

nthe desired order

Returns

the value of the pentagonal number of order n

Authors

Lucian Bentea (August 2005)
Source Code

Source code is available when you buy a Commercial licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.