login
a(0)=0, a(1)=1, a(n) = (a(n-2)*a(n-1)+1) mod n.
2

%I #12 May 14 2015 21:34:00

%S 0,1,1,2,3,2,1,3,4,4,7,7,2,2,5,11,8,4,15,4,1,5,6,8,1,9,10,10,17,26,23,

%T 10,7,5,2,11,23,32,15,13,36,18,19,42,7,25,38,11,35,43,6,4,25,48,13,20,

%U 37,0,1,1,2,3,7,22,27,10,7,4,29,48,63,43,46,8

%N a(0)=0, a(1)=1, a(n) = (a(n-2)*a(n-1)+1) mod n.

%C Indices of zeros:

%C 0, 57, 123, 1975, 2551, 5473, 5537, 7271, 39480, 132993, 153539, 224581, 5925390, 10243877, 123259126, 284753964, 2520364708, 2985427716, 5115049972, 11066575675, 13451039887, 33557189081, 242574973569, 5212220671625, 10346718074797

%C Conjecture: a(n) contains infinitely many zeros.

%H Ivan Neretin, <a href="/A182457/b182457.txt">Table of n, a(n) for n = 0..10000</a>

%t Nest[Append[#, Mod[#[[-1]]*#[[-2]] + 1, Length[#] + 1]] &, {1, 1}, 71] (* _Ivan Neretin_, May 14 2015 *)

%o (Python)

%o prpr = 0

%o prev = 1

%o for n in range(2,77):

%o . current = ( prev*prpr + 1 ) % n

%o . print prpr,

%o . prpr = prev

%o . prev = current

%Y Cf. A182458.

%K nonn,easy

%O 0,4

%A _Alex Ratushnyak_, Apr 30 2012