OFFSET
0,1
COMMENTS
For all prime p, a(p) mod p = p-1. The first composite p satisfying the relation is 4 (from the seed value a(4) = 11), but the second one is 14791044.
Found via automated search for linear recurrence sequences of the form a(n) = trace(M^n) generating more infrequent pseudoprimes than the Perrin numbers, A001608.
This sequence, like the Lucas and Perrin numbers, has a Binet-like formula with coefficient 1 for powers of all complex roots of the characteristic equation det(M - bI) = 0. All recurrence sequences of the form a(n) = trace(M^n) seem to have a Binet-like formula of this type. Sequences with such a formula all generate a probable-prime test: a(p) is congruent to a(1) mod p for prime p. A composite number satisfying the test is a pseudoprime for the sequence.
For coefficients in {-1, 0, 1}, this sequence has the highest first pseudoprime after the seed indices for all linear recurrences of this type over the previous 7 terms.
LINKS
Seiichi Manyama, Table of n, a(n) for n = 0..3996 (terms 0..500 from T. D. Noe)
M. McIrvin, post on Google+
K. Brown, Proof of Generalized Little Theorem of Fermat, proves the probable-prime test for sequences with Binet-like formulas of the form a(n) = sum(b_k^n), where b_k are the complex roots of the characteristic equation.
Index entries for linear recurrences with constant coefficients, signature (-1,1,-1,0,1).
FORMULA
G.f.: (-2*x^3+3*x^2-4*x-5)/(x^5-x^3+x^2-x-1). - Peter Luschny, May 22 2013
Binet-like formula: a(n) = sum(b_k^n), where b_k are the complex roots of the characteristic equation x^5 + x^4 - x^3 + x^2 - 1 = 0. - Matt McIrvin, May 24 2013
EXAMPLE
a(5) = -11 + (-7) - 3 + 5 = -16.
MAPLE
f := x -> (-2*x^3+3*x^2-4*x-5)/(x^5-x^3+x^2-x-1);
seq(coeff(series(f(x), x, n+2), x, n), n=0..34); # Peter Luschny, May 22 2013
MATHEMATICA
LinearRecurrence[{-1, 1, -1, 0, 1}, {5, -1, 3, -7, 11}, 40] (* T. D. Noe, May 22 2013 *)
PROG
(Sage)
def LinearRecurrence5(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9):
x, y, z, u, v = a0, a1, a2, a3, a4
while True:
yield x
x, y, z, u, v = y, z, u, v, a9*x+a8*y+a7*z+a6*u+a5*v
a = LinearRecurrence5(5, -1, 3, -7, 11, -1, 1, -1, 0, 1)
[next(a) for i in range(34)] # Peter Luschny, May 22 2013
(Magma) I:=[5, -1, 3, -7, 11]; [n le 5 select I[n] else Self(n-5)-Self(n-3)+Self(n-2)-Self(n-1): n in [1..40]]; // Bruno Berselli, May 22 2013
CROSSREFS
KEYWORD
sign,easy
AUTHOR
Matt McIrvin, May 22 2013
STATUS
approved