login
Order of 3 mod n-th prime.
22

%I #22 May 13 2024 09:16:07

%S 1,0,4,6,5,3,16,18,11,28,30,18,8,42,23,52,29,10,22,35,12,78,41,88,48,

%T 100,34,53,27,112,126,65,136,138,148,50,78,162,83,172,89,45,95,16,196,

%U 198,210,222,113,57,232,119,120,125,256,131,268,30,69,280,282,292,34

%N Order of 3 mod n-th prime.

%H T. D. Noe, <a href="/A062117/b062117.txt">Table of n, a(n) for n = 1..10000</a>

%e The 3rd prime is 5 and mod 5, 3^4 = 1, so a(3) = 4.

%t Table[With[{p=Prime[n]},If[p==3,0,MultiplicativeOrder[3,p]]],{n,63}] (* _Ray Chandler_, Apr 06 2016 *)

%o (GAP) A000040:=Filtered([1..350],IsPrime);;

%o List([1..Length(A000040)],n->OrderMod(3,A000040[n])); # _Muniru A Asiru_, Feb 07 2019

%o (Python)

%o from sympy import n_order, prime

%o def A062117(n): return n_order(3,prime(n)) if n != 2 else 0 # _Chai Wah Wu_, Nov 10 2023

%o (PARI) a(n,{base=3}) = my(p=prime(n)); if(base%p, znorder(Mod(base,p)), 0) \\ _Jianing Song_, May 13 2024

%Y Cf. A019334 (full reptend primes in base 3).

%Y In other bases: A014664, A082654, A211241, A211242, A211243, A211244, A211245, A002371.

%K easy,nonn

%O 1,3

%A _Olivier GĂ©rard_, Jun 06 2001