%I #7 Dec 06 2015 23:23:10
%S 1,2,3,5,13,31,43,251,6961,24971
%N Numbers m such that the permutation of the first m natural numbers T_m(n) = if(1<=n<=pi(m),prime(n),c(n-pi(m)-1)) is a cyclic permutation where c(k) is the k-th composite number and c(0)=1 (for each natural number k, c(k-1)=A018252(k)).
%C For n>1 a(n) is prime because if m is a composite number then T_m(m)=m so in such case T_m cannot be a cyclic permutation. There is no further term up to prime(4420). - _Farideh Firoozbakht_, Jun 29 2005
%e If m>3 & m=prime(k) then for n=1,2,...,m T_m(n) are respectively prime(1),prime(2),...,prime(k),1,4,...,m-1.
%e 31 is in the sequence because T_31=(1, 2, 3, 5, 11, 31, 30, 28, 26, 24, 21, 16, 9, 23, 20, 15, 8, 19, 14, 6, 13, 4, 7, 17, 10, 29, 27, 25, 22, 18, 12) is a cyclic permutation.
%t f[n_] := (a = Table[Prime[k], {k, PrimePi[n]}]; b = Complement[ Range[n], a]; c = Join[a, b]); d[n_, m_] := f[n][[m]]; g[r_]:= (v = {1}; d[m_] := d[Prime[r], m]; For[t = 1, ! MemberQ[v, d[v[[ -1]]]] && t < Prime[r], v = Append[ v, d[v[[ -1]]]]; t++ ]; t); w = {1}; Do[If[Prime[r] == g[r], w = Append[w, Prime[r]]; Print[w]], {r, 4420}] (Firoozbakht)
%Y Cf. A018252.
%Y Cf. A108516, A108517.
%K more,nonn
%O 1,2
%A Mehdi Khorrami (mymontain(AT)yahoo.com), Jun 27 2005
%E More terms from _Farideh Firoozbakht_, Jun 29 2005
|