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”).

A372800
Smallest prime p such that the multiplicative order of 16 modulo p is 2*n, or 0 if no such prime exists.
4
3, 5, 31, 17, 151, 109, 631, 113, 127, 1181, 331, 433, 13963, 1709, 3331, 1217, 2687, 397, 1103, 241, 2143, 1013, 18539, 1777, 2351, 4421, 2971, 673, 3191, 3061, 683, 257, 58147, 1429, 38431, 1657, 11471, 22573, 49999, 3121, 17467, 33013, 252583, 1321, 23671, 51797, 26227, 4513
OFFSET
1,1
COMMENTS
First prime p such that the expansion of 1/p has period (p-1)/(2*n) in base 16. Also the first prime p such that {k/p : 1 <= k <= p-1} has 2*n different cycles when written out in base 16.
Since ord(a^m,k) = ord(a,k)/gcd(m,ord(a,k)) for gcd(a,k) = 1, we have that (p-1)/ord(16,p) = ((p-1)/ord(2,p)) * gcd(4,ord(2,p)) is always even. Here ord(a,k) is the multiplicative order of a modulo k.
LINKS
Jean-François Alcover, Table of n, a(n) for n = 1..1000
EXAMPLE
In the following examples let () denote the reptend. The prime numbers themselves and the fractions are written out in decimal.
The base-16 expansion of 1/3 is 0.(5), so the reptend has length 1 = (3-1)/2. Also, the base-16 expansions of 1/3 = 0.(5) and 2/3 = 0.(A) have two cycles 5 and A. 3 is the smallest such prime, so a(1) = 3.
The base-16 expansion of 1/5 is 0.(3), so the reptend has length 1 = (5-1)/4. Also, the base-16 expansions of 1/5 = 0.(3), 2/5 = (0.6), 3/5 = 0.(9) and 4/5 = 0.(C) have four cycles 3, 6, 9 and A. 5 is the smallest such prime, so a(2) = 5.
The base-16 expansion of 1/31 is 0.(08421), so the reptend has length 5 = (31-1)/6. Also, the base-16 expansions of 1/31, 2/31, ..., 30/31 have six cycles 08421, 18C63, 294A5, 39CE7, 5AD6B and 7BDEF. 31 is the smallest such prime, so a(3) = 31.
MATHEMATICA
a[n_] := a[n] = For[p = 2, True, p = NextPrime[p], If[MultiplicativeOrder[16, p] == (p-1)/(2n), Return[p]]];
Table[Print[n, " ", a[n]]; a[n], {n, 1, 100}] (* Jean-François Alcover, Nov 24 2024 *)
PROG
(PARI) a(n, {base=16}) = forprime(p=2, oo, if((base%p) && znorder(Mod(base, p)) == (p-1)/(n * if(issquare(base), 2, 1)), return(p)))
CROSSREFS
Cf. A372801.
Sequence in context: A162262 A151373 A189739 * A035410 A290487 A059940
KEYWORD
nonn
AUTHOR
Jianing Song, May 13 2024
STATUS
approved