login
A108516
Numbers m such that the permutation of the first m natural numbers S_m(n) = if(1<=n<m-pi(m),c(n),prime(n-m-pi(m))) is a cyclic permutation where c(k) is the k-th composite number and prime(0)=1(for each natural number k, c(k)=A002808(k)).
2
1, 4, 6, 14, 32, 65, 84, 111, 124, 147, 212, 236, 320, 380, 465, 517, 584, 636, 876, 955, 2126, 2570, 2962, 4254, 4883
OFFSET
1,2
COMMENTS
For n>1 a(n) is composite because if m is a prime number then S_m(m)=m so in such case S_m cannot be a cyclic permutation.
EXAMPLE
If m>3 & pi(m)=k then for n=1,2,...,m S_m(n) are respectively c(1),c(2),...,c(m-k-1),1,prime(1),prime(2),...,prime(k).
14 is in the sequence because S_14=(1, 4, 9, 2, 6, 12, 7, 14, 13, 11, 5, 10, 3, 8) is a cyclic permutation.
MATHEMATICA
f[n_] := (a = Table[Prime[k], {k, PrimePi[n]}]; b = Complement [Range[2, n], a]; c = Join[b, {1}, a]); d[n_, m_] := f[n] [[m]]; g[r_] := (v = {1}; d[m_] := d[r, m]; For[t = 1, !MemberQ[v, d[v[[ -1]]]] && t < r, v = Append[v, d[v[[ -1]]]]; t++ ]; t); Do[If[ !PrimeQ[r] && r == g[r], Print[r]], {r, 3000}]
CROSSREFS
KEYWORD
more,nonn
AUTHOR
Farideh Firoozbakht, Jun 30 2005
STATUS
approved