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.

Showing 1-2 of 2 results.

A330634 The number of iterations of A330633, the concatenation of the product of adjacent digits, for starting value n before reaching 0, or -1 if this never happens.

Original entry on oeis.org

0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 1, 2, 2, 3, 3, 2, 3, 4, 3, 4, 1, 2, 2, 3, 2, 3, 2, 4, 2, 3, 1, 2, 3, 3, 3, 2, 4, 3, 4, 3, 1, 2, 3, 3, 4, 4, 3, 5, 3, 4, 1, 2, 3, 3, 3, 2, 4, 3, 4, 4, 1, 2, 3, 4, 4, 3, 3, 4, 4, 3, 1, 1
Offset: 0

Views

Author

Scott R. Shannon, Dec 22 2019

Keywords

Comments

This sequence lists the number of iterations required of the sequence A330633, the concatenation of the product of adjacent digits, for starting value n until the resulting term equals zero. If the iterative cycle never reaches zero and instead diverges with larger and larger numbers with each iteration then a(n) = -1.
For larger values of n most starting values lead to a divergent series. The first such term is a(166). See the examples below. This reaches 888 after three iterations which is guaranteed to diverge due to the iterative cycle 888 -> 6464 -> 242424 -> 88888, and the series of 8's expands forever. All starting values examined up to 10^8 either reach zero else eventually contain three or more adjacent 8's and will therefore diverge. Unlike similar iterative sequences A329624 and A329198 there appears to be no fixed points or other cyclic behavior.
Up to n = 10^8 the largest number of iterative steps before reaching zero is 23. This is first seen for n = 3178 and for 18520 other starting values. Considering no larger number of steps was found, nor any during a brief test of random numbers larger than 10^8, it is possible this is the largest number of steps to reach zero for all starting values, with the exception of the repunits comprising k 1's which will take k steps to reach zero. A random number with a large number of digits will almost certainly diverge as it will result in 888, or similar divergent numbers, appearing within the iterative term at some step which, as shown above, will diverge.
There are numbers other than repunits of k 1's which take k steps to reach 0, e.g. n = 691...16 with m 1's where m is odd or 491...16 where m is even has a(n) = m + 17. - Robert Israel, Jul 01 2024

Examples

			a(1) = 1 as A330633(1) = 0, taking 1 iteration to reach 0.
a(11) = 2 as A330633(11) = 1 and A330633(1) = 0, taking 2 iterations to reach 0.
a(77) = 5 as A330633(77) = 49, A330633(49) = 36, A330633(36) = 18, A330633(18) = 8, A330633(8) = 0, taking 5 iterations to reach 0.
a(166) = -1 as A330633(166) = 636, A330633(636) = 1818, A330633(1818) = 888, which is guaranteed to diverge.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local L,i;
      L:= convert(n,base,10);
      if ormap(t -> L[t..t+2] = [8,8,8], [$1..nops(L)-2]) then return -1 fi;
      parse(cat(seq(L[i]*L[i+1],i=nops(L)-1 .. 1, -1)))
    end proc;
    for i from 1 to 9 do f(i):= 0 od:
    g:= proc(i) option remember; local v;
        v:= f(i);
        if v = -1 then -1
        else v:= procname(v);
             if v = -1 then -1 else 1 + v fi
        fi;
    end proc:
    g(0):= 0:
    map(g, [$0..200]); # Robert Israel, Jun 30 2024
  • Mathematica
    Array[If[#[[-1]] == 888, -1, Length@ # - 1] &@ NestWhileList[If[Or[# == 0, IntegerLength@ # == 1], 0, FromDigits[Join @@ IntegerDigits[Times @@ # & /@ Partition[IntegerDigits@ #, 2, 1]]]] &, #, And[# > 0, # != 888] &] &, 102, 0] (* Michael De Vlieger, Dec 23 2019 *)

A350775 The balanced ternary expansion of a(n) is obtained by multiplying adjacent digits in the balanced ternary expansion of n: a(Sum_{k >= 0} t_k * 3^k) = Sum_{k >= 0} t_k * t_{k+1} * 3^k (with -1 <= t_k <= 1 for any k >= 0).

Original entry on oeis.org

0, 0, -1, 0, 1, -2, -3, -4, 0, 0, 0, 2, 3, 4, -5, -6, -7, -9, -9, -9, -13, -12, -11, 1, 0, -1, 0, 0, 0, -1, 0, 1, 7, 6, 5, 9, 9, 9, 11, 12, 13, -14, -15, -16, -18, -18, -18, -22, -21, -20, -26, -27, -28, -27, -27, -27, -28, -27, -26, -38, -39, -40, -36, -36
Offset: 0

Views

Author

Rémy Sigrist, Jan 15 2022

Keywords

Comments

This sequence is to balanced ternary what A048735 is to binary, or what A330633 is to decimal.

Examples

			The first terms, in decimal and in balanced ternary, are:
  n   a(n)  bter(n)  bter(a(n))
  --  ----  -------  ----------
   0     0        0           0
   1     0        1           0
   2    -1       1T           T
   3     0       10           0
   4     1       11           1
   5    -2      1TT          T1
   6    -3      1T0          T0
   7    -4      1T1          TT
   8     0      10T           0
   9     0      100           0
  10     0      101           0
  11     2      11T          1T
  12     3      110          10
  13     4      111          11
		

Crossrefs

Programs

  • PARI
    a(n) = { my (v=0, p=0, d); for (x=-1, oo, if (n==0, return (v), d=[0, 1, -1][1+n%3]; v+=p*d*3^x; n=(n-d)/3; p=d)) }

Formula

a(n) = 0 iff n belongs to A350776.
Showing 1-2 of 2 results.