I have forgotten

• http://facebook.com/
• https://www.google.com/accounts/o8/id
• https://me.yahoo.com COST (GBP) 0.37 0.00 0

# Perrin Numbers List

Computes the first \e n values of a Perrin sequence.
Controller: CodeCogs   C++

## Perrin Numbers List

 std::vectorperrin_numbers_list( int n )
This function generates an array of the first n values in the Perrin sequence, given by the following recurrent formula

with initial values

A special property of this sequence is that, if n is a prime then it must evenly divide .

### Example 1

#include <codecogs/maths/combinatorics/sequences/perrin_numbers_list.h>
#include <iostream>
int main() {
std::vector<int> result = Maths::Combinatorics::Sequences::perrin_numbers_list(11);
std::cout << "Number of values: " << result.size() << std::endl;
for (int i = 0; i < result.size(); i++)
std::cout << result[i] << "  ";
std::cout << std::endl;
return 0;
}
Output:
Number of values: 11
3  0  2  3  2  5  5  7  10  12  17

## References:

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

### Returns

the Perrin numbers of orders 0 through n

### Authors

Lucian Bentea (August 2005)
##### Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

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