%I #19 May 11 2021 11:24:28
%S 1,9,39,111,129,159,201,249,321,471,489,519,591,681,831,849,879,921,
%T 951,1041,1119,1191,1329,1401,1569,1641,1671,1689,1761,1839,1929,1959,
%U 2031,2049,2199,2271,2319,2361,2391,2481,2559,2631,2649,2721,2841,2991,3039
%N Numbers k such that Fibonacci(k) == -2 (mod k).
%H Robert Israel, <a href="/A023163/b023163.txt">Table of n, a(n) for n = 1..1000</a>
%p fpp:= n -> mpow(n-1,n)[2,2]:
%p M:= <<0,1>|<1,1>>:
%p mpow:= proc(n,p)
%p if n = 0 then <<1,0>|<0,1>>
%p elif n::even then procname(n/2,p)^2 mod p
%p else procname((n-1)/2,p)^2 . M mod p
%p fi
%p end proc:
%p select(p -> fpp(p)+2 mod p = 0, [1, seq(i,i=3..10000,3)]); # _Robert Israel_, Feb 01 2017
%t Join[{1}, Position[Mod[Fibonacci[#], #]-#& /@ Range[10000], -2] // Flatten] (* _Jean-François Alcover_, Jun 09 2020 *)
%o (PARI) isok(k) = Mod(fibonacci(k), k) == -2; \\ _Michel Marcus_, Jun 09 2020
%Y Cf. A000045.
%K nonn
%O 1,2
%A _David W. Wilson_