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.

A321536 Write n in base 10, lengthen all the runs of successive identical digits by 1.

Original entry on oeis.org

0, 11, 22, 33, 44, 55, 66, 77, 88, 99, 1100, 111, 1122, 1133, 1144, 1155, 1166, 1177, 1188, 1199, 2200, 2211, 222, 2233, 2244, 2255, 2266, 2277, 2288, 2299, 3300, 3311, 3322, 333, 3344, 3355, 3366, 3377, 3388, 3399, 4400, 4411, 4422, 4433, 444, 4455, 4466
Offset: 0

Views

Author

N. J. A. Sloane, Nov 13 2018

Keywords

Comments

A321537(a(n)) = n. Compare A321538.

Examples

			10 -> 1100, so a(10)=1100; 11->111, so a(11)=111.
		

Crossrefs

A base-10 analog of A175046.

Programs

  • Mathematica
    a[n_] := FromDigits@ Flatten[ Append[ #, Last@#] & /@ Split@ IntegerDigits[ n]]; a /@ Range[0, 46] (* Giovanni Resta, Nov 13 2018 *)
  • PARI
    a(n)={my(v=digits(n)); my(L=List()); for(i=1, #v, my(t=v[i]); if(i==1 || t<>v[i-1], listput(L,t)); listput(L,t)); fromdigits(Vec(L))} \\ Andrew Howroyd, Nov 13 2018
  • Python
    from re import split
    def A321536(n):
        return int(''.join(d+d[0] for d in split('(0+)|(1+)|(2+)|(3+)|(4+)|(5+)|(6+)|(7+)|(8+)|(9+)',str(n)) if d != '' and d != None)) # Chai Wah Wu, Nov 13 2018
    

Extensions

More terms from Giovanni Resta, Nov 13 2018

A321803 Keep only consecutive identical decimal digits of n; write 0 if all digits disappear.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 99, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 111, 11, 11, 11, 11, 11, 11, 11, 11, 0, 0, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 99
Offset: 0

Views

Author

Chai Wah Wu, Nov 19 2018

Keywords

Comments

Consecutive identical digits of n are kept. Leading zeros are erased unless the result is 0. If all digits are erased, we write 0 for the result (A321804 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 A321797 for n < 121.
Differs from A321538 for the first time at n = 11011. - Chai Wah Wu, Nov 29 2018

Examples

			123321 becomes 33, 1123 becomes 11, 112331 becomes 1133, and 100223 becomes 22 (as we don't accept leading zeros). Note that 12321 disappears immediately and we get 0.
		

Crossrefs

Programs

  • Mathematica
    Array[FromDigits[Join @@ Select[Split@ IntegerDigits@ #, Length@ # >= 2 &] /. {} -> {0}] &, 200, 0] (* Michael De Vlieger, Nov 20 2018 *)
  • Python
    from re import split
    def A321803(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))
Showing 1-2 of 2 results.