%I #19 Feb 06 2021 12:34:27
%S 2,3,4,7,8,9,16,21,27,31,32,63,64,81,93,127,128,189,217,243,256,279,
%T 381,512,567,651,729,837,889,1024,1143,1701,1953,2048,2187,2511,2667,
%U 3429,3937,4096,5103,5859,6561,7533,8001,8191,8192,10287,11811,15309,16384
%N Numbers k such that starting with k and repeatedly applying the map x -> A340323(x) reaches the loop {3, 4}.
%C From _Sebastian Karlsson_, Jan 15 2021: (Start)
%C The sequence can be defined exclusively as:
%C - Powers of two greater than one.
%C - Powers of three greater than one.
%C - Products of distinct Mersenne primes (A046528, except initial 1) or powers of three multiplied with products of distinct Mersenne primes. (End)
%t fa[n_]:=fa[n]=FactorInteger[n]; phi[1]=1; phi[p_, s_]:= (p + 1)*( p - 1)^(s - 1)
%t phi[n_]:=Product[phi[fa[n][[i, 1]], fa[n][[i, 2]]], {i, Length[fa[n]]}];
%t S[n_] := NestWhile [phi, n, ! ( # == 12 || # == 3 || # == 4) &];
%t Select[1 + Range[100], 2<S[#]<5 &]
%o (PARI) f(n) = if(1==n, n, my(f=factor(n)); prod(i=1, #f~, (f[i, 1]+1)*((f[i, 1]-1)^(f[i, 2]-1)))); \\ A340323
%o isok(m) = if (m==1, return(0)); while(! ((m==3) || (m==4) || (m==12)), m = f(m)); ((m==3) || (m==4)); \\ _Michel Marcus_, Jan 21 2021
%Y Cf. A340323, A340325.
%Y Cf. A000079, A000244, A000668, A046528.
%K nonn
%O 1,1
%A _José María Grau Ribas_, Jan 05 2021