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.

A372799 Smallest prime p such that the multiplicative order of 9 modulo p is 2*n, or 0 if no such prime exists.

This page as a plain text file.
%I A372799 #18 Mar 29 2025 20:06:29
%S A372799 5,13,67,313,41,61,883,433,271,2161,683,193,1223,8317,2131,769,2551,
%T A372799 1621,8513,2521,8779,4357,5843,3889,7451,16069,3079,19993,14327,661,
%U A372799 23747,95617,42703,2857,15401,17209,2887,7297,547,13441,4019,757,41453,29833,54631,31741,20399
%N A372799 Smallest prime p such that the multiplicative order of 9 modulo p is 2*n, or 0 if no such prime exists.
%C A372799 First prime p such that the expansion of 1/p has period (p-1)/(2*n) in base 9. Also the first prime p such that {k/p : 1 <= k <= p-1} has 2*n different cycles when written out in base 9.
%C A372799 Since ord(a^m,k) = ord(a,k)/gcd(m,ord(a,k)) for gcd(a,k) = 1, we have that (p-1)/ord(9,p) = ((p-1)/ord(3,p)) * gcd(2,ord(3,p)) is always even. Here ord(a,k) is the multiplicative order of a modulo k.
%H A372799 Jean-François Alcover, <a href="/A372799/b372799.txt">Table of n, a(n) for n = 1..1000</a>
%e A372799 In the following examples let () denote the reptend. The prime numbers themselves and the fractions are written out in decimal.
%e A372799 The base-9 expansion of 1/5 is 0.(17), so the reptend has length 2 = (5-1)/2. Also, the base-9 expansions of 1/5 = 0.(17), 2/5 = (0.35), 3/5 = 0.(53) and 4/5 = 0.(71) have two cycles 17 and 35. 5 is the smallest such prime, so a(1) = 5.
%e A372799 The base-9 expansion of 1/13 is 0.(062), so the reptend has length 3 = (13-1)/4. Also, the base-9 expansions of 1/13, 2/13, ..., 12/13 have four cycles 062, 134, 268 and 475. 13 is the smallest such prime, so a(2) = 13.
%e A372799 The base-9 expansion of 1/67 is 0.(01178285332), so the reptend has length 11 = (67-1)/6. Also, the base-9 expansions of 1/67, 2/67, ..., 66/67 have six cycles 01178285332, 02367581664, 03556877106, 04746273438, 07224865213 and 08414261545. 67 is the smallest such prime, so a(3) = 67.
%t A372799 a[n_] := a[n] = For[p = 2, True, p = NextPrime[p], If[MultiplicativeOrder[9, p] == (p-1)/(2n), Return[p]]];
%t A372799 Table[Print[n, " ", a[n]]; a[n], {n, 1, 100}] (* _Jean-François Alcover_, Nov 24 2024 *)
%o A372799 (PARI) a(n,{base=9}) = forprime(p=2, oo, if((base%p) && znorder(Mod(base,p)) == (p-1)/(n * if(issquare(base), 2, 1)), return(p)))
%Y A372799 Cf. A211245, A364867.
%Y A372799 In other bases: A101208, A101209, A372797, A372798, A054471, A372800.
%K A372799 nonn
%O A372799 1,1
%A A372799 _Jianing Song_, May 13 2024