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-7 of 7 results.

A243063 Numbers generated by a Fibonacci-like sequence in which zeros are suppressed.

Original entry on oeis.org

1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 61, 438, 499, 937, 1436, 2373, 389, 2762, 3151, 5913, 964, 6877, 7841, 14718, 22559, 37277, 59836, 97113, 156949, 25462, 182411, 27873, 21284, 49157, 7441, 56598, 6439, 6337, 12776, 19113, 31889, 512, 3241
Offset: 1

Views

Author

Anthony Sand, Jun 09 2014

Keywords

Comments

Let x(1) = 1, x(2) = 1, then begin the sequence x(i) = no-zero(x(i-2) + x(i-1)), where the function no-zero(n) removes all zero digits from n.
The sequence behaves like a standard Fibonacci sequence until step 15, where x = no-zero(233 + 377) = no-zero(610) = 61. At step 16, x = 377 + 61 = 438. The sequence then proceeds until step 927, where x = no-zero(224 + 377) = no-zero(601) = 61. Therefore at step 928, x = 377 + 61 = 438 and the sequence repeats.

Examples

			x(3) = x(1) + x(2) = 1 + 1 = 2.
x(4) = x(2) + x(3) = 1 + 2 = 3.
x(15) = no-zero(x(13) + x(14)) = no-zero(233 + 377) = no-zero(610) = 61.
x(16) = 377 + 61 = 438.
		

Crossrefs

