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-10 of 14 results. Next

A043276 a(n) = maximal run length in base-2 representation of n.

Original entry on oeis.org

1, 1, 2, 2, 1, 2, 3, 3, 2, 1, 2, 2, 2, 3, 4, 4, 3, 2, 2, 2, 1, 2, 3, 3, 2, 2, 2, 3, 3, 4, 5, 5, 4, 3, 3, 2, 2, 2, 3, 3, 2, 1, 2, 2, 2, 3, 4, 4, 3, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 5, 6, 6, 5, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 3, 4, 4, 3, 2, 2, 2, 1, 2, 3, 3, 2, 2, 2, 3, 3, 4, 5, 5, 4, 3, 3, 2, 2, 2, 3, 3, 2
Offset: 1

Views

Author

Keywords

Comments

First occurrence of k is when n=2^k-1 and there is no last occurrence. - Robert G. Wilson v, Dec 14 2008
Sequences A000975, A037969, A037970, A037971 list numbers for which a(n)=1, a(n)=2, a(n)=3, a(n)=4. - M. F. Hasler, Jul 23 2013
a(n) = max(A101211(n,k): k = 1..A005811(n)). - Reinhard Zumkeller, Dec 16 2013

Crossrefs

Cf. A043277-A043290 for base-3 to base-16 analogs.

Programs

  • Haskell
    a043276 = maximum . a101211_row  -- Reinhard Zumkeller, Dec 16 2013
    
  • Maple
    A043276 := proc(n)
        local a,rl,i ;
        if n > 0 then
            rl := 1 ;
        else
            rl := 0 ;
        end if;
        a := rl ;
        dgs := convert(n,base,2) ;
        for i from 2 to nops(dgs) do
            if op(i,dgs) = op(i-1,dgs) then
                rl := rl+1 ;
                a := max(a,rl) ;
            else
                a := max(a,rl) ;
                rl := 1;
            end if;
        end do:
        a ;
    end proc:
    seq(A043276(n),n=1...80) ; # R. J. Mathar, Jun 04 2021
  • Mathematica
    f[n_] := Max @@ Length /@ Split@IntegerDigits[n, 2]; Array[f, 105] (* Robert G. Wilson v, Dec 14 2008 *)
  • PARI
    A043276(n,b=2)={my(m,c=1);while(n>0,n%b==(n\=b)%b && c++ && next;m=max(m,c);c=1);m} \\ M. F. Hasler, Jul 23 2013
    
  • PARI
    a(n)=my(r,t); while(n, t=valuation(n,2); if(t>r, r=t); n>>=t; t=valuation(n+1,2); if(t>r, r=t); n>>=t); r \\ Charles R Greathouse IV, Nov 02 2016
    
  • Python
    from itertools import groupby
    def A043276(n): return max(len(list(g)) for k, g in groupby(bin(n)[2:])) # Chai Wah Wu, Mar 09 2023

Extensions

More terms from Robert G. Wilson v, Dec 14 2008

A043277 Maximal run length in base 3 representation of n.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Sequences A031941, A037973, A037974, A037975 list numbers for which a(n)=1, a(n)=2, a(n)=3, a(n)=4. - M. F. Hasler, Jul 23 2013
A003462 gives the positions of records. - R. J. Mathar, Jul 26 2015

Crossrefs

Cf. A043276-A043290 for base-2 to base-16 analogs.

Programs

  • Maple
    mRunLen := proc(L)
        if nops(L) = 0 then
            0;
        else
            a := 1 ;
            for i from 2 to nops(L) do
                if op(i,L) = op(i-1,L) then
                    a := a+1 ;
                else
                    a := max(a, procname([op(i..nops(L),L)])) ;
                    break;
                end if;
            end do:
            a ;
        end if ;
    end proc:
    A043277 := proc(n)
        convert(n,base,3) ;
        mRunLen(%) ;
    end proc:
    seq(A043277(n),n=1..100) ; # R. J. Mathar, Jul 26 2015
  • Mathematica
    Table[Max[Length/@Split[IntegerDigits[n,3]]],{n,90}] (* Harvey P. Dale, Aug 24 2019 *)
  • PARI
    A043277(n, b=3)={my(m,c=1); while(n>0, n%b==(n\=b)%b && c++ && next; m=max(m, c); c=1); m} \\ - M. F. Hasler, Jul 23 2013

A043289 Maximal run length in base-15 representation of n.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
Offset: 1

Views

Author

Keywords

Crossrefs

Cf. A043276-A043290 for base-2 to base-16 analogs.
Cf. A135518 (positions of records, also the first occurrence of each n).

Programs

  • Maple
    A043289 := proc(n) dgs := convert(n,base,15) ; a :=1 ; rl :=1 ; for i from 2 to nops(dgs) do if op(i,dgs) <> op(i-1,dgs) then a := max(a,rl) ; rl := 1; else rl := rl+1 ; end if; end do: a := max(a,rl) ; a; end proc; # R. J. Mathar, Jan 11 2012
  • Mathematica
    A043289[n_]:=Max[Map[Length,Split[IntegerDigits[n,15]]]];Array[A043289,100] (* Paolo Xausa, Sep 27 2023 *)
  • PARI
    A043289(n,b=15){=my(m,c=1);while(n>0,n%b==(n\=b)%b&&c++&&next;m=max(m,c);c=1);m} \\ M. F. Hasler, Jul 23 2013

A043278 Maximal run length in base 4 representation of n.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Sequences A031942 (or A043090), A037977, A037978, A037979 list numbers for which a(n)=1, a(n)=2, a(n)=3, a(n)=4. - M. F. Hasler, Jul 23 2013

Crossrefs

Cf. A043276-A043290 for base-2 to base-16 analogs.

