This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A268466 #43 Nov 30 2023 10:20:13 %S A268466 2,3,2,5,4,7,6,9,8,11,5,13,3,9,4,17,4,19,9,21,8,5,22,25,24,3,26,9,7, %T A268466 31,6,33,10,35,6,37,9,9,8,41,10,43,6,5,8,47,46,49,18,51,4,9,13,55,12, %U A268466 9,20,7,29,61,15,35,8,65,8,25,22,69,22,51,5,73,18,9,26,9,12,79,24,81 %N A268466 Smallest m > 1 such that m^m == 1 (mod n). %C A268466 For n > 1, a(n) <= n + (-1)^n = A065190(n). %C A268466 Conjecture: a(n) = n + (-1)^n for infinitely many n. %C A268466 If A002322(n) is coprime to n, then a(n) <= A002322(n). %C A268466 From _Robert Israel_, Feb 05 2016: (Start) %C A268466 For m > 1, a(n) = m iff n is a divisor of m^m - 1 that is not a divisor of k^k - 1 for 1 < k < m. %C A268466 In particular, a(m^m - 1) = m. %C A268466 Is there any m such that this is the only n for which a(n) = m? (End) %C A268466 If n > m^m - 1, then a(n) > m. - _Thomas Ordowski_, Oct 20 2019 %H A268466 Robert Israel, <a href="/A268466/b268466.txt">Table of n, a(n) for n = 1..10000</a> %p A268466 f:= proc(n) local k; %p A268466 for k from 2 do if igcd(k,n) = 1 and k &^ k mod n = 1 then return k fi od %p A268466 end proc: %p A268466 2,seq(f(n),n=2..100); # _Robert Israel_, Feb 05 2016 %t A268466 {2}~Join~Table[SelectFirst[Range[2, 1000], Mod[#^#, n] == 1 &], {n, 2, 80}] (* _Michael De Vlieger_, Feb 05 2016, corrected by _Harvey P. Dale_, Sep 10 2021 *) %t A268466 smg1[n_]:=Module[{m=2},While[PowerMod[m,m,n]!=1,m++];m]; Join[{2},Array[ smg1,80,2]] (* _Harvey P. Dale_, Aug 13 2021 *) %o A268466 (PARI) a(n) = {my(m = 2); while (Mod(m,n)^m != Mod(1, n), m++); m;} \\ _Michel Marcus_, Feb 05 2016 %Y A268466 Cf. A065190. %K A268466 nonn %O A268466 1,1 %A A268466 _Thomas Ordowski_, Feb 05 2016 %E A268466 More terms from _Michel Marcus_, Feb 05 2016