A191774 Lim f(f(...f(n)...)) where f(n) is the Farey fractal sequence, A131967.
1, 2, 1, 1, 2, 1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 2, 1, 2, 2, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1
Offset: 1
Keywords
Examples
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,...
Links
- Wikipedia, Fractal sequence
Programs
-
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 *)
Comments