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.

A350656 a(n) is the least value of the orbit of n under repeated application of A350229 (the sum of a number and its balanced ternary digits).

This page as a plain text file.
%I A350656 #9 Jan 24 2022 16:11:59
%S A350656 0,1,2,3,4,4,6,7,8,9,10,11,12,13,12,12,16,16,18,19,20,21,22,22,24,25,
%T A350656 26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,38,40,40,40,40,46,46,48,
%U A350656 48,48,48,52,52,54,55,56,57,58,58,60,61,62,63,64,65,66,67
%N A350656 a(n) is the least value of the orbit of n under repeated application of A350229 (the sum of a number and its balanced ternary digits).
%C A350656 The sequence { a(n) - n, n >= 0 } has no lower limit (this because the sequence A065363 can be negative on arbitrarily large intervals).
%e A350656 For n = 9:
%e A350656 - the orbit of 9 contains the following values:
%e A350656   k  v   bter(v)  ds(v)
%e A350656   -  --  -------  -----
%e A350656   0   9      100      1
%e A350656   1  10      101      2
%e A350656   2  12      110      2
%e A350656   3  14     1TTT     -2
%e A350656   4  12      110      2
%e A350656 - so a(9) = min({ 9, 10, 12, 14 }) = 9.
%t A350656 f[n_] := n + Total[If[First@ # == 0, Rest@ #, #] &[Prepend[IntegerDigits[n, 3], 0] //. {x___, y_, k_ /; k > 1, z___} :> {x, y + 1, k - 3, z}]]; Array[Min@ NestWhileList[f, #, UnsameQ, All] &, 68, 0] (* _Michael De Vlieger_, Jan 15 2022 *)
%o A350656 (PARI) b(n) = my (v=n, d); while (n, n=(n-d=[0,1,-1][1+n%3])/3; v+=d); v
%o A350656 a(n) = my (s=[]); while (!setsearch(s, n), s=setunion(s, [n]); n=b(n)); s[1]
%Y A350656 Cf. A065363, A350229, A350657.
%K A350656 nonn,base
%O A350656 0,3
%A A350656 _Rémy Sigrist_, Jan 10 2022