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.

A202036 Smallest prime residue of x^n (mod n) for x=0..n-1, or 0 if no such prime exists.

This page as a plain text file.
%I A202036 #14 May 01 2023 19:46:59
%S A202036 0,0,2,0,2,3,2,0,0,5,2,0,2,2,2,0,2,0,2,5,7,3,2,0,7,3,0,0,2,19,2,0,2,2,
%T A202036 2,0,2,5,5,0,2,7,2,5,17,2,2,0,19,0,2,13,2,0,11,0,7,5,2,0,2,2,0,0,2,3,
%U A202036 2,13,2,11,2,0,2,3,7,5,2,13,2,0,0,2,2,0
%N A202036 Smallest prime residue of x^n (mod n) for x=0..n-1, or 0 if no such prime exists.
%H A202036 Antti Karttunen, <a href="/A202036/b202036.txt">Table of n, a(n) for n = 1..16384</a>
%H A202036 Antti Karttunen, <a href="/A202036/a202036.txt">Data supplement: n, a(n) computed for n = 1..65537</a>
%e A202036 a(7) = 2 because k^7 == 0, 1, 2, 3, 4, 5, 6 (mod 7) => 2 is the smallest prime.
%p A202036 for n from 1 to 100 do: W:={}:for k from 0 to n-1 do:z:= irem(k^n,n): if type(z,prime)=true then W:=W union {z}:else fi:od: x:=nops(W): if x<>0 then printf(`%d, `,W[1]): else printf(`%d, `,0):fi: od:
%t A202036 Table[SelectFirst[Sort[PowerMod[Range[n-1],n,n]],PrimeQ],{n,90}]/.Missing["NotFound"]->0 (* _Harvey P. Dale_, May 01 2023 *)
%o A202036 (PARI) A202036(n) = { my(z,y=n); for(x=1,n-1,z = lift(Mod(x,n)^n); if(isprime(z), y = min(z,y))); if(y==n,0,y); }; \\ - _Antti Karttunen_, May 19 2021
%Y A202036 Cf. A195812, A196082, A202034, A202035.
%K A202036 nonn
%O A202036 1,3
%A A202036 _Michel Lagneau_, Dec 09 2011