Pentagonal Number
Calculates the pentagonal number of the given order.
Controller: CodeCogs
Interface
C++
Excel
Pentagonal Number
intpentagonal_number( | int | n | )[inline] |
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.htmlParameters
n the 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.