%I #30 Jul 31 2015 20:50:47
%S 2929,137243,4769,4021227877,387497,7342733,2592842671511,22963573117,
%T 18659,120593747,13757837,17651,17149,16584420001,613024059983,407,
%U 39959,559,581831,305197,235,459207143,855782591,106709,17678421233,240055,11227
%N Least k such that n^k mod k = n-1.
%H Max Alekseyev, <a href="/A128149/b128149.txt">Table of n, a(n) for n = 3..41</a>
%H Robert G. Wilson v et al., <a href="/A128149/a128149_4.txt">Table of n, a(n) for n = 3..1000 with -1 for large entries where a(n) has not yet been found</a>.
%e a(3) = A078457(2) = 2929.
%t t = Table[0, {10000}]; f[n_] := Block[{k = 1}, While[k < 2^23 && PowerMod[n, k, k] + 1 != n, If[ Mod[k, 6] == 1, k += 4, k += 2]]; k]; Do[ If[ t[[n]] == 0, a = f@n; If[a < 2^23, t[[n]] = a; Print[{n, a}]]], {n, 10000}] (* _Robert G. Wilson v_, Aug 15 2009 *)
%Y Cf. A128150 = least k such that n^k mod k = (n-1)^2
%Y Cf. A128172 = least k such that n^k mod k = n+1.
%Y Cf. A128148, A036236, A078457, A119678, A119679, A127816, A119715, A119714, A127817, A127818, A127819, A127820, A127821.
%Y Cf. A128154, A128155, A128156, A128157, A128158, A128159, A128160, A128361, A128362, A128363, A128364, A128365, A128366, A128367, A128368, A128369, A129370, A128371, A128372.
%K hard,nonn
%O 3,1
%A _Alexander Adamchuk_, Feb 16 2007
%E a(6) = A127816(5) = 4021227877 found by _Ryan Propper_, Feb 21 2007
%E More terms from _Alexander Adamchuk_, Feb 28 2007
%E a(9), a(10) from _Hagen von Eitzen_, Jul 31 2009
%E More terms from _Robert G. Wilson v_, Aug 15 2009
%E a(30), a(35), a(39), a(45) from _Max Alekseyev_, May 12 2012