login
Numbers k such that k | 5^k + 1.
24

%I #44 Aug 11 2024 17:43:33

%S 1,2,3,9,21,26,27,63,81,147,189,243,338,441,567,609,729,903,1029,1323,

%T 1378,1701,1827,2187,2667,2709,3087,3969,4263,4394,4401,5103,5481,

%U 6321,6561,7203,8001,8127,9261,9429,11907,12789,13149,13203

%N Numbers k such that k | 5^k + 1.

%H Jinyuan Wang, <a href="/A015951/b015951.txt">Table of n, a(n) for n = 1..5000</a> (first 500 terms from Seiichi Manyama)

%t Select[Range@ 14000, Divisible[5^# + 1, #] &] (* _Michael De Vlieger_, Oct 10 2016 *)

%t Select[Range[15000],PowerMod[5,#,#]==#-1&] (* _Harvey P. Dale_, Aug 11 2024 *)

%o (PARI) isok(n) = Mod(5, n)^n == -1; \\ _Michel Marcus_, Oct 11 2016

%o (Magma) [n: n in [1..10^5] | Modexp(5, n, n)+1 eq n]; // _Jinyuan Wang_, Dec 29 2018

%o (Python)

%o for n in range(1,10**5):

%o if pow(5,n,n)+1 == n: print(n, end=', ') # _Stefano Spezia_, Dec 30 2018

%Y 5^k+m is divisible by k: A123062 (m=2), A123052 (m=3), A123047 (m=4).

%Y Column k=5 of A333429.

%K nonn

%O 1,2

%A _Robert G. Wilson v_