Programs

  • Maple
    noz:=proc(n) local a,t1,i,j; a:=0; t1:=convert(n,base,10); for i from 1 to nops(t1) do j:=t1[nops(t1)+1-i]; if j <> 0 then a := 10*a+j; fi; od: a; end; # A004719
    t1:=[1,1]; for n from 3 to 100 do t1:=[op(t1),noz(t1[n-1]+t1[n-2])]; od: t1; # N. J. A. Sloane, Jun 11 2014
  • Mathematica
    Nest[Append[#, FromDigits@ DeleteCases[IntegerDigits[Total@ #[[-2 ;; -1]] ], ?(# == 0 &)]] &, {1, 1}, 45] (* _Michael De Vlieger, Jun 27 2020 *)
    nxt[{a_,b_}]:={b,FromDigits[DeleteCases[IntegerDigits[a+b],0]]}; NestList[nxt,{1,1},50][[All,1]] (* Harvey P. Dale, Sep 12 2022 *)

Formula

x(i) = no-zero(x(i-2) + x(i-1)). For example, no-zero(233 + 377) = no-zero(610) = 61.

A335505 Triangle read by rows, 0 <= k < n, n >= 1: T(n,k) is the eventual period of the sequence x(j) (or 0 if x(j) never enters a cycle) defined as follows: x(0) = 1 and for j > 1 x(j) is obtained from 5*x(j-1) by deleting all occurrences of the digit k in base n.

Original entry on oeis.org

0, 1, 1, 6, 1, 1, 4, 1, 1, 2, 1, 1, 0, 0, 0, 6, 60, 6, 30, 2, 1, 48, 2, 3, 12, 0, 1, 6, 156, 14, 22, 2, 18, 1, 34, 78, 12, 36, 3, 48, 0, 1, 138, 198, 10, 684, 1, 1, 2, 20, 1, 2, 0, 22, 1872, 495, 2, 50, 315, 0, 1, 405, 245, 2780, 0, 1440
Offset: 1

Views

Author

Pontus von Brömssen, Jun 13 2020

Keywords

Comments

T(1,0) = 0 is defined in order to make the triangle of numbers regular.
T(n,k) = 1 whenever k is a power of 5 and k > 1.

Examples

			Triangle begins:
   n\k   0    1    2    3    4    5    6    7    8    9
  -----------------------------------------------------
   1:    0
   2:    1    1
   3:    6    1    1
   4:    4    1    1    2
   5:    1    1    0    0    0
   6:    6   60    6   30    2    1
   7:   48    2    3   12    0    1    6
   8:  156   14   22    2   18    1   34   78
   9:   12   36    3   48    0    1  138  198   10
  10:  684    1    1    2   20    1    2    0   22 1872
T(10,7) = 0 because A335506 never enters a cycle.
		

Crossrefs

Programs

  • Python
    from sympy.ntheory.factor_ import digits
    from functools import reduce
    def drop(x,n,k):
      # Drop all digits k from x in base n.
      return reduce(lambda x,j:n*x+j if j!=k else x,digits(x, n)[1:],0)
    def cycle_length(n,k,m):
      # Brent's algorithm for finding cycle length.
      # Note: The function may hang if the sequence never enters a cycle.
      if (m,n,k)==(5,10,7):
        return 0 # A little cheating; see A335506.
      p=1
      length=0
      tortoise=hare=1
      nz=0
      while True:
        hare=drop(m*hare,n,k)
        while hare and hare%n==0:
          hare//=n
          nz+=1 # Keep track of the number of trailing zeros.
        length+=1
        if tortoise==hare:
          break
        if p==length:
          tortoise=hare
          nz=0
          p*=2
          length=0
      return length if not nz else 0
    def A335505(n,k):
      return cycle_length(n,k,5) if n>1 else 0

A237671 Let m_n denote the number which is obtained from n-base representation of m if its digits are written in nondecreasing order; then a(n) is the smallest period of the sequence which is defined by the recurrence b(0)=0, b(1)=1, b(k)=(b(k-1) + b(k-2))_n, for k>=2, or a(n)=0, if there is no such period.

Original entry on oeis.org

1, 3, 16, 6, 20, 24, 16, 36, 120, 300, 20, 288, 28, 192, 200, 552, 180, 192, 180, 1380, 224, 60, 1728, 912, 3800, 756, 576, 1776, 4102, 15480, 3540, 1344, 10800, 14328, 800, 2304, 1520, 1890, 1232, 11280, 9040, 31152, 49544, 3660, 6360, 3696, 13248, 21408
Offset: 2

Views

Author

Keywords

Comments

We conjecture that the sequence b is always eventually periodic, and so a(n)>0.

Examples

			For n=5, b-sequence begins 0,1,1,2,3,1,4,1,1,2,... It has period {1,1,2,3,1,4} of length 6. So a(5)=6.
a(10) = 120, because the eventual period of A069638 is 120.
		

Crossrefs

Programs

  • Python
    import sympy,functools
    def digits2int(x,b):
      return functools.reduce(lambda n,d:b*n+d,x,0)
    def A237671(n):
      return next(sympy.cycle_length(lambda x:(x[1],digits2int(sorted(sympy.ntheory.factor_.digits(sum(x),n)[1:]),n)),(0,1)))[0] # Pontus von Brömssen, Aug 28 2020

A335502 Triangle read by rows, 0 <= k < n, n >= 1: T(n,k) is the eventual period of the sequence x(j) (or 0 if x(j) never enters a cycle) defined as follows: x(0) = 1 and for j > 1 x(j) is obtained from 2*x(j-1) by deleting all occurrences of the digit k in base n.

Original entry on oeis.org

0, 1, 1, 4, 1, 1, 2, 1, 1, 0, 4, 1, 1, 3, 1, 12, 2, 1, 6, 1, 4, 78, 1, 1, 6, 1, 3, 6, 3, 1, 1, 0, 1, 0, 0, 0, 6, 1, 1, 18, 1, 4, 36, 4, 1, 36, 4, 1, 4, 1, 8, 4, 72, 1, 540, 100, 1, 1, 16, 1, 4, 17, 0, 1, 8, 4, 90, 2, 1, 12, 1, 4, 14, 6, 1, 4, 4, 240
Offset: 1

Views

Author

Pontus von Brömssen, Jun 13 2020

Keywords

Comments

T(1,0) = 0 is defined in order to make the triangle of numbers regular.
One way of getting T(n,k) = 0 is to have x(j) = x(i)*n^e for some j > i and e > 0. For k < n <= 48, this is the only way to get T(n,k) = 0 (but see A335506 for another situation where the x-sequence is not periodic).
T(n,k) = 1 whenever k is a power of 2 and k > 1.
It seems that k = 0 and k = n-1 often lead to particularly long cycles.

Examples

			Triangle begins:
   n\k  0   1   2   3   4   5   6   7   8   9  10  11
  ---------------------------------------------------
   1:   0
   2:   1   1
   3:   4   1   1
   4:   2   1   1   0
   5:   4   1   1   3   1
   6:  12   2   1   6   1   4
   7:  78   1   1   6   1   3   6
   8:   3   1   1   0   1   0   0   0
   9:   6   1   1  18   1   4  36   4   1
  10:  36   4   1   4   1   8   4  72   1 540
  11: 100   1   1  16   1   4  17   0   1   8   4
  12:  90   2   1  12   1   4  14   6   1   4   4 240
For n = 10 and k = 5, the x-sequence starts 1, 2, 4, 8, 16, 32, 64, 128, 26, 2, and then repeats with a period of 8, so T(10,5) = 8.
T(10,0) = 36, because A242350 eventually enters a cycle of length 36.
For n=11 and k=7, the x-sequence starts (in base 11) 1, 2, 4, 8, 15, 2A, 59, 10. Disregarding trailing zeros, the sequence then repeats with period 7 and x(i+7*j) = x(i)*11^j for positive i and j. The x-sequence itself is therefore not eventually periodic, so T(11,7)=0.
		

Crossrefs

Programs

  • Python
    from sympy.ntheory.factor_ import digits
    from functools import reduce
    def drop(x,n,k):
      # Drop all digits k from x in base n.
      return reduce(lambda x,j:n*x+j if j!=k else x,digits(x, n)[1:],0)
    def cycle_length(n,k,m):
      # Brent's algorithm for finding cycle length.
      # Note: The function may hang if the sequence never enters a cycle.
      if (m,n,k)==(5,10,7):
        return 0 # A little cheating; see A335506.
      p=1
      length=0
      tortoise=hare=1
      nz=0
      while True:
        hare=drop(m*hare,n,k)
        while hare and hare%n==0:
          hare//=n
          nz+=1 # Keep track of the number of trailing zeros.
        length+=1
        if tortoise==hare:
          break
        if p==length:
          tortoise=hare
          nz=0
          p*=2
          length=0
      return length if not nz else 0
    def A335502(n,k):
      return cycle_length(n,k,2) if n>1 else 0

A335503 Triangle read by rows, 0 <= k < n, n >= 1: T(n,k) is the eventual period of the sequence x(j) (or 0 if x(j) never enters a cycle) defined as follows: x(0) = 1 and for j > 1 x(j) is obtained from 3*x(j-1) by deleting all occurrences of the digit k in base n.

Original entry on oeis.org

0, 1, 1, 1, 1, 0, 12, 1, 2, 1, 28, 1, 0, 1, 2, 64, 1, 2, 1, 2, 4, 60, 4, 2, 1, 4, 0, 2, 54, 1, 2, 1, 62, 16, 2, 48, 2, 1, 0, 1, 0, 0, 0, 0, 0, 80, 40, 4, 1, 20, 2000, 60, 72, 4, 1, 40, 20, 5, 1, 85, 240, 5, 5, 20, 1, 320, 1260, 128, 2, 1, 272, 4, 2, 48, 68, 1, 20, 1440
Offset: 1

Views

Author

Pontus von Brömssen, Jun 13 2020

Keywords

Comments

T(1,0) = 0 is defined in order to make the triangle of numbers regular.
T(n,k) = 1 whenever k is a power of 3 and k>1.

Examples

			Triangle begins:
   n\k   0    1    2    3    4    5    6    7    8    9   10   11
  ---------------------------------------------------------------
   1:    0
   2:    1    1
   3:    1    1    0
   4:   12    1    2    1
   5:   28    1    0    1    2
   6:   64    1    2    1    2    4
   7:   60    4    2    1    4    0    2
   8:   54    1    2    1   62   16    2   48
   9:    2    1    0    1    0    0    0    0    0
  10:   80   40    4    1   20 2000   60   72    4    1
  11:   40   20    5    1   85  240    5    5   20    1  320
  12: 1260  128    2    1  272    4    2   48   68    1   20 1440
T(10,0) = 80, because A243845 eventually enters a cycle of length 80.
		

Crossrefs

Programs

  • Python
    from sympy.ntheory.factor_ import digits
    from functools import reduce
    def drop(x,n,k):
      # Drop all digits k from x in base n.
      return reduce(lambda x,j:n*x+j if j!=k else x,digits(x, n)[1:],0)
    def cycle_length(n,k,m):
      # Brent's algorithm for finding cycle length.
      # Note: The function may hang if the sequence never enters a cycle.
      if (m,n,k)==(5,10,7):
        return 0 # A little cheating; see A335506.
      p=1
      length=0
      tortoise=hare=1
      nz=0
      while True:
        hare=drop(m*hare,n,k)
        while hare and hare%n==0:
          hare//=n
          nz+=1 # Keep track of the number of trailing zeros.
        length+=1
        if tortoise==hare:
          break
        if p==length:
          tortoise=hare
          nz=0
          p*=2
          length=0
      return length if not nz else 0
    def A335503(n,k):
      return cycle_length(n,k,3) if n>1 else 0

A335504 Triangle read by rows, 0 <= k < n, n >= 1: T(n,k) is the eventual period of the sequence x(j) (or 0 if x(j) never enters a cycle) defined as follows: x(0) = 1 and for j > 1 x(j) is obtained from 4*x(j-1) by deleting all occurrences of the digit k in base n.

Original entry on oeis.org

0, 1, 1, 2, 1, 1, 1, 1, 0, 0, 2, 24, 2, 2, 1, 16, 18, 1, 6, 1, 42, 33, 1, 1, 15, 1, 24, 3, 3, 1, 1, 0, 1, 0, 0, 0, 3, 1, 195, 27, 1, 465, 147, 2, 6, 1002, 18, 4, 42, 1, 66, 2, 10, 10, 738, 1660, 25, 5, 180, 1, 2, 15, 35, 150, 4, 1490
Offset: 1

Views

Author

Pontus von Brömssen, Jun 13 2020

Keywords

Comments

T(1,0) = 0 is defined in order to make the triangle of numbers regular.
T(n,k) = 1 whenever k is a power of 4 and k>1.

Examples

			Triangle begins:
   n\k   0    1    2    3    4    5    6    7    8    9
  -----------------------------------------------------
   1:    0
   2:    1    1
   3:    2    1    1
   4:    1    1    0    0
   5:    2   24    2    2    1
   6:   16   18    1    6    1   42
   7:   33    1    1   15    1   24    3
   8:    3    1    1    0    1    0    0    0
   9:    3    1  195   27    1  465  147    2    6
  10: 1002   18    4   42    1   66    2   10   10  738
		

Crossrefs

Programs

  • Python
    from sympy.ntheory.factor_ import digits
    from functools import reduce
    def drop(x,n,k):
      # Drop all digits k from x in base n.
      return reduce(lambda x,j:n*x+j if j!=k else x,digits(x, n)[1:],0)
    def cycle_length(n,k,m):
      # Brent's algorithm for finding cycle length.
      # Note: The function may hang if the sequence never enters a cycle.
      if (m,n,k)==(5,10,7):
        return 0 # A little cheating; see A335506.
      p=1
      length=0
      tortoise=hare=1
      nz=0
      while True:
        hare=drop(m*hare,n,k)
        while hare and hare%n==0:
          hare//=n
          nz+=1 # Keep track of the number of trailing zeros.
        length+=1
        if tortoise==hare:
          break
        if p==length:
          tortoise=hare
          nz=0
          p*=2
          length=0
      return length if not nz else 0
    def A335504(n,k):
      return cycle_length(n,k,4) if n>1 else 0

A374266 Smallest number reachable by a Fibonacci-like iteration where one has the option to either omit or keep zero digits.

Original entry on oeis.org

1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 61, 438, 499, 937, 1436, 2373, 389, 2762, 1657, 1368, 325, 1693, 218, 1911, 2129, 44, 1516, 129, 394, 37, 53, 9, 62, 35, 133, 24, 121, 181, 95, 69, 11, 53, 19, 9, 19, 19, 2, 12, 5, 8, 4, 3, 7, 1, 8, 9, 8, 8, 7, 6, 4
Offset: 1

Views

Author

Bryle Morga, Jul 02 2024

Keywords

Comments

a(n) is the smallest f(n) such that f(1)=f(2)=1 and f(i) = OpNoz_i(f(i-1)+f(i-2)) for 2
Choosing to always remove zero digits at each step gives A243063. This strategy of always choosing to remove zeros is optimal for n < 23. For n >= 23, a(n) < A243063(n), i.e., the optimal path contains a step that keeps zeros.
Removal of zeros preserves the digital root giving the lower bound a(n) >= A030132(n). In fact, for n >= 53, a(n) = A030132(n). It follows that this sequence is eventually periodic with a period of 24.

Examples

			a(23) = 1657 via the path: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 1946, 8711, 1657.
		

Programs

  • Python
    def a(n):
        reach = {(1, 1)}
        for _ in range(n-1):
            newreach = set()
            for a, b in reach:
                newreach.update([(b, a+b), (b, int(str(a+b).replace('0', '')))])
            reach = newreach
        return min(reach, key = lambda k:k[0])[0]

Formula

a(n) <= A243063(n); Strict inequality for n >= 23.
a(n) = A030132(n) and a(n) = a(n+24) for n >= 53.
Showing 1-7 of 7 results.