login
A182458
a(0)=1, a(1)=2, a(n) = (a(n-2)*a(n-1)+1) mod n.
4
1, 2, 1, 0, 1, 1, 2, 3, 7, 4, 9, 4, 1, 5, 6, 1, 7, 8, 3, 6, 19, 10, 15, 13, 4, 3, 13, 13, 2, 27, 25, 25, 18, 22, 23, 17, 32, 27, 29, 4, 37, 26, 39, 26, 3, 34, 11, 46, 27, 18, 37, 4, 45, 22, 19, 34, 31, 29, 30, 45, 31, 54, 1, 55, 56, 26, 5, 64, 49, 32, 29, 6
OFFSET
0,2
COMMENTS
Indices of zeros: 3, 284, 295, 1042, 1478, 36382, 52328, 63463, 1564027, 19758967, 152380267, 503372464, 9766438965, 119068745443, 220054053597, 234739914603, 881852361961, 3491882402381, 3681101616539, 5880347601791, 7363426715439, 10328374852578.
Conjecture: a(n) contains infinitely many zeros.
a(A182472(n)) = n and a(m) <> n for m < A182472(n). [Reinhard Zumkeller, May 01 2012]
LINKS
MATHEMATICA
nxt[{n_, a_, b_}]:={n+1, b, Mod[a b+1, n+1]}; Join[{1}, Rest[NestList[nxt, {1, 2, 2}, 80][[All, 2]]]] (* Harvey P. Dale, Feb 14 2019 *)
PROG
(Python)
prpr = 1
prev = 2
for n in range(2, 77):
current = ( prev*prpr + 1 ) % n
print(prpr, end=', ')
prpr = prev
prev = current
(Haskell)
a182458 n = a182458_list !! n
a182458_list = 1 : 2 : zipWith mod
(map (+ 1) $ zipWith (*) a182458_list (tail a182458_list)) [2..]
-- Reinhard Zumkeller, May 01 2012
CROSSREFS
Cf. A182457.
Sequence in context: A269941 A035440 A029878 * A238093 A238095 A240608
KEYWORD
nonn,easy
AUTHOR
Alex Ratushnyak, Apr 30 2012
STATUS
approved