OFFSET
1,1
COMMENTS
a(17) has 44 digits; a(18) has 114 digits; a(19) has 128 digits. -Harvey P. Dale, Aug 11 2011
LINKS
Michael De Vlieger,Table of n, a(n) for n = 1..24
Ernest G. Hibbs,Component Interactions of the Prime Numbers, Ph. D. Thesis, Capitol Technology Univ. (2022), see p. 33.
Math. Forum,Discussion
Eric Weisstein's World of Mathematics,Perrin Sequence
FORMULA
a(n+1) = a(n-1)+a(n-2) if a(n+1) is prime and a(1) = 3, a(2) = 0, a(3) = 2
EXAMPLE
a(1)=3, a(2)=0, a(3)=2; then for n = 3, a(4) = a(2) + a(1) = 0 + 3 = 3; for n = 4, a(5) = a(3) + a(2) = 2 + 0 = 2 etc
MATHEMATICA
a[1] = 3; a[2] = 0; a[3] = 2; a[n_] := a[n] = a[n - 2] + a[n - 3]; Do[ If[ PrimeQ[ a[n]], Print[ a[n]]], {n, 1, 357}]
Union[Select[LinearRecurrence[{0, 1, 1}, {3, 0, 2}, 500], PrimeQ]] (*Harvey P. Dale, Aug 11 2011 *)
PROG
(PARI) aprime(n)= a=vector(n+1); a[1]=3; a[2]=0; a[3]=2; print("n a(n+1)"); for(x=3, n, a[x+1]=a[x-1]+a[x-2]; if(isprime(a[x+1]), print("a("x+1") = "a[x+1])) )
CROSSREFS
KEYWORD
nonn
AUTHOR
Cino Hilliard, Sep 07 2002
EXTENSIONS
Edited byRobert G. Wilson v, Sep 13 2002
STATUS
approved