Programs

  • Maple
    mRunLen := proc(L)
        if nops(L) = 0 then
            0;
        else
            a := 1 ;
            for i from 2 to nops(L) do
                if op(i,L) = op(i-1,L) then
                    a := a+1 ;
                else
                    a := max(a, procname([op(i..nops(L),L)])) ;
                    break;
                end if;
            end do:
            a ;
        end if ;
    end proc:
    A043278 := proc(n)
        convert(n,base,4) ;
        mRunLen(%) ;
    end proc: # R. J. Mathar, Jul 26 2015
  • Mathematica
    Table[Max[Length/@Split[IntegerDigits[n,4]]],{n,100}] (* Harvey P. Dale, Jan 21 2014 *)
  • PARI
    A043278(n, b=4)={my(m,c=1); while(n>0, n%b==(n\=b)%b && c++ && next; m=max(m, c); c=1); m} \\ M. F. Hasler, Jul 23 2013

A043283 Maximal run length in base-9 representation of n.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2
Offset: 1

Views

Author

Keywords

Crossrefs

Cf. A007095.
Cf. A043276-A043290 for base-2 to base-16 analogs.
Cf. A002452 (gives the positions of records, the first occurrence of each n).
Cf. also A044940.

Programs

  • Mathematica
    A043283[n_]:=Max[Map[Length,Split[IntegerDigits[n,9]]]];Array[A043283,100] (* Paolo Xausa, Sep 27 2023 *)
  • PARI
    A043283(n, b=9)={my(m, c=1); while(n>0, n%b==(n\=b)%b && c++ && next; m=max(m, c); c=1); m} \\ M. F. Hasler, Jul 23 2013

A043279 Maximal run length in base 5 representation of n.

Original entry on oeis.org

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

Views

Author

Keywords

Crossrefs

Cf. A007091.
Cf. A043276-A043290 for base-2 to base-16 analogs.

Programs

  • Mathematica
    A043279[n_]:=Max[Map[Length,Split[IntegerDigits[n,5]]]];Array[A043279,100] (* Paolo Xausa, Sep 27 2023 *)
  • PARI
    A043279(n, b=5)={my(m,c=1); while(n>0, n%b==(n\=b)%b && c++ && next; m=max(m, c); c=1); m} \\ M. F. Hasler, Jul 23 2013

A043281 Maximal run length in base-7 representation of n.

Original entry on oeis.org

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

Views

Author

Keywords

Crossrefs

Cf. A007093 (base 7).
Cf. A043276-A043290 for base-2 to base-16 analogs.

Programs

  • Mathematica
    Max[Length/@Split[IntegerDigits[#,7]]]&/@Range[100] (* Harvey P. Dale, Mar 30 2016 *)
  • PARI
    A043281(n, b=7)={my(m,c=1); while(n>0, n%b==(n\=b)%b&&c++&&next; m=max(m, c); c=1); m} \\ M. F. Hasler, Jul 23 2013
    
  • Python
    from itertools import groupby
    from sympy.ntheory.factor_ import digits
    def A043281(n): return max(len(list(g)) for k, g in groupby(digits(n,7)[1:])) # Chai Wah Wu, Mar 09 2023

A043284 Maximal run length in base-10 representation of n.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2
Offset: 1

Views

Author

Keywords

Comments

The first term larger than 2 is a(111) = 3. - M. F. Hasler, Jul 21 2013

Crossrefs

Cf. A043276-A043290 for base-2 to base-16 analogs.
Cf. A030556-A030561, A030575-A030580 (related to base-6 run lengths).
Cf. A227186, A227188, A101211, A005811 (related to base-2 run lengths).

Programs

  • Mathematica
    A043284[n_]:=Max[Map[Length,Split[IntegerDigits[n]]]];Array[A043284,100] (* Paolo Xausa, Sep 27 2023 *)
  • PARI
    A043284(n)={my(m,c=1);while(n>0,n%10==(n\=10)%10 && c++ && next;m=max(m,c);c=1);m} \\ M. F. Hasler, Jul 23 2013

Formula

For n < 111, a(n) = 1 except for a(n) = 2 when n==0 (mod 11) or n = 100. - M. F. Hasler, Jul 21 2013

Extensions

Data completed up to a(100), first difference with A083230, by M. F. Hasler, Oct 18 2019

A043280 Maximal run length in base 6 representation of n.

Original entry on oeis.org

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

Views

Author

Keywords

Crossrefs

Cf. A007092.
Cf. A043276-A043290 for base-2 to base-16 analogs.

Programs

  • Mathematica
    A043280[n_]:=Max[Map[Length,Split[IntegerDigits[n,6]]]];Array[A043280,100] (* Paolo Xausa, Sep 27 2023 *)
  • PARI
    A043280(n, b=6)={my(m,c=1); while(n>0, n%b==(n\=b)%b&&c++&&next; m=max(m, c); c=1); m} \\ M. F. Hasler, Jul 23 2013

A043282 Maximal run length in base 8 representation of n.

Original entry on oeis.org

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

Views

Author

Keywords

Crossrefs

Cf. A007094 (base 8).
Cf. A043276-A043290 for base-2 to base-16 analogs.

Programs

  • Mathematica
    A043282[n_]:=Max[Map[Length,Split[IntegerDigits[n,8]]]];Array[A043282,100] (* Paolo Xausa, Sep 27 2023 *)
  • PARI
    A043282(n, b=8)={my(m, c=1); while(n>0, n%b==(n\=b)%b && c++ && next; m=max(m, c); c=1); m} \\ M. F. Hasler, Jul 23 2013
    
  • Python
    from itertools import groupby
    def A043282(n): return max(len(list(g)) for k, g in groupby(oct(n)[2:])) # Chai Wah Wu, Mar 09 2023
Showing 1-10 of 14 results. Next