OFFSET
1,2
COMMENTS
This sequence is the same as the period of Fibonacci 5-step sequence (A106304) mod prime(n) except for n=1 and 109, which correspond to the primes 2 and 599 because 9584 is the discriminant of the characteristic polynomial x^5-x^4-x^3-x^2-x-1 and the prime factors of 9584 are 2 and 599. We have a(n) < prime(n) for the primes 2, 599 and A106281.
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..82
Eric Weisstein's World of Mathematics, Fibonacci n-Step Number.
FORMULA
a(n) = A106297(prime(n)).
MATHEMATICA
n=5; Table[p=Prime[i]; a=Join[Table[ -1, {n-1}], {n}]; a=Mod[a, p]; a0=a; k=0; While[k++; s=Mod[Plus@@a, p]; a=RotateLeft[a]; a[[n]]=s; a!=a0]; k, {i, 40}]
PROG
(Python)
from itertools import count
from sympy import prime
def A106298(n):
a = b = (5%(p:=prime(n)), 1%p, 7%p, 3%p, 15%p)
s = sum(b) % p
for m in count(1):
b, s = b[1:] + (s, ), (s+s-b[0]) % p
if a == b:
return m # Chai Wah Wu, Feb 22-27 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
T. D. Noe, May 02 2005
EXTENSIONS
a(31)-a(33) from Chai Wah Wu, Feb 27 2022
STATUS
approved