A358052 Triangular array read by rows. For T(n,k) where 1 <= k <= n, start with x = k and repeat the map x -> floor(n/x) + (n mod x) until an x occurs that has already appeared. The number of applications of the map is T(n,k).
1, 2, 2, 2, 1, 2, 2, 1, 2, 2, 2, 2, 1, 3, 2, 2, 2, 2, 3, 3, 2, 2, 2, 1, 1, 2, 3, 2, 2, 2, 3, 2, 3, 4, 3, 2, 2, 2, 1, 2, 1, 3, 2, 3, 2, 2, 2, 2, 1, 2, 3, 2, 3, 3, 2, 2, 2, 2, 3, 2, 1, 3, 4, 3, 3, 2, 2, 2, 2, 2, 3, 2, 3, 4, 3, 3, 3, 2, 2, 2, 2, 1, 1, 3, 1, 4, 2, 2, 3, 3, 2, 2, 2, 4, 3, 3, 3, 2, 3
Offset: 1
Examples
For T(13,2) we have 2 -> floor(13/2) + (13 mod 2) = 7 -> floor(13/7) + (13 mod 7) = 7. That is two applications of the map so T(13,2) = 2. Triangle starts: 1; 2, 2; 2, 1, 2; 2, 1, 2, 2; 2, 2, 1, 3, 2; 2, 2, 2, 3, 3, 2; 2, 2, 1, 1, 2, 3, 2; 2, 2, 3, 2, 3, 4, 3, 2; 2, 2, 1, 2, 1, 3, 2, 3, 2; 2, 2, 2, 1, 2, 3, 2, 3, 3, 2;
Links
- Robert Israel, Table of n, a(n) for n = 1..10011(rows 1 to 141, flattened)
Programs
-
Maple
f:= proc(n, k) local x, S,count; S:= {k}; x:= k; for count from 1 do x:= iquo(n, x) + irem(n, x); if member(x, S) then return count fi; S:= S union {x}; od end proc: for n from 1 to 20 do seq(f(n, k), k=1..n) od;
-
Mathematica
f[n_, k_] := Module[{x, S, count}, S = {k}; x = k; For[count = 1, True, count++, x = Quotient[n, x] + Mod[n, x]; If[MemberQ[S, x], Return[count]]; S = S~Union~{x}]]; Table[f[n, k], {n, 1, 20}, {k, 1, n}] // Flatten (* Jean-François Alcover, Jan 29 2023, after Maple code *)
Comments