In mathematics, the Perrin numbers are an integer sequence defined by the recurrence relation

P(n) = P(n − 2) + P(n − 3) for n > 2,

with initial values

P(0) = 3, P(1) = 0, P(2) = 2.

The first few terms are

3, 0, 2, 3, 2, 5, 5, 7, 10, 12, 17, 22, 29, 39, 51, 68, 90, ... (sequence A001608 in the OEIS)

The recurrence relation is the same as for the Padovan sequence, but the initial values are different.

The sequence can be extended to negative indices using P(n) = P(n + 3) − P(n + 1)

3,−1, 1, 2,−3, 4,−2,−1, 5,−7, 6,−1,−6, 12,−13, 7, 5, ... (sequence A078712 in the OEIS).

The first fifteen prime Perrin numbers are

2, 3, 2, 5, 5, 7, 17, 29, 277, 367, 853, 14197, 43721, 1442968193, 792606555396977, ... (sequence A074788 in the OEIS),

corresponding to the indices

2, 3, 4, 5, 6, 7, 10, 12, 20, 21, 24, 34, 38, 75, 122, ... (sequence A112881 in the OEIS).

The sequence was mentioned implicitly by Édouard Lucas in 1876,[1] his ideas were further developed by Raoul Perrin in 1899.[2] The most extensive treatment was given by Adams and Shanks in 1982,[3] a sequel appearing four years later.[4]

The number of different maximal independent sets in an n-vertex cycle graph is counted by the nth Perrin number for n > 1.[5]

Properties

Spiral of equilateral triangles with side lengths equal to Perrin numbers.

The generating function of the Perrin sequence is

The Perrin numbers are obtained as integral powers n > 2 of the matrix

Binet formula

The Perrin numbers can be written in terms of powers of the roots of the equation

This equation has 3 roots; one real root p (known as the plastic ratio) and two complex conjugate roots q and r. Given these three roots, the Perrin sequence analogue of the Lucas sequence Binet formula is

Since the absolute values of the complex roots q and r are both less than 1, the powers of these roots approach 0 for large n. For large n the formula reduces to

This formula can be used to quickly calculate values of the Perrin sequence for large n. The ratio of successive Perrin numbers approaches the plastic ratio, which has a value of approximately 1.324718. This constant bears the same relationship to the Perrin numbers as the golden ratio does to the Lucas numbers.

Perrin primality test

The Perrin sequence has the Fermat property: if p is prime, P(p) ≡ P(1) ≡ 0 (mod p). However, the converse is not true: some composite n may still divide P(n). A number with this property is called a Perrin pseudoprime.

The seventeen Perrin pseudoprimes below 109 are

271441, 904631, 16532714, 24658561, 27422714, 27664033, 46672291, 102690901, 130944133, 196075949, 214038533, 517697641, 545670533, 801123451, 855073301, 903136901, 970355431, ... (sequence A013998 in the OEIS)

The question of the existence of Perrin pseudoprimes was considered by Perrin himself, but none were known until Adams and Shanks (1982) discovered the smallest one, 271441 = 5212 (the number P(271441) has 33150 decimal digits).[6] They noted that primes also satisfy the congruence P(−p) ≡ P(−1) ≡ −1 (mod p). Composites where both properties hold are called restricted Perrin pseudoprimes, of which there are nine below 109.[7] Jon Grantham has proved that there are infinitely many Perrin pseudoprimes.[8]

While Perrin pseudoprimes are rare, they overlap with Fermat pseudoprimes. Of the above, 27664033, 102690901, 130944133 and 214038533 are also base 2 Fermatians. This contrasts with the Lucas pseudoprimes which are anti-correlated. Presumably, combining the Perrin and Lucas tests would make a primality test as strong as the popular BPSW test which has no known pseudoprimes – though at greater computational cost.

Pseudocode

The 1982 Adams and Shanks O(log n) Strong Perrin primality test.[9]

Two integer arrays u(3) and v(3) are initialized to the lowest terms of the Perrin sequence, with positive indices t = 0, 1, 2 in u( ) and negative indices t = 0,−1,−2 in v( ).

The main double-and-add loop, originally devised to run on an HP-41C pocket calculator, efficiently computes P(n) mod n and the reverse P(−n) mod n.[10]

The subscripts of the Perrin numbers are doubled by using an identity that results from expanding the Binet expression P(t)2 = (pt + qt + rt)2.

The gaps between P(±2t) and P(±2t ± 2) due to the doubling step are closed by applying the defining relation P(t) = P(t − 2) + P(t − 3).

Initial values
LET u(0):= 3, u(1):= 0, u(2):= 2
LET v(0):= 3, v(1):=−1, v(2):= 1
     
INPUT integer n, the odd positive number to test
     
SET integer 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(i)^2 − 2v(i) (mod n)
    v(i):= v(i)^2 − 2u(i) (mod n)
    u(i):= temp
  ENDFOR
     
  Copy P(2t + 2) and P(−2t − 2)
  to the array ends and use
  in the IF statement below.
  u(3):= u(2)
  v(3):= v(2)
     
  Overwrite P(2t ± 2) with P(2t ± 1)
  temp:= u(2) − u(1)
  u(2):= u(0) + temp
  u(0):= temp
     
  Overwrite P(−2t ± 2) with P(−2t ± 1)
  temp:= v(0) − v(1)
  v(0):= v(2) + temp
  v(2):= temp
     
  IF n has bit k set THEN
    Increase the indices of
    both Perrin triples by 1.
    FOR i = 0, 1, 2
      u(i):= u(i + 1)
      v(i):= v(i + 1)
    ENDFOR
  ENDIF
     
ENDFOR
     
Show the results
PRINT u(0), u(1), u(2)
PRINT v(2), v(1), v(0)

Successively P(n − 1), P(n), P(n + 1) and P(−n − 1), P(−n), P(−n + 1) (mod n).

If P(n) = 0 and P(−n) = −1 then n is a strong Perrin pseudoprime.

Adams and Shanks enhanced the test by defining "acceptable signatures" comprising all six residues.[11] An even stronger test uses also the Narayana-Lucas sister sequence,[12] with recurrence relation A(n) = A(n − 1) + A(n − 3) and initial values

u(0):= 3, u(1):= 1, u(2):= 1
v(0):= 3, v(1):= 0, v(2):=−2

The same doubling rule applies and the identities for filling the gaps are

temp:= u(0) + u(1)
u(0):= u(2) − temp
u(2):= temp
     
temp:= v(2) + v(1)
v(2):= v(0) − temp
v(0):= temp

Here, n is a strong pseudoprime if A(n) = 1 and A(−n) = 0.

Shanks et al. found no overlap between the odd pseudoprimes for both sequences below 50∙109, and supposed that 2277740968903 = 1067179 ∙ 2134357 is the smallest number to pass both tests.[13]

Notes

  1. Lucas (1876, p. 62)
  2. Perrin (1899)
  3. Adams & Shanks (1982)
  4. Kurtz, Shanks & Williams (1986)
  5. Füredi (1987)
  6. Adams & Shanks (1982, p. 255)
  7. (sequence A018187 in the OEIS)
  8. Grantham (2010)
  9. Adams & Shanks (1982, p. 265, 269-270)
  10. Adams & Shanks (1982, p. 257)
  11. Adams & Shanks (1982, p. 257), (sequence A275612 in the OEIS), (sequence A275613 in the OEIS).
  12. dubbed Secundo in Kurtz, Shanks & Williams (1986, p. 697)
  13. Kurtz, Shanks & Williams (1986, p. 697)

References

This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.