OFFSET
1,2
COMMENTS
Suppose that f(1), f(2), f(3),... is a fractal sequence (a sequence which contains itself as a proper subsequence, such as 1, 2, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, ...; if the first occurrence of each n is deleted, the remaining sequence is identical to the original; see the Wikipedia article for a rigorous definition). Then for each n>=1, the limit L(n) of composites f(f(f...f(n)...)) exists and is one of the numbers in the set {k : f(k)=k}. Thus, if f(2)>2, then L(n)=1 for all n; if f(2)=2 and f(3)>3, then L(n) is 1 or 2 for all n. Examples: A020903, A191770, A191774
LINKS
Wikipedia, Fractal sequence
EXAMPLE
Write the counting numbers and A131967 like this:
1..2..3..4..5..6..7..8..9..10..11..12..13..14..15..
1..2..1..3..2..1..4..3..5..2...1...6...4...3...5...
It is then easy to check composites:
1->1, 2->2, 3->1, 4->3->1, 5->2, 6->1, 7->4->3->1,...
MATHEMATICA
Farey[n_] := Select[Union@Flatten@Outer[Divide, Range[n + 1] - 1, Range[n]], # <= 1 &];
newpos[n_] := Module[{length = Total@Array[EulerPhi, n] + 1, f1 = Farey[n], f2 = Farey[n - 1], to},
to = Complement[Range[length], Flatten[Position[f1, #] & /@ f2]];
ReplacePart[Array[0 &, length],
Inner[Rule, to, Range[length - Length[to] + 1, length], List]]];
a[n_] := Flatten@Table[Fold[ReplacePart[Array[newpos, i][[#2 + 1]], Inner[Rule, Flatten@Position[Array[newpos, i][[#2 + 1]], 0], #1, List]] &, Array[newpos, i][[1]], Range[i - 1]], {i, n}];
t = a[12]; f[n_] := Part[t, n];
Table[f[n], {n, 1, 100}] (* A131967 *)
h[n_] := Nest[f, n, 50]
t = Table[h[n], {n, 1, 200}] (* A191774 *)
s = Flatten[Position[t, 1]] (* A191775 *)
s = Flatten[Position[t, 2]] (* A191776 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Clark Kimberling, Jun 16 2011
STATUS
approved