OFFSET
1,1
COMMENTS
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.
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.
EXAMPLE
In the following examples let () denote the reptend. The prime numbers themselves and the fractions are written out in decimal.
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.
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.
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.
PROG
(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)))
CROSSREFS
KEYWORD
nonn
AUTHOR
Jianing Song, May 13 2024
STATUS
approved