A054083 a(n) = order of n in the permutation A054082 of the natural numbers if this order exists; a(n) = -1 otherwise.
2, 2, 2, 2, 7, 7, 7, 7, 7, 7, 9, 7, 9, 9, 9, 9, 9, 9, -1, 9, -1, 9, -1, -1, -1, -1, 16, -1, 16, -1, 16, -1, -1, 16, 16, 16, 16, 16, -1, -1, 16, 16, -1, 16, -1, 16, -1, -1, 16, -1, -1, 16, -1, 16, -1, -1, -1, -1, -1, -1, -1, -1, -1, 16, -1, -1, -1, -1, -1, -1
Offset: 1
Keywords
Examples
5 -> 7 -> 9 -> 12 -> 10 -> 8-> 6-> 5, so that 5 has order 7.
Programs
-
Mathematica
a054082[n_] := a054082[n] = If[OddQ[n], Floor[((n + 1)/2 - 1) GoldenRatio] + (n + 1)/2 + 1, Floor[(n/2 - 1) GoldenRatio] + 2]; a054082[2] = 1; Array[a054082[#] &, 40] (* after Jean-François Alcover *) Table[Length[NestWhileList[a054082, a054082[n], # != n &, 1, 10000]] /. (10001 -> -1), {n, 1, 500}] (* Peter J. C. Moses, Jan 26 2022 *)
Extensions
Data truncated by Sean A. Irvine, Jan 23 2022
Edited by Clark Kimberling, Jan 26 2022
Comments