cp's OEIS Frontend

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.

A346988 a(n) is the smallest k > n such that n^(k-n) == 1 (mod k).

This page as a plain text file.
%I A346988 #23 Aug 28 2021 12:44:38
%S A346988 2,20737,9299,7,13,311,15,127,17,37,14,23,17,157,106,31,29,312953,45,
%T A346988 95951,41,91,33,47,28,95,35,271,35,9629,39,311,85,397,46,71,43,1793,
%U A346988 95,79,61,821,51,18881,67,103,51,12409,73,409969,65,87,65,71233,63,155,65,69,87,1962251,91,2443783,155
%N A346988 a(n) is the smallest k > n such that n^(k-n) == 1 (mod k).
%C A346988 Smallest k > n coprime to n such that n^k == n^n (mod k).
%C A346988 If a(n) is a prime p, then n^(n-1) == 1 (mod p).
%H A346988 Chai Wah Wu, <a href="/A346988/b346988.txt">Table of n, a(n) for n = 1..1000</a>
%t A346988 a[n_] := Module[{k = n + 1}, While[PowerMod[n, k - n, k] != 1, k++]; k]; Array[a, 60] (* _Amiram Eldar_, Aug 10 2021 *)
%o A346988 (PARI) a(n) = my(k=n+1); while (Mod(n, k)^(k-n) != 1, k++); k; \\ _Michel Marcus_, Aug 10 2021
%o A346988 (Python)
%o A346988 def A346988(n):
%o A346988     k, kn = n+1, 1
%o A346988     while True:
%o A346988         if pow(n,kn,k) == 1:
%o A346988             return k
%o A346988         k += 1
%o A346988         kn += 1 # _Chai Wah Wu_, Aug 28 2021
%Y A346988 Cf. A173572, A242865, A344681.
%K A346988 nonn
%O A346988 1,1
%A A346988 _Thomas Ordowski_, Aug 10 2021
%E A346988 More terms from _Amiram Eldar_, Aug 10 2021