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 33 results. Next

A249146 a(0) = 0, after which a(n) gives the total number of runs of the same length as the maximal run in the binary representation of a(n-1) [i.e., A043276(a(n-1))] among the binary expansions of all previous terms, including the runs in a(n-1) itself.

Original entry on oeis.org

0, 1, 2, 4, 1, 6, 2, 9, 3, 4, 5, 15, 1, 16, 2, 19, 7, 1, 21, 26, 8, 2, 32, 1, 34, 3, 9, 10, 43, 11, 12, 14, 4, 15, 3, 16, 4, 17, 5, 58, 6, 18, 19, 21, 71, 8, 9, 22, 23, 10, 84, 24, 11, 26, 27, 29, 12, 31, 2, 99, 13, 34, 14, 15, 5, 108, 37, 38, 40, 16, 6, 41, 42, 130, 3, 43, 44, 46, 17, 18, 47, 7, 19, 49
Offset: 0

Views

Author

Antti Karttunen, Oct 22 2014

Keywords

Examples

			a(0) = 0 (by definition), and 0 is also '0' in binary we consider it to contain a single run of length one.
For n = 1, we see that in a(0) there is one run of length 1, which is total number of runs of length 1 so far in terms a(0) .. a(n-1), thus a(1) = 1.
For n = 2, we see that the only and thus also the longest run of a(1) = 1 ('1' also in binary) has occurred two times in total (once in a(0) and a(1)), thus a(2) = 2.
For n = 3, we see that there are two runs in a(2) = 2 ('10' in binary), both one bit long, and so far there has occurred four such runs in total (namely once in a(0) and a(1), twice in a(2)), thus a(3) = 4.
For n = 4, we see that the longest run of a(3) = 4 ('100' in binary) is two bits long, and it is so far the first and only two-bit run in the sequence, thus a(4) = 1.
For n = 5, we see that the longest run of a(4) = 1 ('1' in binary) is one bit long, and so far there has occurred 6 such one-bit runs in terms a(0) .. a(4), thus a(5) = 6.
For n = 6, we see that the longest run of a(5) = 6 ('110' in binary) is two bits long, and so far there has occurred 2 such two bit runs (once in terms a(3) and a(5)), thus a(6) = 2.
		

Crossrefs

A249145 Length of the maximal run in the binary representation of A241946: a(n) = A043276(A249146(n)).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Oct 24 2014

Keywords

Crossrefs

Programs

Formula

a(n) = A043276(A249146(n)).

A175358 Irregular array read by rows: Row n contains A043276(n) terms. a(n,m) = number of runs (of either 0 or 1) of length m in the binary representation of n.

Original entry on oeis.org

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

Views

Author

Leroy Quet, Apr 22 2010

Keywords

Examples

			23 in binary is 10111. There are two runs of length 1, zero runs of length 2, and one run of length 3. So, row 23 is (2,0,1).
		

Crossrefs

