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.

A357610 Start with x = 3 and repeat the map x -> floor(n/x) + (n mod x) until an x occurs that has already appeared, then that is a(n).

This page as a plain text file.
%I A357610 #15 Oct 17 2022 09:45:45
%S A357610 1,2,3,2,3,3,3,4,3,4,3,3,5,6,3,6,5,3,7,5,3,8,7,3,9,6,3,10,9,3,11,8,3,
%T A357610 12,5,3,13,10,3,14,9,3,15,11,3,16,11,3,17,5,3,18,5,3,19,12,3,20,11,3,
%U A357610 21,14,3,22,5,3,23,8,3,24,15,3,25,14,3,26,17,3,27,5,3,28,11,3,29,18,3,30,9
%N A357610 Start with x = 3 and repeat the map x -> floor(n/x) + (n mod x) until an x occurs that has already appeared, then that is a(n).
%C A357610 1, 2 and the third column of A357554.
%H A357610 Robert Israel, <a href="/A357610/b357610.txt">Table of n, a(n) for n = 1..10000</a>
%F A357610 a(n) = 3 if n is divisible by 3.
%F A357610 a(3*k+1) = k+1.
%F A357610 a(15*k+5) = 5 for k >= 1.
%F A357610 a(15*k+11) = 3*k+3.
%F A357610 a(255*k+137) = 15*k+9 for k >= 1.
%e A357610 a(4) = 2 because we have 3 -> floor(4/3) + (4 mod 3) = 2 -> floor(4/2) + (4 mod 2) = 2.
%p A357610 g:= proc(n, k) local x, S;
%p A357610   S:= {k};
%p A357610   x:= k;
%p A357610   do
%p A357610      x:= iquo(n, x) + irem(n, x);
%p A357610      if member(x, S) then return x fi;
%p A357610      S:= S union {x};
%p A357610   od
%p A357610 end proc:
%p A357610 seq(g(n,3), n=1..100);
%t A357610 T[n_, k_] := Module[{x, S}, S = {k}; x = k; While[True, x = Total@QuotientRemainder[n, x]; If[MemberQ[S, x], Return[x]]; S = S~Union~{x}]];
%t A357610 a[n_] := T[n, 3];
%t A357610 Table[a[n], {n, 1, 100}] (* _Jean-François Alcover_, Oct 17 2022, after Maple code *)
%o A357610 (Python)
%o A357610 def a(n):
%o A357610     seen, x = set(), 3
%o A357610     while x not in seen: seen.add(x); q, r = divmod(n, x); x = q + r
%o A357610     return x
%o A357610 print([a(n) for n in range(1, 90)]) # _Michael S. Branicky_, Oct 06 2022~
%Y A357610 Cf. A357554.
%K A357610 nonn,look
%O A357610 1,2
%A A357610 _J. M. Bergot_ and _Robert Israel_, Oct 06 2022