login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

a(n) = (p-1)/x, where p = prime(n) and x = ord(3,p), the smallest positive integer such that 3^x == 1 mod p.
9

%I #17 Jan 16 2020 01:00:46

%S 1,1,2,4,1,1,2,1,1,2,5,1,2,1,2,6,3,2,6,1,2,1,2,1,3,2,4,1,1,2,1,1,1,3,

%T 2,1,2,1,2,4,2,12,1,1,1,1,2,4,1,2,2,2,1,2,1,9,4,1,1,1,9,2,8,1,1,2,2,2,

%U 1,2,3,2,1,2,1,2,1,2,2,4,10,16,3,2,1,2

%N a(n) = (p-1)/x, where p = prime(n) and x = ord(3,p), the smallest positive integer such that 3^x == 1 mod p.

%H T. D. Noe, <a href="/A094593/b094593.txt">Table of n, a(n) for n = 3..1000</a>

%F a(n) = (A000040(n)-1)/A062117(n).

%o (PARI) a(n)=(prime(n)-1)/if(n<0,0,k=1;while((3^k-1)%prime(n)>0,k++);k)

%o (Python)

%o from sympy import prime, n_order

%o def A094593(n):

%o p = prime(n)

%o return 1 if n == 3 else (p-1)//n_order(3,p) # _Chai Wah Wu_, Jan 15 2020

%Y Cf. A001917.

%K nonn

%O 3,3

%A _Benoit Cloitre_, Jun 06 2004