%I #61 Jan 28 2022 12:15:01
%S 1,2,2,1,2,2,1,1,1,1,3,2,3,2,1,2,1,1,2,7,2,3,2,3,1,2,2,2,1,1,3,1,2,2,
%T 1,3,2,2,1,2,1,1,7,1,2,3,2,1,2,1,1,7,7,3,1,1,1,6,2,3,2,2,2,11,1,2,2,1,
%U 2,2,2,7,1,2,1,1,1,2,3,7,1,2,7,1,3,2,3,3,1,2,2,13
%N a(n) is the least integer b such that the fractions (b^0)/p, (b^1)/p, ..., (b^(r-1))/p where p is the n-th prime, produce the A006556(n) distinct cycles.
%C With the exception of the prime numbers 2 and 5, the values of r mentioned above form the sequence A006556.
%C Detection of all different cycles of digits in the decimal expansions of 1/p, 2/p, ..., (p-1)/p where p=n-th prime. If for the n-th prime p the number of different cycles of digits is equal to r, then there will be the smallest integer b in the interval 0 < b < p with the following property: The fractions (b^0)/p, (b^1)/p, ..., (b^(r-1))/p will produce r different cycles of digits. In this case the term a(n) of the sequence becomes equal to b.
%e For n=13, prime(13)=41, there are A006556(13)=8 cycles.
%e With b=3, we get (normally, these fractions should be in the form (b^k mod p)/p):
%e frac(3^0 / 41) = 0.02439 (1)
%e frac(3^1 / 41) = 0.07317 (2)
%e frac(3^2 / 41) = 0.21951 (3)
%e frac(3^3 / 41) = 0.65853 (4)
%e frac(3^4 / 41) = 0.97560 (5)
%e frac(3^5 / 41) = 0.92682 (6)
%e frac(3^6 / 41) = 0.78048 (7)
%e frac(3^7 / 41) = 0.34146 (8=r)
%e So a(13) = 3.
%o (PARI) \\ default(realprecision, 1000)
%o nbc(p) = (p-1)/znorder(Mod(10, p));
%o len(p) = znorder(Mod(10, p));
%o pad(x, sz) = {while(#digits(x) != sz, x*=10); x;}
%o cmpc(x,y) = {if (x==y, return (0)); my(dx=digits(x), dy=digits(y), v=dx); for (k=1, #dx, v=vector(#v, k, if (k==#v, v[1], v[k+1])); if (v == dy, return (0));); return (1);}
%o decimals(x, sz) = pad(floor(1.0*10^sz*x), sz);
%o a(n) = {my(p=prime(n)); if ((p==2), return (1)); if ((p==5), return (2)); my(sz=len(p), nb=nbc(p), m=1); while (#vecsort(vector(f(p), k, decimals((m^(k-1) % p)/p, sz)),cmpc,8) != nb, m++); m;} \\ _Michel Marcus_, May 29 2020
%Y Cf. A006556.
%K nonn,base
%O 1,2
%A _George Plousos_, May 15 2020
|