OFFSET
0,3
COMMENTS
a(21) = 2992285359..7163788371 has 5090 decimal digits.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..20
MAPLE
b:= proc(n) local r, M, p; r, M, p:=
<<1|0>, <0|1>>, <<0|1>, <1|1>>, n;
do if irem(p, 2, 'p')=1 then r:=
`if`(nargs=1, r.M, r.M mod args[2]) fi;
if p=0 then break fi; M:=
`if`(nargs=1, M.M, M.M mod args[2])
od; (r.<<2, 1>>)[1$2]
end:
a:= n-> (h-> b(h$2) mod h)(b(b(n))):
seq(a(n), n=0..15);
PROG
(Python)
from sympy import lucas
def A338889(n):
a, b, c, d, a2, b2, c2, d2, m = 1, 1, 1, 0, 1, 0, 0, 1, int(lucas(lucas(n)))
for x in bin(m-1)[2:]:
e, f = b2*c2%m, a2+d2
a2, b2, c2, d2 = (pow(a2, 2, m)+e)%m, b2*f%m, c2*f%m, (pow(d2, 2, m)+e)%m
if x=='1':
a2, b2, c2, d2 = (a2*a+b2*c)%m, (a2*b+b2*d)%m, (c2*a+d2*c)%m, (c2*b+d2*d)%m
return (a2+(b2<<1))%m # Chai Wah Wu, Jul 01 2026
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Nov 14 2020
STATUS
approved
