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

A048793 List giving all subsets of natural numbers arranged in standard statistical (or Yates) order.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

For n>0: first occurrence of n in row 2^(n-1), and when the table is seen as a flattened list at position n*2^(n-1)+1, cf. A005183. - Reinhard Zumkeller, Nov 16 2013
Row n lists the positions of 1's in the reversed binary expansion of n. Compare to triangles A112798 and A213925. - Gus Wiseman, Jul 22 2019

Examples

			From _Gus Wiseman_, Jul 22 2019: (Start)
Triangle begins:
  {}
  1
  2
  1  2
  3
  1  3
  2  3
  1  2  3
  4
  1  4
  2  4
  1  2  4
  3  4
  1  3  4
  2  3  4
  1  2  3  4
  5
  1  5
  2  5
  1  2  5
  3  5
(End)
		

References

  • S. Hedayat, N. J. A. Sloane and J. Stufken, Orthogonal Arrays, Springer-Verlag, NY, 1999, p. 249.

Crossrefs

Cf. A048794.
Row lengths are A000120.
First column is A001511.
Heinz numbers of rows are A019565.
Row sums are A029931.
Reversing rows gives A272020.
Subtracting 1 from each term gives A133457; subtracting 1 and reversing rows gives A272011.
Indices of relatively prime rows are A291166 (see also A326674); arithmetic progressions are A295235; rows with integer average are A326669 (see also A326699/A326700); pairwise coprime rows are A326675.

