cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A357554 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, then that is T(n,k).

This page as a plain text file.
%I A357554 #33 Oct 16 2022 16:35:37
%S A357554 1,1,2,1,2,3,1,2,2,4,1,3,3,3,5,1,2,3,3,2,6,1,4,3,4,3,4,7,1,2,4,4,4,4,
%T A357554 2,8,1,5,3,3,5,3,3,5,9,1,2,4,4,5,5,4,4,2,10,1,6,3,5,5,6,5,5,3,6,11,1,
%U A357554 2,3,4,4,6,6,4,4,3,2,12,1,7,5,4,5,5,7,5,5,4,5,7,13
%N A357554 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, then that is T(n,k).
%H A357554 Robert Israel, <a href="/A357554/b357554.txt">Table of n, a(n) for n = 1..10011</a>(rows 1 to 141, flattened)
%F A357554 If k divides n, or if k > sqrt(n) and k^2-n is divisible by k-1, then T(n,k) = k.
%F A357554 T(n,2) = 2 if n is even, (n+1)/2 if n is odd.
%e A357554 For T(13,2) we have 2 -> floor(13/2) + (13 mod 2) = 7 -> floor(13/7) + (13 mod 7) = 7 so T(13,2) = 7.
%e A357554 Triangle starts:
%e A357554   1;
%e A357554   1, 2;
%e A357554   1, 2, 3;
%e A357554   1, 2, 2, 4;
%e A357554   1, 3, 3, 3, 5;
%e A357554   1, 2, 3, 3, 2, 6;
%e A357554   1, 4, 3, 4, 3, 4, 7;
%e A357554   1, 2, 4, 4, 4, 4, 2, 8;
%e A357554   1, 5, 3, 3, 5, 3, 3, 5, 9;
%e A357554   1, 2, 4, 4, 5, 5, 4, 4, 2, 10;
%e A357554   ...
%p A357554 g:= proc(n,k) local x,S;
%p A357554   S:= {k};
%p A357554   x:= k;
%p A357554   do
%p A357554      x:= iquo(n,x) + irem(n,x);
%p A357554      if member(x,S) then return x fi;
%p A357554      S:= S union {x};
%p A357554   od
%p A357554 end proc:
%p A357554 for n from 1 to 20 do seq(g(n,k),k=1..n) od;
%t A357554 T[n_, k_] := Module[{x, S}, S = {k}; x = k; While[True, x = Quotient[n, x] + Mod[n, x]; If[MemberQ[S, x], Return[x]]; S = S~Union~{x}]];
%t A357554 Table[T[n, k], {n, 1, 20}, {k, 1, n}] // Flatten (* _Jean-François Alcover_, Oct 16 2022, after _Robert Israel_ *)
%o A357554 (Python)
%o A357554 def T(n, k):
%o A357554     seen, x = set(), k
%o A357554     while x not in seen: seen.add(x); q, r = divmod(n, x); x = q + r
%o A357554     return x
%o A357554 print([T(n, k) for n in range(1, 14) for k in range(1, n+1)]) # _Michael S. Branicky_, Oct 04 2022
%Y A357554 Cf. A357610.
%K A357554 nonn,tabl,look
%O A357554 1,3
%A A357554 _J. M. Bergot_ and _Robert Israel_, Oct 02 2022