Perrin number


In mathematics, the Perrin numbers are a doubly infinite constant-recursive integer sequence with characteristic equation. The Perrin numbers, named after the French engineer, bear the same relationship to the Padovan sequence as the Lucas numbers do to the Fibonacci sequence.

Definition

The Perrin numbers are defined by the recurrence relation
and the reverse
The first few terms in both directions are
n01234567891011121314151617
P30232557101217222939516890119...
...−112−34−2−15−76−1−612−1375−18...

Perrin numbers can be expressed as sums of the three initial terms
The first fourteen prime Perrin numbers are
n2345671012202124343875...
P232557172927736785314197437211442968193...

History

In 1876 the sequence and its equation were initially mentioned by Édouard Lucas, who noted that the index n divides term if n is prime. In 1899 asked if there were any counterexamples to this property. The first divisible by composite index n was found only in 1982 by William Adams and Daniel Shanks. They presented a detailed investigation of the sequence, with a sequel appearing four years later.

Properties

The Perrin sequence also satisfies the recurrence relation Starting from this and the defining recurrence, one can create an infinite number of further relations, for example
The generating function of the Perrin sequence is
The sequence is related to sums of binomial coefficients by
Perrin numbers can be expressed in terms of partial sums
The Perrin numbers are obtained as integral powers of the matrix
and its inverse
The Perrin analogue of the Simson identity for Fibonacci numbers is given by the determinant
The number of different maximal independent sets in an n-vertex cycle graph is counted by the nth Perrin number for.

Binet formula

The solution of the recurrence can be written in terms of the roots of characteristic equation. If the three solutions are real root and complex conjugate roots and, the Perrin numbers can be computed with the Binet formula which also holds for negative n.
The polar form is with Since the formula reduces to either the first or the second term successively for large positive or negative n, and numbers with negative subscripts oscillate. Provided α is computed to sufficient precision, these formulas can be used to calculate Perrin numbers for large n.
Expanding the identity gives the important index-doubling rule by which the forward and reverse parts of the sequence are linked.

Prime index ''p'' divides ''P(p)''

If the characteristic equation of the sequence is written as then the coefficients can be expressed in terms of roots with Vieta's formulas:
These integer valued functions are the elementary symmetric polynomials in
Given integers and
Rearrange into symmetric monomial summands, permuting exponents
Substitute prime for power and complex roots for integers and compute representations in terms of for all symmetric polynomial functions. For example, is and the power sum can be expressed in the coefficients with Newton's recursive scheme. It follows that the identity has integer terms and both sides divisible by prime
To show that prime divides in the reverse sequence, the characteristic equation has to be reflected. The roots are then the coefficients and the same reasoning applies.

Perrin primality test


Query 1484. The curious proposition of Chinese origin which is the subject of query 1401 would provide, if it is true, a more practical criterium than Wilson's theorem for verifying whether a given number is prime or not; it would suffice to calculate the residues with respect to of successive terms of the recurrence sequence with initial values

I have found another recurrence sequence that seems to possess the same property; it is the one whose general term is with initial values It is easy to demonstrate that is divisible by, if is prime; I have verified, up to fairly high values of, that in the opposite case it is not; but it would be interesting to know if this is really so, especially since the sequence gives much less rapidly increasing numbers than the sequence , which leads to simpler calculations when is a large number.

The same proof, applicable to one of the sequences, will undoubtedly bear upon the other, if the stated property is true for both: it is only a matter of discovering it.

The Perrin sequence has the Fermat property: if is prime, However, the converse is not true: some composite may still divide A number with this property is called a Perrin pseudoprime.
The question of the existence of Perrin pseudoprimes was considered by Malo and Jarden, but none were known until Adams and Shanks found the smallest one, . Jon Grantham later proved that there are infinitely many Perrin pseudoprimes.
The seventeen Perrin pseudoprimes below are
271441, 904631, 16532714, 24658561, 27422714, 27664033, 46672291, 102690901, 130944133, 196075949, 214038533, 517697641, 545670533, 801123451, 855073301, 903136901, 970355431.
Adams and Shanks noted that primes also satisfy the congruence Composites for which both properties hold are called restricted Perrin pseudoprimes. There are only nine such numbers below.
While Perrin pseudoprimes are rare, they overlap with Fermat pseudoprimes. Of the above seventeen numbers, four are base Fermatians as well. In contrast, the Lucas pseudoprimes are anti-correlated. Presumably, combining the Perrin and Lucas tests should make a primality test as strong as the reliable BPSW test which has no known pseudoprimes – though at higher computational cost.

Pseudocode

The 1982 Adams and Shanks Perrin primality test.
Two integer arrays u and v are initialized to the lowest terms of the Perrin sequence, with positive indices in u and negative indices in v.
The main double-and-add loop, originally devised to run on an HP-41C pocket calculator, computes and the reverse at the cost of six modular squarings for each bit of.
The subscripts of the Perrin numbers are doubled using the identity. The resulting gaps between and are closed by applying the defining relation.
Initial values
let int u:= 3, u:= 0,
let int v:= 3, v:=−1,

Test odd positive number n
input int n

set int h:= most significant bit of n

for k:= h − 1 downto 0

Double the indices of
the six Perrin numbers.
for i = 0, 1, 2
temp:= u^2 − 2v
v:= v^2 − 2u
u:= temp
endfor

Copy P and
to the array ends and use
in the if-statement below.
u:= u
v:= v

Overwrite P with
temp:= u − u
u:= u + temp
u:= temp

Overwrite P with
temp:= v − v
v:= v + temp
v:= temp

if n has bit k set then
Increase the indices of
both Perrin triples by 1.
for i = 0, 1, 2
u:= u
v:= v
endfor
endif

endfor

Result
print v, v, v
print u, u, u
Successively and.
If and then n is a probable prime, that is: actually prime or a restricted Perrin pseudoprime.
Shanks et al. observed that for all restricted pseudoprimes they found, the final state of the above six registers equals the initial state 1,−1,3, 3,0,2. The same occurs with of all primes, so the two sets cannot be distinguished on the strength of this test alone. For those cases, they recommend to also use the Narayana-Lucas sister sequence with recurrence relation and initial values
u:= 3, u:= 1, u:= 1
v:= 3, v:= 0, v:=−2
The same doubling rule applies and the formulas for filling the gaps are
temp:= u + u
u:= u − temp
u:= temp

temp:= v + v
v:= v − temp
v:= temp
Here, n is a probable prime if and.
Kurtz et al. found no overlap between the odd pseudoprimes for the two sequences below and supposed that 2,277,740,968,903 = 1067179 ∙ 2134357 is the smallest composite number to pass both tests.
If the third-order Pell-Lucas recurrence is used as well, this bound will be pushed up to 4,057,052,731,496,380,171 = 1424263447 ∙ 2848526893.
Additionally, roots of the doubling rule-congruence other than or expose composite numbers, like non-trivial square roots of in the Miller-Rabin test. This reduces the number of restricted pseudoprimes for each sequence by roughly one-third and is especially efficient in detecting Carmichael numbers.
The least strong restricted Perrin pseudoprime is 46672291 and the above two bounds expand to successively 173,536,465,910,671 and 79,720,990,309,209,574,421.