Programs

  • PARI
    row(n) = my (r=[]); while (n, my (v=valuation(n+(n%2),2)); r = concat(v, r); n\=2^v); my (f=vector(vecmax(r))); for (i=1, #r, f[r[i]]++); f \\ Rémy Sigrist, Feb 13 2019

Extensions

More terms from Rémy Sigrist, Feb 13 2019

A101211 Triangle read by rows: n-th row is length of run of leftmost 1's, followed by length of run of 0's, followed by length of run of 1's, etc., in the binary representation of n.

Original entry on oeis.org

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

Views

Author

Leroy Quet, Dec 13 2004

Keywords

Comments

Row n has A005811(n) elements. In rows 2^(k-1)..2^k-1 we have all the compositions (ordered partitions) of k. Other orderings of compositions: A066099, A108244, and A124734. - Jason Kimberley, Feb 09 2013
A043276(n) = largest term in n-th row. - Reinhard Zumkeller, Dec 16 2013
From the first comment it follows that we have a bijection between the positive integers and the set of all compositions. - Emeric Deutsch, Jul 11 2017
From Robert Israel, Jan 23 2018: (Start)
If n is even, row 2*n is row n with its last element incremented by 1, and row 2*n+1 is row n with 1 appended.
If n is odd, row 2*n+1 is row n with its last element incremented by 1, and row 2*n is row n with 1 appended. (End)

Examples

			Since 9 is 1001 in binary, the 9th row is 1,2,1.
Since 11 is 1011 in binary, the 11th row is 1,1,2.
Triangle begins:
  1;
  1,1;
  2;
  1,2;
  1,1,1;
  2,1;
  3;
  1,3;
		

Crossrefs

A070939(n) gives the sum of terms in row n, while A167489(n) gives the product of its terms. A090996 gives the first column. A227736 lists the terms of each row in reverse order.
Cf. also A227186.
Cf. A318927 (concatenation of each row), A318926 (concatenations of reversed rows).
Cf. A382255 (Heinz numbers of the rows: Product_k prime(T(n,k))).

Programs

  • Haskell
    import Data.List (group)
    a101211 n k = a101211_tabf !! (n-1) !! (k-1)
    a101211_row n = a101211_tabf !! (n-1)
    a101211_tabf = map (reverse . map length . group) $ tail a030308_tabf
    -- Reinhard Zumkeller, Dec 16 2013
    
  • Maple
    # Maple program due to W. Edwin Clark:
    Runs := proc (L) local j, r, i, k; j := 1: r[j] := L[1]: for i from 2 to nops(L) do if L[i] = L[i-1] then r[j] := r[j], L[i] else j := j+1: r[j] := L[i] end if end do: [seq([r[k]], k = 1 .. j)] end proc: RunLengths := proc (L) map(nops, Runs(L)) end proc: c := proc (n) ListTools:-Reverse(convert(n, base, 2)): RunLengths(%) end proc: # Row n is obtained with the command c(n). - Emeric Deutsch, Jul 03 2017
    # Maple program due to W. Edwin Clark, yielding the integer ind corresponding to a given composition (the index of the composition):
    ind := proc (x) local X, j, i: X := NULL: for j to nops(x) do if type(j, odd) then X := X, seq(1, i = 1 .. x[j]) end if: if type(j, even) then X := X, seq(0, i = 1 .. x[j]) end if end do: X := [X]: add(X[i]*2^(nops(X)-i), i = 1 .. nops(X)) end proc; # Clearly, ind(c(n))= n. - Emeric Deutsch, Jan 23 2018
  • Mathematica
    Table[Length /@ Split@ IntegerDigits[n, 2], {n, 38}] // Flatten (* Michael De Vlieger, Jul 11 2017 *)
  • PARI
    apply( {A101211_row(n)=Vecrev((n=vecextract([-1..exponent(n)], bitxor(2*n, bitor(n,1))))[^1]-n[^-1])}, [1..19]) \\ replacing older code by M. F. Hasler, Mar 24 2025
  • Python
    from itertools import groupby
    def arow(n): return [len(list(g)) for k, g in groupby(bin(n)[2:])]
    def auptorow(rows):
        alst = []
        for i in range(1, rows+1): alst.extend(arow(i))
        return alst
    print(auptorow(38)) # Michael S. Branicky, Oct 02 2021
    

Formula

a(n) = A227736(A227741(n)) = A227186(A056539(A227737(n)),A227740(n)) - Antti Karttunen, Jul 27 2013

Extensions

More terms from Emeric Deutsch, Apr 12 2005

A043290 Maximal run length in base 16 representation of n.

Original entry on oeis.org

1, 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, 1, 2, 1, 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, 1, 2, 1, 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, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    A043290[n_]:=Max[Map[Length,Split[IntegerDigits[n,16]]]];Array[A043290,100] (* Paolo Xausa, Sep 27 2023 *)
  • PARI
    A043290(n,b=16)={my(m,c=1);while(n>0,n%b==(n\=b)%b && c++ && next;m=max(m,c);c=1);m} \\ Use optional 2nd arg to get sequences A043276 through A043289. - M. F. Hasler, Jul 23 2013
    
  • Python
    from itertools import groupby
    def A043290(n): return max(len(list(g)) for k, g in groupby(hex(n)[2:])) # Chai Wah Wu, Mar 09 2023

Extensions

More terms from Antti Karttunen, Sep 21 2018

A353931 Least run-sum of the prime indices of n.

Original entry on oeis.org

0, 1, 2, 2, 3, 1, 4, 3, 4, 1, 5, 2, 6, 1, 2, 4, 7, 1, 8, 2, 2, 1, 9, 2, 6, 1, 6, 2, 10, 1, 11, 5, 2, 1, 3, 2, 12, 1, 2, 3, 13, 1, 14, 2, 3, 1, 15, 2, 8, 1, 2, 2, 16, 1, 3, 3, 2, 1, 17, 2, 18, 1, 4, 6, 3, 1, 19, 2, 2, 1, 20, 3, 21, 1, 2, 2, 4, 1, 22, 3, 8, 1
Offset: 1

Views

Author

Gus Wiseman, Jun 07 2022

Keywords

Comments

A prime index of n is a number m such that prime(m) divides n. The multiset of prime indices of n is row n of A112798.
Every sequence can be uniquely split into a sequence of non-overlapping runs. For example, the runs of (2,2,1,1,1,3,2,2) are ((2,2),(1,1,1),(3),(2,2)), with sums (4,3,3,4).

Examples

			The prime indices of 72 are {1,1,1,2,2}, with run-sums {3,4}, so a(72) = 3.
		

Crossrefs

Positions of first appearances are A008578.
For run-lengths instead of run-sums we have A051904, greatest A051903.
For run-sums and binary expansion we have A144790, greatest A038374.
For run-lengths and binary expansion we have A175597, greatest A043276.
Distinct run-sums are counted by A353835, weak A353861.
The greatest run-sum is given by A353862.
A001222 counts prime factors, distinct A001221.
A005811 counts runs in binary expansion.
A056239 adds up prime indices, row sums of A112798 and A296150.
A124010 gives prime signature, sorted A118914.
A304442 counts partitions with all equal run-sums, compositions A353851.
A353832 represents the operation of taking run-sums of a partition.
A353833 ranks partitions with all equal run sums, nonprime A353834.
A353838 ranks partitions with all distinct run-sums, counted by A353837.
A353840-A353846 pertain to partition run-sum trajectory.

Programs

  • Mathematica
    Table[Min@@Cases[FactorInteger[n],{p_,k_}:>PrimePi[p]*k],{n,100}]

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
Showing 1-10 of 33 results. Next