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

A215879 Written in base 3, n ends in a(n) consecutive nonzero digits.

Original entry on oeis.org

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

Views

Author

M. F. Hasler, Aug 25 2012

Keywords

Comments

Somehow complementary to A007949, the 3-adic valuation of n.
The base 2 analog of this sequence essentially coincides with the 2-adic valuation A007814 (up to a shift in the index).
One gets back the same sequence by concatenation of the pattern (0,1,1) successively multiplied by a(n)+1 = 1, 2, 2, 1, 3, 3, ... for n = 0, 1, 2, 3, 4, 5, .... This is equivalent to the formula (a(n)+1)*(0, 1, 1) = a(3n, 3n+1, 3n+2). - M. F. Hasler, Aug 26 2012, corrected Aug 23 2022
a(A008585(n)) = 0; a(A001651(n)) > 0. - Reinhard Zumkeller, Dec 28 2012

Examples

			The numbers 0, 1, 2, 3, 4, 5, 6, 7 are written in base 3 as 0, 1, 2, 10, 11, 12, 20, 21 and thus end in a(0..7) = 0, 1, 1, 0, 2, 2, 0, 2 nonzero digits.
		

Crossrefs

The base-4, base-5 and base-10 analogs of this sequence are given in A215883, A215884 and A215887.
Cf. A007089.

Programs

  • Haskell
    a215879 n = if t == 0 then 0 else a215879 n' + 1
                where (n',t) = divMod n 3
    -- Reinhard Zumkeller, Dec 28 2012
    
  • Mathematica
    cnzd[n_]:=Module[{idn3=IntegerDigits[n,3],len},len=Length[idn3];Which[ idn3[[len]] == 0,0,Position[idn3,0]=={},len,True,len-Position[idn3,0] [[-1,1]]]]; Array[cnzd,110,0] (* Harvey P. Dale, Jun 07 2016 *)
  • PARI
    A215879(n,b=3)=n=divrem(n,b); for(c=0,oo,n[2]||return(c); n=divrem(n[1],b))
    
  • PARI
    a(n)=my(k);while(n%3,n\=3;k++);k \\ Charles R Greathouse IV, Sep 26 2013
    
  • Python
    def A215879(n):
        c = 0
        while (a:=divmod(n,3))[1]:
            c += 1
            n = a[0]
        return c # Chai Wah Wu, Oct 15 2022

Formula

a(3^(t+1)*k+m) = t for 3^t > m > 3^(t-1).
a(3n) = 0, a(3n+1) = a(3n+2) = a(n)+1. - M. F. Hasler, Aug 26 2012, corrected thanks to a remark from Jianing Song, Aug 23 2022

A215887 Written in decimal, n ends in a(n) consecutive nonzero digits.

Original entry on oeis.org

0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0
Offset: 0

Views

Author

M. F. Hasler, Aug 25 2012

Keywords

Comments

Sequences A215879, A215883 and A215884 are the base 3, 4 and 5 analogs, while the base 2 analog of this sequence coincides (up to a shift in the index) with the 2-adic valuation A007814, see comments there.
Starting indexing with k=0 for the rightmost digit, a(n) gives the index of the least significant zero in the decimal representation of n. This may also be the index of the leading zero if there are no zeros in the number itself (A052382). - Antti Karttunen, Dec 07 2017
First occurrence of k is A002275(k). - Robert G. Wilson v, Dec 07 2017

Examples

			Numbers which are multiples of 10 have no nonzero digit at their (right) end, thus a(10*k) = 0.
If numbers are congruent to 1,...,9 mod 100, then they end in a nonzero digit, but do not have more than 1 concatenated nonzero digits at their right end: Thus, a(100k+m)=1 for 0 < m < 10.
In the same way, a(k*10^(e+1)+m) = e if 10^e > m > 10^(e-1).
		

Crossrefs

Cf. A002275, A052382, A339012 (factorial base).

Programs

  • Mathematica
    Table[Which[Divisible[n,10],0,FreeQ[IntegerDigits[n],0], IntegerLength[ n], True, Position[ Reverse[ IntegerDigits[n]],0]-1],{n,0,110}] // Flatten (* Harvey P. Dale, Sep 05 2017 *)
    f[n_] := Block[{c = 0, m = n}, While[Mod[m, 10] > 0, m = Floor[m/10]; c++]; c]; Array[f, 105, 0] (* Robert G. Wilson v, Dec 07 2017 *)
  • PARI
    a(n,b=10)= n=divrem(n,b); for(c=0,9e9, n[2] || return(c); n=divrem(n[1],b))
    
  • PARI
    a(n)=my(k);while(n%10, n\=10; k++); k \\ Charles R Greathouse IV, Sep 26 2013

Extensions

More terms from Antti Karttunen, Dec 07 2017

A215884 Written in base 5, n ends in a(n) consecutive nonzero digits.

Original entry on oeis.org

0, 1, 1, 1, 1, 0, 2, 2, 2, 2, 0, 2, 2, 2, 2, 0, 2, 2, 2, 2, 0, 2, 2, 2, 2, 0, 1, 1, 1, 1, 0, 3, 3, 3, 3, 0, 3, 3, 3, 3, 0, 3, 3, 3, 3, 0, 3, 3, 3, 3, 0, 1, 1, 1, 1, 0, 3, 3, 3, 3, 0, 3, 3, 3, 3, 0, 3, 3, 3, 3, 0, 3, 3, 3, 3, 0, 1, 1, 1, 1, 0, 3, 3, 3, 3, 0, 3, 3, 3, 3, 0, 3, 3, 3, 3, 0, 3, 3, 3, 3, 0, 1, 1, 1, 1, 0, 3
Offset: 0

Views

Author

M. F. Hasler, Aug 25 2012

Keywords

Comments

Sequences A215879, A215883 and A215887 are the base 3, 4 and 10 analogs, while the base 2 analog of this sequence coincides (up to a shift in the index) with the 2-adic valuation A007814, cf. comments there.

Examples

			The numbers 24,...,31 are written in base 5 as 44,100,101,102,103,104,110,111 and thus end in a string of a(24..31)=2,0,1,1,1,1,0,3 nonzero digits.
		

Programs

  • Mathematica
    cnzd[n_]:=Module[{c=Split[If[#>0,1,0]&/@IntegerDigits[n,5]]},If[FreeQ[ c[[-1]],0],Total[c[[-1]]],0]]; Array[cnzd,120,0] (* Harvey P. Dale, Jan 03 2023 *)
  • PARI
    a(n,b=5)=n=divrem(n,b); for(c=0,9e9,n[2]||return(c); n=divrem(n[1],b))
    
  • PARI
    a(n)=my(k);while(n%5,n\=5;k++);k \\ Charles R Greathouse IV, Sep 26 2013
Showing 1-3 of 3 results.