%I #39 Sep 15 2021 07:33:52
%S 121,169,289,1331,1681,2197,3481,3721,4913,6241,6889,7921,10609,11449,
%T 11881,12769,14641,16129,17161,18769,22801,24649,28561,32041,39601,
%U 49729,51529,52441,54289,63001,66049,68921,73441,76729,83521,120409,134689,139129,157609
%N Composite numbers with primitive root 6.
%C An alternative description: Numbers k such that 1/k in base 6 generates a repeating fraction with period phi(n) and n/2 < phi(n) < n-1.
%C For example, in base 6, 1/121 has repeat length 110 = phi(121) which is > 121/2 but less than 121-1.
%H Robert Hutchins, <a href="/A346316/a346316.c.txt">PrimRoot.c</a>
%F A167794 INTERSECT A002808.
%p isA033948 := proc(n)
%p if n in {1,2,4} then
%p true;
%p elif type(n,'odd') and nops(numtheory[factorset](n)) = 1 then
%p true;
%p elif type(n,'even') and type(n/2,'odd') and nops(numtheory[factorset](n/2)) = 1 then
%p true;
%p else
%p false;
%p end if;
%p end proc:
%p isA167794 := proc(n)
%p if not isA033948(n) or n = 1 then
%p false;
%p elif numtheory[order](6,n) = numtheory[phi](n) then
%p true;
%p else
%p false;
%p end if;
%p end proc:
%p A346316 := proc(n)
%p option remember;
%p local a;
%p if n = 1 then
%p 121;
%p else
%p for a from procname(n-1)+1 do
%p if not isprime(a) and isA167794(a) then
%p return a;
%p end if;
%p end do:
%p end if;
%p end proc:
%p seq(A346316(n),n=1..20) ; # _R. J. Mathar_, Sep 15 2021
%t Select[Range[160000], CompositeQ[#] && PrimitiveRoot[#, 6] == 6 &] (* _Amiram Eldar_, Jul 13 2021 *)
%o (PARI) isok(m) = (m>1) && !isprime(m) && (gcd(m, 6)==1) && (znorder(Mod(6, m))==eulerphi(m)); \\ _Michel Marcus_, Aug 12 2021
%Y Subsequence of A244623.
%Y Subsequence of A167794.
%Y Cf. A108989 (for base 2), A158248 (for base 10).
%Y Cf. A157502.
%K nonn
%O 1,1
%A _Robert Hutchins_, Jul 13 2021