login
Numbers m such that m - 2 divides m^m + 2.
3

%I #45 Jun 28 2024 18:25:00

%S 3,4,7,8,67,260,379,1191,1471,5076,25807,58591,103780,134947,137347,

%T 170587,203236,272611,285391,420211,453748,538735,540856,592411,

%U 618451,680707,778807,1163067,1306936,1520443,1700947,1891336,2099203,2831011,3481960,4020031

%N Numbers m such that m - 2 divides m^m + 2.

%H Chai Wah Wu, <a href="/A249751/b249751.txt">Table of n, a(n) for n = 1..160</a>

%e 3 is in this sequence because (3^3 + 2)/(3 - 2) = 29 is an integer.

%t fQ[n_] := Mod[ PowerMod[ n, n, n - 2] + 2, n - 2] == 0; Select[ Range@ 4100000, fQ] (* _Robert G. Wilson v_, Dec 19 2014 *)

%o (Magma) [n: n in [3..10000] | Denominator((n^n+2)/(n-2)) eq 1];

%o (Python)

%o A249751_list = [n for n in range(3,10**7) if n==3 or pow(n,n,n-2) == n-4]

%o # _Chai Wah Wu_, Dec 06 2014

%Y Cf. A081762, A242787, A213382, A252041.

%K nonn

%O 1,1

%A _Juri-Stepan Gerasimov_, Dec 05 2014

%E More terms from _Chai Wah Wu_, Dec 06 2014