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 A105222 #57 Feb 16 2025 08:32:57 %S A105222 2,3,2,5,2,7,2,9,8,11,2,13,2,15,4,17,2,19,2,21,8,23,2,25,7,27,26,9,2, %T A105222 31,2,33,10,35,6,37,2,39,14,41,2,43,2,45,8,47,2,49,18,51,16,9,2,55,21, %U A105222 57,20,59,2,61,2,63,8,65,8,25,2,69,22,11,2,73,2,75,26 %N A105222 Smallest integer m > 1 such that m^(n-1) == 1 (mod n). %C A105222 Composite n are Fermat pseudoprimes to base a(n). %C A105222 For n > 1; (5+(-1)^n)/2 <= a(n) <= n+(-1)^n. If n > 2 and a(n) > 2 then n is composite. - _Thomas Ordowski_, Dec 01 2013 %H A105222 T. D. Noe, <a href="/A105222/b105222.txt">Table of n, a(n) for n = 1..10000</a> %H A105222 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/FermatPseudoprime.html">Fermat Pseudoprime</a> %H A105222 Wikipedia, <a href="http://en.wikipedia.org/wiki/Fermat_pseudoprime">Fermat pseudoprime</a> %F A105222 a(p) = 2 for odd prime p. %e A105222 We have 2^(2-1) == 0, 3^(2-1) == 1 (mod 2), so a(2) = 3. %t A105222 Table[k = 2; While[PowerMod[k, n - 1, n] != 1, k++]; k, {n, 2, 100}] (* _T. D. Noe_, Dec 07 2013 *) %o A105222 (PARI) a(n) = {m = 2; while ((m^(n-1) % n) != lift(Mod(1, n)), m++); m; } \\ _Michel Marcus_, Dec 01 2013 %o A105222 (PARI) a(n) = my(m=2); while(Mod(m, n)^(n-1)!=1, m++); m \\ _Charles R Greathouse IV_, Dec 01 2013 %Y A105222 Cf. A007535, A181780, A239452. %K A105222 easy,nonn %O A105222 1,1 %A A105222 _Max Alekseyev_, Apr 14 2005