Perrin Sequence

Author

Eric W. Weisstein
February 19, 2011

This notebook downloaded from http://mathworld.wolfram.com/notebooks/IntegerSequences/PerrinSequence.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/PerrinSequence.html.

©2011 Wolfram Research, Inc. except for portions noted otherwise

Initialization

PerrinLR[1;;n_]:=LinearRecurrence[{0,1,1},{0,2,3},n]
PerrinLR[n_]:=PerrinLR[1;;n][[-1]]

Perrin[n_]:=RootSum[#^3-#-1&,#^n&]
SetAttributes[Perrin,Listable]

Simple Form of Solution

Perrin[Range[10]]

Perrin/@Range[10]

Perrin[1;;10]

Recurrence

soln=RSolve[{P[n]==P[n-2]+P[n-3],P[0]==3,P[1]==0,P[2]==2},P[n],n]

FullSimplify[soln]//Timing

FullSimplify[soln/.Root[-1-#1+((#1)^3)&,n_,__] :>Subscript[r,n]]//TraditionalForm

Apart[Apart//@(((Subscript[r, 2])-(Subscript[r, 3])) (3 (Subscript[r, 2]) (Subscript[r, 3])+2) (Subscript[r, 1]^n)+3 ((Subscript[r, 2]) (Subscript[r, 3]^n)-(Subscript[r, 2]^n) (Subscript[r, 3])) (Subscript[r, 1]^2)+((3 (Subscript[r, 3]^2)-2) (Subscript[r, 2]^n)+(2-3 (Subscript[r, 2]^2)) (Subscript[r, 3]^n)) (Subscript[r, 1])-2 (Subscript[r, 2]) (Subscript[r, 3]^n)+2 (Subscript[r, 2]^n) (Subscript[r, 3]))/(((Subscript[r, 1])-(Subscript[r, 2])) ((Subscript[r, 1])-(Subscript[r, 3])) ((Subscript[r, 2])-(Subscript[r, 3])))]

p[n_]:=(2 ((r[2])^n) r[3]-2 r[2] ((r[3])^n)+((r[1])^n) (r[2]-r[3]) (2+3 r[2] r[3])+3 ((r[1])^2) (-((r[2])^n) r[3]+r[2] ((r[3])^n))+r[1] ((2-3 ((r[2])^2)) ((r[3])^n)+((r[2])^n) (-2+3 ((r[3])^2))))/((r[1]-r[2]) (r[1]-r[3]) (r[2]-r[3])) /.{r[k_]:>Root[-1-#1+((#1)^3)&,k]}

Table[RootReduce[p[i]],{i,10}]

RootReduce[p[n]-Perrin[n]]

FullSimplify[%]

Primes

Select[Perrin[Range[500]],PrimeQ]//Timing

(l=Position[Perrin[Range[10^4]],_?PrimeQ]//Flatten)//Timing

(l=Block[{$MaxExtraPrecision=10^4},10^4+Position[Round[Perrin/@Range[10^4+1,2 10^4]],_?PrimeQ]]//Flatten)//Timing

(l=Block[{$MaxExtraPrecision=10^4},2 10^4+Position[Round[Perrin/@Range[2 10^4+1,5 10^4]],_?PrimeQ]]//Flatten)//Timing

l={2,3,4,5,6,7,10,12,20,21,24,34,38,75,122,166,236,355,356,930,1042,1214,1461,1622,4430,5802,9092,16260,18926,23698,40059,45003,73807,91405,263226,316872,321874,324098,581132};

a(39) from Eric Weisstein, Feb. 15, 2011

IntegerLength/@Perrin[l]

{Length[l],IntegerLength[Perrin[Last[l]]]}

On byblis66, 2/19/2011

Do[Print[{i,l[[i]],PrimeQ[Perrin[l[[i]]]]//Timing}],{i,Length[l]}]

Limit of Ratio of Successive Terms

Limit[p[n]/p[n-1],n->∞]

FullSimplify[%]

N[%]

Limit[Perrin[n]/Perrin[n-1],n->∞]

((RootSum[-1-#1+((#1)^3)&,((#1)^n)&])/(RootSum[-1-#1+((#1)^3)&,((#1)^(-1+n))&]))/.n->800.