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

A321801 Delete all consecutive identical decimal digits of n; write 0 if all digits disappear.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 0, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 0, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 0, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 0, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 0, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 0, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 0, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 0, 1, 101, 102, 103, 104, 105, 106, 107, 108, 109, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 120, 121, 1, 123, 124, 125, 126, 127, 128, 129, 130, 131
Offset: 0

Views

Author

Chai Wah Wu, Nov 19 2018

Keywords

Comments

Consecutive identical digits of n are erased. Leading zeros are erased unless the result is 0. If all digits are erased, we write 0 for the result (A321802 is another version, which uses -1 for the empty string).
More than the usual number of terms are shown in order to reach some interesting examples. Agrees with A320486 for n < 101.

Examples

			12311 becomes 123, 1123 becomes 23, 11231 becomes 231, and 110232 becomes 232 (as we don't accept leading zeros). Note that 112233 disappears immediately and we get 0.
1110, 11000, 1100011 all become 0.
		

Crossrefs

Programs

  • Mathematica
    A321801[n_]:=FromDigits[Flatten[Select[Split[IntegerDigits[n]],Length[#]==1&]]];Array[A321801,100,0] (* Paolo Xausa, Nov 14 2023 *)
  • PARI
    A321801(n)={forstep(i=#n=digits(n),2,-1,n[i]!=n[i-1]&&next;if(i<3||n[i-2]!=n[i],n=n[^i];i--);n=n[^i]);fromdigits(n)} \\ M. F. Hasler, Nov 20 2018
  • Python
    from re import split
    def A321801(n):
        return int('0'+''.join(d if len(d) == 1 else '' for d in split('(0+)|(1+)|(2+)|(3+)|(4+)|(5+)|(6+)|(7+)|(8+)|(9+)',str(n)) if d != '' and d != None))
    

A323832 Start with n and repeatedly double it and apply the "repeatedly delete any run of identical digits" operation described in A323830; a(n) is the number of steps needed to reach one of 0, 1, or 5, or -1 if none of these three numbers is ever reached.

Original entry on oeis.org

0, 0, 19, 12, 18, 0, 11, 23, 17, 4, 19, 1, 10, 29, 22, 32, 16, 5, 3, 47, 18, 15, 1, 20, 9, 2, 28, 26, 21, 13, 31, 24, 15, 1, 4, 23, 2, 18, 46, 21, 17, 51, 14, 15, 1, 24, 19, 2, 8, 10, 1, 33, 27, 24, 25, 1, 20, 19, 12, 18, 30, 1, 23, 7, 14, 29, 5, 20, 3
Offset: 0

Views

Author

N. J. A. Sloane, Feb 03 2019

Keywords

Comments

Conjecture: every number will eventually reach one of 0, 1, or 5.
From Chai Wah Wu, Feb 04 2019, Feb 13 2019: (Start)
Conjecture is true for n < 10^10.
1604466 takes 115 steps to reach 5 and is the largest value for a(n) for n < 10^7.
91070713 takes 121 steps to reach 5 and is the largest value for a(n) for n < 10^8.
126591463 and 801282051 both take 128 steps to reach 5 and this is the largest value for a(n) for n < 10^9.
The numbers 1582393271, 1582393293, 4645106705 all take 131 steps to reach 5 and this is the largest value for a(n) for n < 10^10.
(End)

Examples

			Starting with 2, the trajectory is 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 636, 1272, 25, 50, 1, reaching 1 in 20 steps, so a(2) = 20.
3 reaches 1 in 12 steps: 3, 6, 12, 24, 48, 96, 192, 384, 768, 1536, 3072, 61, 1, so a(3) = 12.
10 reaches 5 in 19 steps: 10, 20, 40, 80, 160, 320, 640, 1280, 2560, 5120, 10240, 20480, 40960, 81920, 163840, 327680, 6360, 12720, 250, 5, so a(10) = 19.
		

Crossrefs

Programs

  • Python
    from re import split
    def A321801(n):
        return int('0'+''.join(d for d in split('(0+)|(1+)|(2+)|(3+)|(4+)|(5+)|(6+)|(7+)|(8+)|(9+)',str(n)) if d != '' and d != None and len(d) == 1))
    def f(n):
        x = 2*n
        y = A321801(x)
        while x != y:
            x, y = y, A321801(y)
        return x
    def A323832(n):
        mset, m, c = set(), n, 0
        while True:
            if m == 1 or m == 0 or m == 5:
                return c
            m = f(m)
            if m in mset:
                return -1
            mset.add(m)
            c += 1 # Chai Wah Wu, Feb 04 2019, Feb 11 2019

A323830 a(0) = 1; thereafter a(n) is obtained by doubling a(n-1) and repeatedly deleting any string of identical digits.

Original entry on oeis.org

1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 636, 1272, 25, 50, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 636, 1272, 25, 50, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 636, 1272, 25, 50
Offset: 0

Views

Author

N. J. A. Sloane, Feb 03 2019, following a suggestion from Yukun Yao

Keywords

Comments

Periodic with period length 20.
Conjecture: If we start with any nonnegative number, and repeatedly double it and apply the "repeatedly delete any run of identical digits" operation described here, we eventually reach one of 0, 1, or 5.
In other words, the conjecture is that eventually we reach 0 or join the trajectory shown here or the trajectory shown in A323831.
The number of steps to reach 0, 1, or 5 is given in A323832.

Examples

			After a(15) = 32768 we get 65536 which becomes 636 after deleting "55". Then doubling 636 we get 1272, then 2544 which becomes 25 after deleting "44", then 50, then 100 which becomes 1 after deleting "00", and now the sequence repeats.
		

Crossrefs

See A035615 for a classic related base-2 sequence.

Programs

  • Mathematica
    dad[n_]:=FromDigits[FixedPoint[Flatten[Select[Split[#],Length[#]==1&]]&,IntegerDigits[2n]]];NestList[dad,1,100] (* Paolo Xausa, Nov 14 2023 *)
  • PARI
    Vec((1 + 2*x)*(1 + 4*x^2 + 16*x^4 + 64*x^6 + 256*x^8 + 1024*x^10 + 4096*x^12 + 16384*x^14 + 636*x^16 + 25*x^18) / (1 - x^20) + O(x^40)) \\ Colin Barker, Feb 03 2019

Formula

From Colin Barker, Feb 03 2019: (Start)
G.f.: (1 + 2*x)*(1 + 4*x^2 + 16*x^4 + 64*x^6 + 256*x^8 + 1024*x^10 + 4096*x^12 + 16384*x^14 + 636*x^16 + 25*x^18) / (1 - x^20).
a(n) = a(n-20) for n>19.
(End)
a(n+1) = A321801(2*a(n)). For general numbers, the "repeatedly delete any run of identical digits" operation corresponds to repeatedly applying A321801. - Chai Wah Wu, Feb 11 2019

A323831 a(0) = 5; thereafter a(n) is obtained by doubling a(n-1) and repeatedly deleting any string of identical digits.

Original entry on oeis.org

5, 10, 20, 40, 80, 160, 320, 640, 1280, 2560, 5120, 10240, 20480, 40960, 81920, 163840, 327680, 6360, 12720, 250, 5, 10, 20, 40, 80, 160, 320, 640, 1280, 2560, 5120, 10240, 20480, 40960, 81920, 163840, 327680, 6360, 12720, 250
Offset: 0

Views

Author

N. J. A. Sloane, Feb 03 2019

Keywords

Comments

Periodic with period length 20.
Conjecture: If we start with any nonnegative number, and repeatedly double it and apply the "repeatedly delete any run of identical digits" operation described here, we eventually reach one of 0, 1, or 5.
In other words, the conjecture is that eventually we reach 0 or join the trajectory shown here or the trajectory shown in A323830.
The number of steps to reach 0, 1, or 5 is given in A323832.

Crossrefs

Programs

  • Mathematica
    dad[n_]:=FromDigits[FixedPoint[Flatten[Select[Split[#],Length[#]==1&]]&,IntegerDigits[2n]]];NestList[dad,5,100] (* Paolo Xausa, Nov 14 2023 *)

Formula

a(n+1) = A321801(2*a(n)). For general numbers, the "repeatedly delete any run of identical digits" operation corresponds to repeatedly applying A321801. - Chai Wah Wu, Feb 11 2019

A306384 Start with n and repeatedly double it and apply the "delete any run of identical digits" operation described in A321801; a(n) is the number of steps needed to reach one of 0, 1, or 5, or -1 if none of these three numbers is ever reached.

Original entry on oeis.org

0, 0, 19, 12, 18, 0, 11, 23, 17, 4, 19, 1, 10, 29, 22, 32, 16, 5, 3, 47, 18, 15, 1, 20, 9, 2, 28, 26, 21, 13, 31, 24, 15, 1, 4, 23, 2, 18, 46, 21, 17, 51, 14, 15, 1, 24, 19, 2, 8, 10, 1, 33, 27, 24, 25, 1, 20, 19, 12, 18, 30, 1, 23, 7, 14, 29, 6, 20, 3
Offset: 0

Views

Author

Chai Wah Wu, Feb 12 2019

Keywords

Comments

Similar to A323832, but is different in that at each step, the "delete any run of identical digits" operation (A321801) is apply only once here, whereas in A323832, at each step after doubling the number, the operation A321801 is applied repeatedly until the number does not change any longer. The first term which differs from A323832 is a(66).
Conjecture: every number will eventually reach one of 0, 1, or 5.
Conjecture is true for n < 10^10.
2404877 takes 123 steps to reach 5 and is the largest value for a(n) for n < 10^7.
79620527 takes 131 steps to reach 5 and is the largest value for a(n) for n < 10^8.
769237841 takes 138 steps to reach 5 and is the largest value for a(n) for n < 10^9.
The numbers 4807736476 and 4807736509 both take 142 steps to reach 5 and this is the largest value for a(n) for n < 10^10.

Examples

			a(66) = 6: 66->132->264->528->1056->22->0. Contrast this with A323832(66) = 5: 66->132->264->528->1056->0.
		

Crossrefs

Programs

  • Python
    from re import split
    def A306384(n):
        mset, m, c = set(), n, 0
        while True:
            if m == 1 or m == 0 or m == 5:
                return c
            m = int('0'+''.join(d for d in split('(0+)|(1+)|(2+)|(3+)|(4+)|(5+)|(6+)|(7+)|(8+)|(9+)', str(2*m)) if d != '' and d != None and len(d) == 1))
            if m in mset:
                return -1
            mset.add(m)
            c += 1
Showing 1-5 of 5 results.