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

A335506 Start with a(0) = 1; thereafter a(n) is obtained from 5*a(n-1) by removing all 7's.

Original entry on oeis.org

1, 5, 25, 125, 625, 3125, 15625, 8125, 40625, 203125, 1015625, 508125, 2540625, 1203125, 6015625, 3008125, 15040625, 5203125, 26015625, 13008125, 65040625, 325203125, 1626015625, 813008125, 4065040625, 20325203125, 101626015625, 50813008125, 254065040625
Offset: 0

Views

Author

Pontus von Brömssen, Jun 13 2020

Keywords

Comments

This sequence is a rare non-periodic case of the recurrence where x(0)=1 and x(n+1) is obtained from m*x(n) by removing all digits k and all trailing zeros in base b. In fact, except for (m, b, k) = (5, 10, 7) (this sequence), x is eventually periodic whenever m <= 5 and 2 <= b <= 32, or m <= 16 and 2 <= b <= 16. However, for negative b it seems that x is non-periodic more frequently, for example when (m, b, k) is (2, -5, 1) or (2, -8, 1).

Examples

			For n <= 6, no 7's occur in 5^n, so a(n) = 5^n. Deleting the 7 in 5*a(6) = 78125, we obtain a(7) = 8125.
		

Crossrefs

Cf. A335505.

Programs

  • Mathematica
    Remove7[n_] := FromDigits[Select[IntegerDigits[n], # != 7 &]]; a[0] = 1; a[n_] := a[n] = Remove7[5 * a[n - 1]]; Array[a, 29, 0] (* Amiram Eldar, Jun 20 2020 *)
  • 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 A335506(n):
      if n==0:
        return 1
      else:
        return drop(5*A335506(n-1),10,7)

Formula

a(n) = a(n-4) + 100000*(a(n-16) - a(n-20)) for n > 22.
Recurrence (for n > 2):
a(n+1) = 5*a(n) if n is 1, 3, 4, 5, 7, 8, 9, 11, 13, or 15 mod 16 (these are the cases where 5*a(n) doesn't contain any 7's);
a(n+1) = (a(n) + 625)/2 if n is 2, 6, 10, or 14 mod 16;
a(n+1) = 5*a(n) - 7*10^(5*n/16 + 2) if n is 0 mod 16;
a(n+1) = 5*a(n) - 115*10^(5*(n + 4)/16) if n is 12 mod 16.
Explicit expressions:
a(16*n) = (37*2^4*10^(5*n - 2) - 1)*5^5/123 for n >= 1;
a(16*n + 1) = (2^12*10^(5*n - 4) - 1)*5^6/123 for n >= 1;
a(16*n + 2) = (2^12*10^(5*n - 4) - 1)*5^7/123 for n >= 1;
a(16*n + 3) = (2^8*10^(5*n - 1) - 1)*5^4/123 for n >= 0;
a(16*n + 4) = (2^8*10^(5*n - 1) - 1)*5^5/123 for n >= 0;
a(16*n + 5) = (2^8*10^(5*n - 1) - 1)*5^6/123 for n >= 0;
a(16*n + 6) = (2^8*10^(5*n - 1) - 1)*5^7/123 for n >= 0;
a(16*n + 7) = (2^4*10^(5*n + 2) - 1)*5^4/123 for n >= 0;
a(16*n + 8) = (2^4*10^(5*n + 2) - 1)*5^5/123 for n >= 0;
a(16*n + 9) = (2^4*10^(5*n + 2) - 1)*5^6/123 for n >= 0;
a(16*n + 10) = (2^4*10^(5*n + 2) - 1)*5^7/123 for n >= 0;
a(16*n + 11) = (10^(5*n + 5) - 1)*5^4/123 for n >= 0;
a(16*n + 12) = (10^(5*n + 5) - 1)*5^5/123 for n >= 0;
a(16*n + 13) = (37*2^8*10^(5*n) - 1)*5^6/123 for n >= 0;
a(16*n + 14) = (37*2^8*10^(5*n) - 1)*5^7/123 for n >= 0;
a(16*n + 15) = (37*2^4*10^(5*n + 3) - 1)*5^4/123 for n >= 0.

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
Showing 1-4 of 4 results.