OFFSET
1,4
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = A007570(n) mod n.
MAPLE
F:= n-> (<<0|1>, <1|1>>^n)[1, 2]:
p:= (M, n, k)-> map(x-> x mod k, `if`(n=0, <<1|0>, <0|1>>,
`if`(n::even, p(M, n/2, k)^2, p(M, n-1, k).M))):
a:= n-> p(<<0|1>, <1|1>>, F(n), n)[1, 2]:
seq(a(n), n=1..80);
MATHEMATICA
F[n_] := MatrixPower[{{0, 1}, {1, 1}}, n][[1, 2]];
p[M_, n_, k_] := Mod[#, k]& /@ If[n == 0, {{1, 0}, {0, 1}}, If[EvenQ[n], MatrixPower[p[M, n/2, k], 2], p[M, n - 1, k].M]];
a[n_] := p[{{0, 1}, {1, 1}}, F[n], n][[1, 2]];
Table[a[n], {n, 1, 80}] (* Jean-François Alcover, Oct 29 2024, after Alois P. Heinz *)
CROSSREFS
KEYWORD
AUTHOR
Alois P. Heinz, Oct 09 2015
STATUS
approved