Programs

  • C
    #include 
    #include 
    #define USAGE "Usage: 'A048793 num' where num is the largest number to use creating sets.\n"
    #define MAX_NUM 10
    #define MAX_ROW 1024
    int main(int argc, char *argv[]) {
      unsigned short a[MAX_ROW][MAX_NUM]; signed short old_row, new_row, i, j, end;
      if (argc < 2) { fprintf(stderr, USAGE); return EXIT_FAILURE; }
      end = atoi(argv[1]); end = (end > MAX_NUM) ? MAX_NUM: end;
      for (i = 0; i < MAX_ROW; i++) for ( j = 0; j < MAX_NUM; j++) a[i][j] = 0;
      a[1][0] = 1; new_row = 2;
      for (i = 2; i <= end; i++) {
        a[new_row++ ][0] = i;
        for (old_row = 1; a[old_row][0] != i; old_row++) {
          for (j = 0; a[old_row][j] != 0; j++) { a[new_row][j] = a[old_row][j]; }
          a[new_row++ ][j] = i;
        }
      }
      fprintf(stdout, "Values: 0");
      for (i = 1; a[i][0] != 0; i++) for (j = 0; a[i][j] != 0; j++) fprintf(stdout, ",%d", a[i][j]);
      fprintf(stdout, "\n"); return EXIT_SUCCESS
    }
    
  • Haskell
    a048793 n k = a048793_tabf !! n !! k
    a048793_row n = a048793_tabf !! n
    a048793_tabf = [0] : [1] : f [[1]] where
       f xss = yss ++ f (xss ++ yss) where
         yss = [y] : map (++ [y]) xss
         y = last (last xss) + 1
    -- Reinhard Zumkeller, Nov 16 2013
  • Maple
    T:= proc(n) local i, l, m; l:= NULL; m:= n;
          if n=0 then return 0 fi; for i while m>0 do
          if irem(m, 2, 'm')=1 then l:=l, i fi od; l
        end:
    seq(T(n), n=0..50);  # Alois P. Heinz, Sep 06 2014
  • Mathematica
    s[0] = {{}}; s[n_] := s[n] = Join[s[n - 1], Append[#, n]& /@ s[n - 1]]; Join[{0}, Flatten[s[6]]] (* Jean-François Alcover, May 24 2012 *)
    Table[Join@@Position[Reverse[IntegerDigits[n,2]],1],{n,30}] (* Gus Wiseman, Jul 22 2019 *)

Formula

Constructed recursively: subsets that include n are obtained by appending n to all earlier subsets.

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Apr 11 2000

A067255 Irregular triangle read by rows: row n gives exponents in prime factorization of n.

Original entry on oeis.org

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

Views

Author

Jeppe Stig Nielsen, Feb 20 2002

Keywords

Comments

Row lengths are given by A061395(n), n >= 2: [1, 2, 1, 3, 2, 4, 1, 2, ... ].
This sequence contains every finite sequence of nonnegative integers. - Franklin T. Adams-Watters, Jun 22 2005

Examples

			1 = 2^0
2 = 2^1
3 = 2^0 3^1
4 = 2^2
5 = 2^0 3^0 5^1
6 = 2^1 3^1
... and reading the exponents gives the sequence.
Since for example 99=2^0*3^2*5^0*7^0*11^1, we use this symbol for ninety-nine: 99: {0,2,0,0,1}. Concatenating all the symbols for 1,2,3,4,5,6,..., we get the sequence.
		

Crossrefs

Cf. A133457.
Cf. A001222 (row sums), A061395 (lengths of rows n >= 2).
Cf. A007814 (left edge), A071178 (right edge).
Other versions: A054841 (rows reversed and concatenated into a decimal number), A060175 (square array), A082786 (regular triangle), A124010 (with 0's removed, excepting row 1), A143078 (another irregular triangle).

Programs

  • Haskell
    a067255 n k = a067255_tabf !! (n-1) !! (k-1)
    a067255_row 1 = [0]
    a067255_row n = f n a000040_list where
       f 1 _      = []
       f u (p:ps) = g u 0 where
         g v e = if m == 0 then g v' (e + 1) else e : f v ps
                 where (v',m) = divMod v p
    a067255_tabf = map a067255_row [1..]
    -- Reinhard Zumkeller, Jun 11 2013
  • Mathematica
    f[n_] := If[n == 1, {0}, Function[f, ReplacePart[Table[0, {PrimePi[f[[-1, 1]]]}], #] &@ Map[PrimePi@ First@ # -> Last@ # &, f]]@ FactorInteger@ n]; Array[f, 29] // Flatten (* Michael De Vlieger, Mar 08 2019 *)

A073642 Replace 2^k in the binary representation of n with k (i.e., if n = 2^b + 2^c + 2^d + ... then a(n) = b + c + d + ...).

Original entry on oeis.org

0, 0, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 5, 5, 6, 6, 4, 4, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 9, 9, 10, 10, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 10, 10, 11, 11, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, 13, 13, 14, 14, 15, 15, 6, 6, 7, 7, 8, 8, 9, 9, 9, 9, 10, 10, 11, 11, 12, 12, 10, 10, 11, 11, 12, 12, 13, 13
Offset: 0

Views

Author

Benoit Cloitre, Aug 29 2002

Keywords

Comments

For n >= 1, a(n) is the n-th row sum of the irregular triangle A133457. - Vladimir Shevelev, Dec 14 2015
For n >= 0, 2^a(n) is the number of partitions of n whose dimension (given by the hook-length formula) is an odd integer. See the MacDonald reference. - Arvind Ayyer, May 12 2016

Examples

			9 = 2^3 + 2^0, hence a(9) = 3 + 0 = 3;
25 = 2^4 + 2^3 + 2^0, hence a(25) = 4 + 3 + 0 = 7.
		

Crossrefs

Programs

  • Haskell
    a073642 = sum . zipWith (*) [0..] . a030308_row
    -- Reinhard Zumkeller, Jun 01 2013
    
  • Maple
    A073642 := proc(n)
            local bdgs ;
            bdgs := convert(n,base,2) ;
            add( op(i,bdgs)*(i-1), i=1..nops(bdgs)) ;
    end proc: # R. J. Mathar, Nov 17 2011
  • Mathematica
    Total[Flatten[Position[Rest[Reverse[IntegerDigits[#, 2]]], 1]]] & /@ Range[0, 87] (* Jayanta Basu, Jul 03 2013 *)
  • PARI
    a(n)=sum(i=1,length(binary(n)), component(binary(n),i)*(length(binary(n))-i))
    
  • PARI
    a(n) = my(b=binary(n)); b*-[-#b+1..0]~; \\ Ruud H.G. van Tol, Oct 17 2023
    
  • Python
    def A073642(n):
        a, i = 0, 0
        while n > 0:
            a, n, i = a+(n%2)*i, n//2, i+1
        return a
    print([A073642(n) for n in range(30)]) # A.H.M. Smeets, Aug 17 2019

Formula

a(n) = log_2(A059867(n)).
It seems that for n > 10 a(n) < n/(2*log(n)) and that Sum_{k=1..n} a(k) is asymptotic to C*n*log(n)^2 with 1/2 > C > 0.47.
a(1)=0, a(2n) = a(n) + e1(n), a(2n+1) = a(2n), where e1(n) = A000120(n). - Ralf Stephan, Jun 19 2003
If n = 2^log_2(n) then a(n) = log_2(n); otherwise, a(n) = log_2(n) + a(n-2^log_2(n)), where log_2=A000523. a(2*n+1) = a(2*n), as the least significant bit of n does not contribute to a(n). - Reinhard Zumkeller, Aug 17 2003, edited by A.H.M. Smeets, Aug 17 2019
a(n) = A029931(floor(n/2)). - Franklin T. Adams-Watters, Oct 22 2011
a(n) = Sum_{k=0..A070939(n)-1} k*A030308(n,k). - Reinhard Zumkeller, Jun 01 2013
Conjecture: a(n) = (3*A011371(n) - Sum_{k=1..n} A007814(k)^2)/2 for n > 0. - Velin Yanev, Sep 09 2017
G.f.: (1/(1 - x)) * Sum_{k>=1} k*x^(2^k)/(1 + x^(2^k)). - Ilya Gutkovskiy, Aug 17 2019
From A.H.M. Smeets, Aug 17 2019: (Start)
floor(log_2(n)) <= a(n) <= floor(log_2(n+2)*(log_2(n+2)-1)/2), n > 0.
Lower bound: floor(log_2(n)) = a(n) for n = 2^m or n = 2^m+1, m >= 0.
Upper bound: a(n) = floor(log_2(n+2)*(log_2(n+2)-1)/2) for n = 2^m-2 or n = 2^m-1, m >= 0. (End)
From Aayush Soni, Feb 12 2022: (Start)
For k < 2^n, a((2^n)+k) + a((2^n)-k-1) = n*(n+1)/2.
Proof: Any (n+1)-bit number 111...11_2 can only be split into two numbers 2^n + k and 2^n - k - 1 which never share any bits in common. Since a(111...11_2) = 0+1+2+...+n, this implies the stated formula. (End)

Extensions

a(0)=0 and offset corrected by Philippe Deléham, Apr 20 2009

A003071 Sorting numbers: maximal number of comparisons for sorting n elements by list merging.

Original entry on oeis.org

0, 1, 3, 5, 9, 11, 14, 17, 25, 27, 30, 33, 38, 41, 45, 49, 65, 67, 70, 73, 78, 81, 85, 89, 98, 101, 105, 109, 115, 119, 124, 129, 161, 163, 166, 169, 174, 177, 181, 185, 194, 197, 201, 205, 211, 215, 220, 225, 242, 245, 249, 253, 259, 263, 268, 273, 283, 287, 292, 297, 304
Offset: 1

Views

Author

Keywords

Comments

The following sequences all appear to have the same parity: A003071, A029886, A061297, A092524, A093431, A102393, A104258, A122248, A128975. - Jeremy Gardiner, Dec 28 2008
a(A092246(n)) = A230720(n); a(A230709(n)) = A230721(n+1). - Reinhard Zumkeller, Oct 28 2013

References

  • D. E. Knuth, Art of Computer Programming, Vol. 3, Sections 5.2.4 and 5.3.1.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    a003071 n = 1 - 2 ^ last es +
       sum (zipWith (*) (zipWith (+) es [0..]) (map (2 ^) es))
       where es = reverse $ a133457_row n
    -- Reinhard Zumkeller, Oct 28 2013
  • Mathematica
    a[1] = 0; a[n_] := a[n] = a[n-1] + 2^IntegerExponent[n-1, 2] + DigitCount[n-1, 2, 1] - 1; Table[a[n], {n, 1, 61}] (* Jean-François Alcover, Feb 10 2012, after Henry Bottomley *)

Formula

Let n = 2^e_1 + 2^e_2 + ... + 2^e_t, e_1 > e_2 > ... > e_t >= 0, t >= 1. Then a(n) = 1 - 2^e_t + Sum_{k=1..t} (e_k + k - 1)*2^e_k [Knuth, Problem 14, Section 5.2.4].
a(n) = a(n-1) + A061338(n) = a(n-1) + A006519(n) + A000120(n) - 1 = n + A000337(A000523(n)) + a(n - 2^A000523(n)). a(2^k) = k*2^k + 1 = A002064(k). - Henry Bottomley, Apr 27 2001
G.f.: x/(1-x)^3 + 1/(1-x)^2*Sum(k>=1, (-1+(1-x)*2^(k-1))*x^2^k/(1-x^2^k)). - Ralf Stephan, Apr 17 2003

Extensions

More terms from David W. Wilson

A272011 Irregular triangle read by rows: strictly decreasing sequences of nonnegative numbers given in lexicographic order.

Original entry on oeis.org

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

Views

Author

Peter Kagey, Apr 17 2016

Keywords

Comments

Length of n-th row given by A000120(n);
Maximum of n-th row given by A000523(n);
Minimum of n-th row given by A007814(n);
GCD of n-th row given by A064894(n);
Sum of n-th row given by A073642(n + 1).
n-th row begins at index A000788(n - 1) for n > 0.
The first appearance of n is at A001787(n).
a(A001787(n) + 1) = a(A001787(n)) for all n > 0.
a(A001787(n) + 2) = 0 for all n > 0.
a(A001787(n) + 3) = a(A001787(n)) for all n > 1.
a(A001787(n) + 4) = 1 for all n > 1.
a(A001787(n) + 5) = a(A001787(n)) for all n > 1.
Row n < 1024 lists the digits of A262557(n). - M. F. Hasler, Dec 11 2019

Examples

			Row n is given by the exponents in the binary expansion of n. For example, row 5 = [2, 0] because 5 = 2^2 + 2^0.
Row 0: []
Row 1: [0]
Row 2: [1]
Row 3: [1, 0]
Row 4: [2]
Row 5: [2, 0]
Row 6: [2, 1]
Row 7: [2, 1, 0]
		

Crossrefs

Cf. A133457 gives the rows in reverse order.

Programs

  • Mathematica
    Map[Length[#] - Flatten[Position[#, 1]] &, IntegerDigits[Range[50], 2]] (* Paolo Xausa, Feb 13 2024 *)
  • PARI
    apply( A272011_row(n)=Vecrev(vecextract([0..exponent(n+!n)],n)), [0..39]) \\ For n < 2^10: row(n)=digits(A262557[n]). There are 2^k rows starting with k, they start at row 2^k. - M. F. Hasler, Dec 11 2019

A348296 Irregular table T(n, k), n > 0, k = 1..A000120(n), read by rows; the n-th contains, in ascending order, the distinct powers of 2 summing to n.

Original entry on oeis.org

1, 2, 1, 2, 4, 1, 4, 2, 4, 1, 2, 4, 8, 1, 8, 2, 8, 1, 2, 8, 4, 8, 1, 4, 8, 2, 4, 8, 1, 2, 4, 8, 16, 1, 16, 2, 16, 1, 2, 16, 4, 16, 1, 4, 16, 2, 4, 16, 1, 2, 4, 16, 8, 16, 1, 8, 16, 2, 8, 16, 1, 2, 8, 16, 4, 8, 16, 1, 4, 8, 16, 2, 4, 8, 16, 1, 2, 4, 8, 16, 32
Offset: 1

Views

Author

Rémy Sigrist, Jul 18 2022

Keywords

Examples

			Triangle T(n, k) begins:
  n   n-th row
  --  ------------
   1  [1]
   2  [2]
   3  [1, 2]
   4  [4]
   5  [1, 4]
   6  [2, 4]
   7  [1, 2, 4]
   8  [8]
   9  [1, 8]
  10  [2, 8]
  11  [1, 2, 8]
  12  [4, 8]
  13  [1, 4, 8]
  14  [2, 4, 8]
  15  [1, 2, 4, 8]
		

Crossrefs

Programs

  • Mathematica
    Array[DeleteCases[Union@ NumberExpand[#, 2], 0] &, 32] // Flatten (* Michael De Vlieger, Jul 19 2022 *)
  • PARI
    row(n) = { my (r=vector(hammingweight(n))); for (k=1, #r, n -= r[k] = 2^valuation(n, 2)); return (r) }

Formula

T(n, k) = 2^A133457(n, k).
T(n, 1) = A006519(n).
T(n, A000120(n)) = A053644(n).
Sum_{k = 1..A000120(n)} T(n, k) = n.
Sum_{k = 1..A000120(n)} T(n, k) * (-1)^(k-1) = A065620(n).
Product_{k = 1..A000120(n)} T(n, k) = A059867(n).
T(2*n, k) = 2*T(n, k).

A033922 Base-2 digital convolution sequence.

Original entry on oeis.org

1, 1, 1, 2, 1, 2, 2, 3, 2, 3, 3, 4, 3, 4, 4, 5, 1, 2, 2, 3, 2, 3, 3, 4, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, 4, 5, 5, 6, 5, 6, 6, 7, 3, 4, 4, 5, 4, 5, 5, 6, 5, 6, 6, 7, 6, 7, 7, 8, 2, 3, 3, 4, 3, 4, 4, 5, 4, 5, 5, 6, 5, 6, 6, 7, 3, 4, 4, 5, 4, 5
Offset: 0

Views

Author

Keywords

Comments

Definition: a(0) = 1; for n > 0, let the base-2 representation of n be 2^k_1 + ... + 2^k_i, then a(n) = a(k_1) + ... + a(k_i).
The sequence can be constructed as follows. Let r(n)=[x(1),x(2),...,x(2^n)] denote a run of 2^n elements. Then r(n+1) is a run of length 2^(n+1) defined as the concatenation of r(n) and [x(1)+x(n), x(2)+x(n), ..., x(2^n)+x(n)]. Letting x(1)=0 and x(2)=1 we get r(1)=[0,1], r(2)=[0, 1, 1, 2], r(3)=[0, 1, 1, 2, 1, 2, 2, 3], r(4)=[0, 1, 1, 2, 1, 2, 2, 3, 2, 3, 3, 4, 3, 4, 4, 5], etc. Replacing the leading zero by 1 in r(infinity) we get A033922. - Benoit Cloitre, Jan 10 2013
Number of 0's in Goodstein base-2 hereditary representation of n. For example, a(266)=5 once that 266 = 2^(2^(2^(2^0)+2^0)) + 2^(2^(2^0)+2^0) + 2^(2^0). - Flávio V. Fernandes, Jul 22 2025

Examples

			For example, 6 = 2^2 + 2^1, so a(6) = a(2) + a(1) = 2.
		

Crossrefs

Cf. A033639, A014221 (n such that a(n)=1), A206774 (first differences).

Programs

  • Maple
    a:= proc(n) option remember; local c, m, t; if n=0 then 1 else m:= n; c:=0; for t from 0 while m<>0 do c:= c+ `if`(irem(m, 2, 'm')=1, a(t), 0) od; c fi end: seq(a(n), n=0..120);  # Alois P. Heinz, Jul 13 2011
  • PARI
    al(n)=local(v,k,e);v=vector(n+1);v[1]=1;for(m=1,n,k=m;e=0;while(k>0,if(k%2,v[m+1]+=v[e+1]);e++;k\=2));v /* Benoit Cloitre, Jan 10 2013 */
    
  • PARI
    /* to compute quickly 2^m terms of the sequence */ m=10;v=[0,1];for(n=2,m,v=concat(v,vector(2^n/2,i,v[i]+v[n])));a(n)=if(n<2,1,v[n]) /* Benoit Cloitre, Jan 16 2013 */

Formula

From Flávio V. Fernandes, Jul 31 2025: (Start)
a(n) = a(2^n).
a(n) = Sum_{k=1..A000120(n)} a(A048793(n,k)-1) for n >= 1. (End)

Extensions

Edited by Franklin T. Adams-Watters, Jul 13 2011

A249152 Exponent of 2 in the hyperfactorials: a(n) = A007814(A002109(n)).

Original entry on oeis.org

0, 0, 2, 2, 10, 10, 16, 16, 40, 40, 50, 50, 74, 74, 88, 88, 152, 152, 170, 170, 210, 210, 232, 232, 304, 304, 330, 330, 386, 386, 416, 416, 576, 576, 610, 610, 682, 682, 720, 720, 840, 840, 882, 882, 970, 970, 1016, 1016, 1208, 1208, 1258, 1258, 1362, 1362, 1416, 1416, 1584, 1584, 1642, 1642
Offset: 0

Views

Author

Antti Karttunen, Oct 25 2014

Keywords

Comments

This is the function ord_2(D*_n) listed in the leftmost column of Table 7.1 in Lagarias & Mehta 2014 paper (on page 19).

Crossrefs

Bisection: A249153.
Cf. A133457 (binary exponents).

Programs

  • Magma
    [0] cat [&+[i*Valuation(i, 2):i in [1..n]]:n in [1..60]]; // Marius A. Burtea, Oct 18 2019
    
  • Maple
    with(padic): seq(add(i*ordp(i, 2), i=1..n), n=0..60); # Ridouane Oudra, Oct 17 2019
  • Mathematica
    Table[i=0;Hyperfactorial@n//.x_/;EvenQ@x:>(i++;x/2);i,{n,0,60}] (* Giorgos Kalogeropoulos, Oct 28 2021 *)
  • PARI
    a(n) = sum(i=1, n, i*valuation(i, 2)); \\ Michel Marcus, Sep 14 2021
    
  • PARI
    a(n) = my(v=binary(n),t=0); forstep(j=#v,1,-1, if(v[j],v[j]=t--,t++)); (n^2 + fromdigits(v,2))>>1; \\ Kevin Ryde, Nov 03 2021
    
  • Python
    def A249152(n): return sum(i*(~i&i-1).bit_length() for i in range(2,n+1,2)) # Chai Wah Wu, Jul 11 2022

Formula

a(n) = 2 * A143157(floor(n/2)).
a(n) = A174605(n) + A187059(n). [Lagarias and Mehta theorem 4.1 for p=2]
a(n) = Sum_{i=1..n} i*v_2(i), where v_2(i) = A007814(i) is the exponent of the highest power of 2 dividing i. - Ridouane Oudra, Oct 17 2019
a(n) ~ (n^2+2n)/2 as n -> infinity. - Luca Onnis, Oct 17 2021
a(n) ~ ((A011371(n))^2)/2 as n -> infinity. - Luca Onnis, Nov 02 2021
From Kevin Ryde, Nov 03 2021: (Start)
a(2n) = a(2n+1) = 2*a(n) + n*(n+1).
a(n) = ( n^2 + Sum_{j=1..k} (e[j]-2*j+1) * 2^e[j] )/2, where binary expansion n = 2^e[1] + ... + 2^e[k] with ascending exponents e[1] < e[2] < ... < e[k] (A133457).
(End)
a(n) = Sum_{j=1..floor(log_2(n))} j*2^j*round(n/2^(j+1))^2, for n>=1. - Ridouane Oudra, Oct 01 2022

A352724 Irregular table T(n, k) read by rows; the n-th row contains the lexicographically earlier list of A069010(n) distinct terms of A023758 summing to n.

Original entry on oeis.org

1, 2, 3, 4, 1, 4, 6, 7, 8, 1, 8, 2, 8, 3, 8, 12, 1, 12, 14, 15, 16, 1, 16, 2, 16, 3, 16, 4, 16, 1, 4, 16, 6, 16, 7, 16, 24, 1, 24, 2, 24, 3, 24, 28, 1, 28, 30, 31, 32, 1, 32, 2, 32, 3, 32, 4, 32, 1, 4, 32, 6, 32, 7, 32, 8, 32, 1, 8, 32, 2, 8, 32, 3, 8, 32
Offset: 1

Views

Author

Rémy Sigrist, Mar 30 2022

Keywords

Comments

In other words, the n-th row gives the minimal partition of n into terms of A023758 (runs of consecutive 1's in binary).

Examples

			Irregular table begins:
     1:   [1]
     2:   [2]
     3:   [3]
     4:   [4]
     5:   [1, 4]
     6:   [6]
     7:   [7]
     8:   [8]
     9:   [1, 8]
    10:   [2, 8]
    11:   [3, 8]
    12:   [12]
    13:   [1, 12]
    14:   [14]
    15:   [15]
		

Crossrefs

Cf. A023758, A069010 (row lengths), A133457, A342126, A342410.

Programs

  • PARI
    row(n) = { my (r=[], o=0); while (n, my (v=valuation(n+n%2, 2)); if (n%2, r=concat(r, (2^v-1)*2^o)); o+=v; n\=2^v); r }

Formula

Sum_{k = 1..A069010(n)} T(n, k) = n.
T(n, 1) = A342410(n).
T(n, A069010(n)) = A342126(n).

A355807 a(n) is the number at the apex of a triangle whose base contains the distinct powers of 2 summing to n (in ascending order), and each number in a higher row is the absolute difference of the two numbers directly below it; a(0) = 0.

Original entry on oeis.org

0, 1, 2, 1, 4, 3, 2, 1, 8, 7, 6, 5, 4, 1, 2, 1, 16, 15, 14, 13, 12, 9, 10, 9, 8, 1, 2, 3, 4, 3, 2, 1, 32, 31, 30, 29, 28, 25, 26, 25, 24, 17, 18, 13, 20, 19, 18, 17, 16, 1, 2, 11, 4, 5, 6, 3, 8, 7, 6, 3, 4, 1, 2, 1, 64, 63, 62, 61, 60, 57, 58, 57, 56, 49, 50
Offset: 0

Views

Author

Rémy Sigrist, Jul 18 2022

Keywords

Comments

This sequence has similarities with A334387.

Examples

			For n = 27:
- we have the following triangle:
            3
          5   2
        1   6   8
      1   2   8  16
- so a(27) = 3.
		

Crossrefs

See A355808, A355809, A355810 and A355811 for other variants.

Programs

  • PARI
    a(n) = { my (b=vector(hammingweight(n))); for (k=1, #b, n-=b[k]=2^valuation(n,2)); while (#b>1, b=vector(#b-1, k, abs(b[k+1]-b[k]))); if (#b, b[1], 0) }

Formula

a(n) <= n with equality iff n = 0 or n is a power of 2.
a(2*n) = 2*a(n).
Showing 1-10 of 33 results. Next