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

A191682 Twice A113473.

Original entry on oeis.org

2, 4, 4, 6, 6, 6, 6, 8, 8, 8, 8, 8, 8, 8, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10
Offset: 1

Views

Author

Edward Omey, Jun 11 2011

Keywords

Comments

Arises in a renewal problem. Suppose X(1), X(2), ... are independent and identically distributed random variables with P(X = 1) = P(X = 2) = 0.5, and let N(n) denote the first value of k such that X(1)*X(2)*...*X(k) > x. Then a(n) gives the expected value of N(n), n = 1, 2, 3, ...

Crossrefs

Cf. A113473.

A070939 Length of binary representation of n.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, May 18 2002

Keywords

Comments

Zero is assumed to be represented as 0.
For n>1, n appears 2^(n-1) times. - Lekraj Beedassy, Apr 12 2006
a(n) is the permanent of the n X n 0-1 matrix whose (i,j) entry is 1 iff i=1 or i=j or i=2*j. For example, a(4)=3 is per([[1, 1, 1, 1], [1, 1, 0, 0], [0, 0, 1, 0], [0, 1, 0, 1]]). - David Callan, Jun 07 2006
a(n) is the number of different contiguous palindromic bit patterns in the binary representation of n; for examples, for 5=101_2 the bit patterns are 0, 1, 101; for 7=111_2 the corresponding patterns are 1, 11, 111; for 13=1101_2 the patterns are 0, 1, 11, 101. - Hieronymus Fischer, Mar 13 2012
A103586(n) = a(n + a(n)); a(A214489(n)) = A103586(A214489(n)). - Reinhard Zumkeller, Jul 21 2012
Number of divisors of 2^n that are <= n. - Clark Kimberling, Apr 21 2019

Examples

			8 = 1000 in binary has length 4.
		

References

  • G. Everest, A. van der Poorten, I. Shparlinski and T. Ward, Recurrence Sequences, Amer. Math. Soc., 2003; see esp. p. 255.
  • L. Levine, Fractal sequences and restricted Nim, Ars Combin. 80 (2006), 113-127.

Crossrefs

A029837(n+1) gives the length of binary representation of n without the leading zeros (i.e., when zero is represented as the empty sequence). For n > 0 this is equal to a(n).
This is Guy Steele's sequence GS(4, 4) (see A135416).
Cf. A083652 (partial sums).

Programs

  • Haskell
    a070939 n = if n < 2 then 1 else a070939 (n `div` 2) + 1
    a070939_list = 1 : 1 : l [1] where
       l bs = bs' ++ l bs' where bs' = map (+ 1) (bs ++ bs)
    -- Reinhard Zumkeller, Jul 19 2012, Jun 07 2011
    
  • Magma
    A070939:=func< n | n eq 0 select 1 else #Intseq(n, 2) >; [ A070939(n): n in [0..104] ]; // Klaus Brockhaus, Jan 13 2011
    
  • Maple
    A070939 := n -> `if`(n=0, 1, ilog2(2*n)):
    seq(A070939(n), n=0..104); # revised by Peter Luschny, Aug 10 2017
  • Mathematica
    Table[Length[IntegerDigits[n, 2]], {n, 0, 50}] (* Stefan Steinerberger, Apr 01 2006 *)
    Join[{1},IntegerLength[Range[110],2]] (* Harvey P. Dale, Aug 18 2013 *)
    a[ n_] := If[ n < 1, Boole[n == 0], BitLength[n]]; (* Michael Somos, Jul 10 2018 *)
  • PARI
    {a(n) = if( n<1, n==0, #binary(n))} /* Michael Somos, Aug 31 2012 */
    
  • PARI
    apply( {A070939(n)=exponent(n+!n)+1}, [0..99]) \\ works for negative n and is much faster than the above. - M. F. Hasler, Jan 04 2014, updated Feb 29 2020
    
  • Python
    def a(n): return len(bin(n)[2:])
    print([a(n) for n in range(105)]) # Michael S. Branicky, Jan 01 2021
    
  • Python
    def A070939(n): return 1 if n == 0 else n.bit_length() # Chai Wah Wu, May 12 2022
  • Sage
    def A070939(n) : return (2*n).exact_log(2) if n != 0 else 1
    [A070939(n) for n in range(100)] # Peter Luschny, Aug 08 2012
    

Formula

a(0) = 1; for n >= 1, a(n) = 1 + floor(log_2(n)) = 1 + A000523(n).
G.f.: 1 + 1/(1-x) * Sum(k>=0, x^2^k). - Ralf Stephan, Apr 12 2002
a(0)=1, a(1)=1 and a(n) = 1+a(floor(n/2)). - Benoit Cloitre, Dec 02 2003
a(n) = A000120(n) + A023416(n). - Lekraj Beedassy, Apr 12 2006
a(2^m + k) = m + 1, m >= 0, 0 <= k < 2^m. - Yosu Yurramendi, Mar 14 2017
a(n) = A113473(n) if n>0.

Extensions

a(4) corrected by Antti Karttunen, Feb 28 2003

A000523 a(n) = floor(log_2(n)).

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Or, n >= 0 appears 2^n times. - Jon Perry, Sep 21 2002
a(n) + 1 = number of bits in binary expansion of n.
Largest power of 2 dividing lcm(1..n): A007814(A003418(n)).
log_2(0) = -infinity.
Also Max_{k=1..n} Omega(k), where Omega(n) = A001222(n), number of prime factors with repetition; see A080613. - Reinhard Zumkeller, Feb 25 2003
From Paul Weisenhorn, Sep 29 2010, updated Aug 11 2020: (Start)
Arithmetic mean: m(1,(c+1)/c) = (2*c+1)/(2*c); harmonic mean: h(1,(c+1)/c) = 2*(c+1)/(2*c+1);
a(n) is the number of means to reach (n+1)/n from 2/1; with m for 0 and h for 1, the inverse binary expansion of n, without the leading 1, gives the sequence of means.
For example, n=20; inverse binary expansion without the leading 1: 0010 ---> m m h m or m(1, m(1, h(1, m(1, 2)))) = 21/20.
The 4 twofold means for n from 4 to 7:
m(1,m(1,2)) = m(1,3/2) = 5/4,
h(1,m(1,2)) = h(1,3/2) = 6/5,
m(1,h(1,2)) = m(1,4/3) = 7/6,
h(1,h(1,2)) = h(1,4/3) = 8/7. (End) [Edited by Petros Hadjicostas, Jul 23 2020]
As function of the absolute value, defines the minimal Euclidean function v on Z\{0}. A ring R is Euclidean if for some function v : R\{0}->N a division by nonzero b can be defined with remainder r satisfying either r=0 or v(r) < v(b). For the integers taking v(n)=|n| works, but v(n) = floor(log_2(|n|)) works as well; moreover it is the possibility with smallest possible values. For division by b>0 one can always choose |r| <= floor(b/2); this sequence satisfies a(1) = 0 and recursively a(n) = 1 + max(a(1), ..., a(floor(n/2))) for n > 1. - Marc A. A. van Leeuwen, Feb 16 2011
Maximum number of guesses required to find any k in a range of 1..n, with 'higher', 'lower' and 'correct' as answers. - Jon Perry, Nov 02 2013
Number of powers of 2 <= n. - Ralph-Joseph Tatt, Apr 23 2018
a(n) + 1 is the minimum number of pairwise disjoint subsets of an n-element set such that for each k from 1 to n there is a set with cardinality k which is the union of some of those subsets. - Wojciech Raszka, Apr 15 2019
Minimum height of an n-node binary tree. - Yuchun Ji, Mar 22 2021

Examples

			a(5)=2 because the binary expansion of 5 (=101) has three bits.
		

References

  • Rüdeger Baumann, Computer-Knobelei, LOG IN Heft 159 (2009), 74-77. - Paul Weisenhorn, Sep 29 2010
  • G. H. Hardy, Note on Dr. Vacca's series for gamma, Quart. J. Pure Appl. Math., Vol. 43 (1912), pp. 215-216.
  • Ernst Jacobsthal, Über die Eulersche konstante, Mathematisch-Naturwissenschaftliche Blätter, Vol. 3, No. 9 (1906), pp. 153-154.
  • Donald E. Knuth, The Art of Computer Programming, Vol. 1: Fundamental Algorithms, p. 400.
  • Donald E. Knuth, The Art of Computer Programming, vol. 4A, Combinatorial Algorithms, Section 7.1.3, Problem 41, p. 589. - From N. J. A. Sloane, Aug 03 2012

Crossrefs

Programs

  • Haskell
    a000523 1 = 0
    a000523 n = 1 + a000523 (div n 2)
    a000523_list = 0 : f [0] where
       f xs = ys ++ f ys where ys = map (+ 1) (xs ++ xs)
    -- Reinhard Zumkeller, Dec 31 2012, Feb 04 2012, Mar 18 2011
    
  • Magma
    [Ilog2(n) : n in [1..130] ];
    
  • Maple
    A000523 := proc(n)
        ilog2(n) ;
    end proc: # R. J. Mathar, Nov 28 2016
    seq(A000523(n), n=1..90);
  • Mathematica
    Floor[Log[2,Range[110]]] (* Harvey P. Dale, Jul 16 2012 *)
    a[ n_] := If[ n < 1, 0, BitLength[n] - 1]; (* Michael Somos, Jul 10 2018 *)
  • PARI
    {a(n) = floor(log(n) / log(2))} \\ Likely to yield incorrect results for many if not almost all n. Better use most recent code.
    
  • PARI
    {a(n) = if( n<1, 0, #binary(n) - 1)}; /* Michael Somos, May 28 2014 */
    
  • PARI
    a(n)=logint(n,2) \\ Charles R Greathouse IV, Sep 01 2015
    
  • PARI
    a(n)=exponent(n) \\ Charles R Greathouse IV, Nov 09 2017
    
  • Python
    def A000523(n):
        return len(bin(n))-3 # Chai Wah Wu, Jul 09 2020
    
  • Python
    def a(n): return n.bit_length() - 1
    print([a(n) for n in range(1, 106)]) # Michael S. Branicky, Apr 18 2023

Formula

a(n) = A070939(n) - 1 for n >= 1.
a(n) = if n > 1, then a(floor(n / 2)) + 1; else 0. - Reinhard Zumkeller, Oct 29 2001
G.f.: (1/(1 - x)) * Sum_{k>=1} x^2^k. - Ralf Stephan, Apr 13 2002
a(n+1) = number of digits of n-th number with no 0 in ternary representation = A081604(A032924(n)); A107680(n) = A003462(a(n+1)). - Reinhard Zumkeller, May 20 2005
a(n) = A152487(n-1,0) = A152487(n,1). - Reinhard Zumkeller, Dec 06 2008
a(n) = k with 2^k <= n < 2^(k+1); a(n) = floor(log_2(n)). - Paul Weisenhorn, Sep 29 2010
a(n) = Max_{k=1..n} A240857(n,k). - Reinhard Zumkeller, Apr 14 2014
a(n) = A113473(n) - 1. - Filip Zaludek, Oct 29 2016
Sum_{n>=2} (-1)^n*a(n)/n = gamma = A001620 (Jacobsthal, 1906; Vacca, 1910). - Amiram Eldar, Jun 12 2021
a(n) = floor(Sum_{k=1..n-1} (n+1)^(n-2^k)) mod n. - Joseph M. Shunia, Jul 19 2024

Extensions

Error in 4th term, pointed out by Joe Keane (jgk(AT)jgk.org), has been corrected.
More terms from Michael Somos, Aug 02 2002

A029837 Binary order of n: log_2(n) rounded up to next integer.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Or, ceiling(log_2(n)).
Worst-case cost of binary search.
Equal to number of binary digits in n unless n is a power of 2 when it is one less.
Thus a(n) gives the length of the binary representation of n - 1 (n >= 2), which is also A070939(n - 1).
Let x(0) = n > 1 and x(k + 1) = x(k) - floor(x(k)/2), then a(n) is the smallest integer such that x(a(n)) = 1. - Benoit Cloitre, Aug 29 2002
Also number of division steps when going from n to 1 by process of adding 1 if odd, or dividing by 2 if even. - Cino Hilliard, Mar 25 2003
Number of ways to write n as (x + 2^y), x >= 0. Number of ways to write n + 1 as 2^x + 3^y (cf. A004050). - Benoit Cloitre, Mar 29 2003
The minimum number of cuts for dividing an object into n (possibly unequal) pieces. - Karl Ove Hufthammer (karl(AT)huftis.org), Mar 29 2010
Partial sums of A209229; number of powers of 2 not greater than n. - Reinhard Zumkeller, Mar 07 2012

Examples

			a(1) = 0, since log_2(1) = 0.
a(2) = 1, since log_2(2) = 1.
a(3) = 2, since log_2(3) = 1.58...
a(n) = 7 for n = 65, 66, ..., 127, 128.
G.f. = x^2 + 2*x^3 + 2*x^4 + 3*x^5 + 3*x^6 + 3*x^7 + 3*x^8 + 4*x^9 + ... - _Michael Somos_, Jun 02 2019
		

References

  • R. L. Graham, D. E. Knuth and O. Patashnik, Concrete Mathematics, Addison-Wesley, 1989, p. 70.
  • G. J. E. Rawlins, Compared to What? An Introduction to the Analysis of Algorithms, W. H. Freeman, 1992; see pp. 108, 118.

Crossrefs

Partial sums of A036987.
Used for several definitions: A029827, A036378-A036390. Partial sums: A001855.

Programs

  • Haskell
    a029837 n = a029837_list !! (n-1)
    a029837_list = scanl1 (+) a209229_list
    -- Reinhard Zumkeller, Mar 07 2012
    (Common Lisp) (defun A029837 (n) (integer-length (1- n))) ; James Spahlinger, Oct 15 2012
    
  • Magma
    [Ceiling(Log(2, n)): n in [1..100]]; // Vincenzo Librandi, Jun 14 2019
    
  • Maple
    a:= n-> (p-> p+`if`(2^pAlois P. Heinz, Mar 18 2013
  • Mathematica
    a[n_] := Ceiling[Log[2, n]]; Array[a, 105] (* Robert G. Wilson v, Dec 09 2005 *)
    Table[IntegerLength[n - 1, 2], {n, 1, 105}] (* Peter Luschny, Dec 02 2017 *)
    a[n_] := If[n < 1, 0, BitLength[n - 1]]; (* Michael Somos, Jul 10 2018 *)
    Join[{0}, IntegerLength[Range[130], 2]] (* Vincenzo Librandi, Jun 14 2019 *)
  • PARI
    {a(n) = if( n<1, 0, ceil(log(n) / log(2)))};
    
  • PARI
    /* Set p = 1, then: */
    xpcount(n,p) = for(x=1, n, p1 = x; ct=0; while(p1>1, if(p1%2==0,p1/=2; ct++,p1 = p1*p+1)); print1(ct, ", "))
    
  • PARI
    {a(n) = if( n<2, 0, exponent(n-1)+1)}; /* Michael Somos, Jul 10 2018 */
    
  • Python
    def A029837(n):
        s = bin(n)[2:]
        return len(s) - (1 if s.count('1') == 1 else 0) # Chai Wah Wu, Jul 09 2020
    
  • Python
    def A029837(n): return (n-1).bit_length() # Chai Wah Wu, Jun 30 2022
  • Scala
    (1 to 80).map(n => Math.ceil(Math.log(n)/Math.log(2)).toInt) // Alonso del Arte, Feb 19 2020
    

Formula

a(n) = ceiling(log_2(n)).
a(1) = 0; for n > 1, a(2n) = a(n) + 1, a(2n + 1) = a(n) + 1. Alternatively, a(1) = 0; for n > 1, a(n) = a(ceiling(n/2)) + 1. [corrected by Ilya Gutkovskiy, Mar 21 2020]
a(n) = k such that n^(1/k - 1) > 2 > n^(1/k), or the least value of k for which floor n^(1/k) = 1. a(n) = k for all n such that 2^(k - 1) < n < 2^k. - Amarnath Murthy, May 06 2001
G.f.: x/(1 - x) * Sum_{k >= 0} x^2^k. - Ralf Stephan, Apr 13 2002
A062383(n-1) = 2^a(n). - Johannes W. Meijer, Jul 06 2009
a(n+1) = -Sum_{k = 1..n} mu(2*k)*floor(n/k). - Benoit Cloitre, Oct 21 2009
a(n+1) = A113473(n). - Michael Somos, Jun 02 2019

Extensions

Additional comments from Daniele Parisse
More terms from Michael Somos, Aug 02 2002

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

Original entry on oeis.org

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

Views

Author

Peter Kagey, Apr 17 2016

Keywords

Comments

Length of n-th row given by A000120(n);
Min of n-th row given by A001511(n);
Sum of n-th row given by A029931(n);
Product of n-th row given by A096111(n);
Max of n-th row given by A113473(n);
Numerator of sum of reciprocals of n-th row given by A116416(n);
Denominator of sum of reciprocals of n-th row given by A116417(n);
LCM of n-th row given by A271410(n).
The first appearance of n is at A001787(n - 1).
n-th row begins at index A000788(n - 1) for n > 0.
Also the reversed positions of 1's in the reversed binary expansion of n. Also the reversed partial sums of the n-th composition in standard order (row n of A066099). Reversing rows gives A048793. - Gus Wiseman, Jan 17 2023

Examples

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

Crossrefs

Cf. A048793 gives the rows in reverse order.
Cf. A272011.
Lasts are A001511.
Heinz numbers of the rows are A019565.
Firsts are A029837 or A070939 or A113473.
Row sums are A029931.
A066099 lists standard comps, partial sums A358134, weighted sum A359042.

Programs

  • Maple
    T:= proc(n) local i, l, m; l:= NULL; m:= n;
          if n=0 then return [][] fi; for i while m>0 do
          if irem(m, 2, 'm')=1 then l:=i, l fi od; l
        end:
    seq(T(n), n=0..35);  # Alois P. Heinz, Nov 27 2024
  • Mathematica
    Table[Reverse[Join@@Position[Reverse[IntegerDigits[n,2]],1]],{n,0,100}] (* Gus Wiseman, Jan 17 2023 *)

A360189 Triangle T(n,k), n>=0, 0<=k<=floor(log_2(n+1)), read by rows: T(n,k) = number of nonnegative integers <= n having binary weight k.

Original entry on oeis.org

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

Views

Author

Alois P. Heinz, Mar 04 2023

Keywords

Comments

T(n,k) is defined for all n >= 0 and k >= 0. Terms that are not in the triangle are zero.

Examples

			T(6,2) = 3: 3, 5, 6, or in binary: 11_2, 101_2, 110_2.
T(15,3) = 4: 7, 11, 13, 14, or in binary: 111_2, 1011_2, 1101_2, 1110_2.
Triangle T(n,k) begins:
  1;
  1, 1;
  1, 2;
  1, 2, 1;
  1, 3, 1;
  1, 3, 2;
  1, 3, 3;
  1, 3, 3, 1;
  1, 4, 3, 1;
  1, 4, 4, 1;
  1, 4, 5, 1;
  1, 4, 5, 2;
  1, 4, 6, 2;
  1, 4, 6, 3;
  1, 4, 6, 4;
  1, 4, 6, 4, 1;
  ...
		

Crossrefs

Columns k=0-2 give: A000012, A029837(n+1) = A113473(n) for n>0, A340068(n+1).
Last elements of rows give A090996(n+1).

Programs

  • Maple
    b:= proc(n) option remember; `if`(n<0, 0,
          b(n-1)+x^add(i, i=Bits[Split](n)))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n)):
    seq(T(n), n=0..23);
  • PARI
    T(n,k) = my(v1); v1 = Vecrev(binary(n+1)); v1 = Vecrev(select(x->(x>0),v1,1)); sum(j=0, min(k,#v1-1), binomial(v1[j+1]-1,k-j)) \\ Mikhail Kurkov, Nov 27 2024

Formula

T(n,k) = T(n-1,k) + [A000120(n) = k] where [] is the Iverson bracket and T(n,k) = 0 for n<0.
T(2^n-1,k) = A007318(n,k) = binomial(n,k).
T(n,floor(log_2(n+1))) = A090996(n+1).
Sum_{k>=0} T(n,k) = n+1.
Sum_{k>=0} k * T(n,k) = A000788(n).
Sum_{k>=0} k^2 * T(n,k) = A231500(n).
Sum_{k>=0} k^3 * T(n,k) = A231501(n).
Sum_{k>=0} k^4 * T(n,k) = A231502(n).
Sum_{k>=0} 2^k * T(n,k) = A006046(n+1).
Sum_{k>=0} 3^k * T(n,k) = A130665(n).
Sum_{k>=0} 4^k * T(n,k) = A116520(n+1).
Sum_{k>=0} 5^k * T(n,k) = A130667(n+1).
Sum_{k>=0} 6^k * T(n,k) = A116522(n+1).
Sum_{k>=0} 7^k * T(n,k) = A161342(n+1).
Sum_{k>=0} 8^k * T(n,k) = A116526(n+1).
Sum_{k>=0} 10^k * T(n,k) = A116525(n+1).
Sum_{k>=0} n^k * T(n,k) = A361257(n).
T(n,k) = Sum_{j=0..min(k, A000120(n+1)-1)} binomial(A272020(n+1,j+1)-1,k-j) for n >= 0, k >= 0 (see Peter J. Taylor link). - Mikhail Kurkov, Nov 27 2024

A372354 Array read by upward antidiagonals: A(n, k) = A000523(A372282(n, k)), n,k >= 1, where A000523(x) is one less than the number of bits in the binary expansion of x.

Original entry on oeis.org

0, 4, 1, 12, 4, 2, 28, 12, 8, 2, 60, 28, 20, 5, 3, 124, 60, 44, 10, 6, 3, 252, 124, 92, 19, 13, 6, 3, 508, 252, 188, 40, 26, 11, 8, 3, 1020, 508, 380, 84, 51, 24, 20, 6, 4, 2044, 1020, 764, 172, 104, 52, 44, 11, 7, 4, 4092, 2044, 1532, 348, 212, 108, 92, 19, 16, 6, 4, 8188, 4092, 3068, 700, 428, 220, 188, 40, 36, 13, 12, 4
Offset: 1

Views

Author

Antti Karttunen, Apr 30 2024

Keywords

Examples

			Array begins:
n\k|    1     2     3    4    5    6     7    8     9   10    11   12   13   14
---+-----------------------------------------------------------------------------
1  |    0,    1,    2,   2,   3,   3,    3,   3,    4,   4,    4,   4,   4,   4,
2  |    4,    4,    8,   5,   6,   6,    8,   6,    7,   6,   12,   7,   8,   7,
3  |   12,   12,   20,  10,  13,  11,   20,  11,   16,  13,   28,  11,  14,  12,
4  |   28,   28,   44,  19,  26,  24,   44,  19,   36,  26,   60,  24,  29,  23,
5  |   60,   60,   92,  40,  51,  52,   92,  40,   76,  51,  124,  52,  58,  44,
6  |  124,  124,  188,  84, 104, 108,  188,  84,  156, 104,  252, 108, 115,  84,
7  |  252,  252,  380, 172, 212, 220,  380, 172,  316, 212,  508, 220, 232, 165,
8  |  508,  508,  764, 348, 428, 444,  764, 348,  636, 428, 1020, 444, 468, 326,
9  | 1020, 1020, 1532, 700, 860, 892, 1532, 700, 1276, 860, 2044, 892, 940, 650,
		

Crossrefs

Cf. A000523, A371094, A372282, A372356 (columnwise first differences), A372357.
Row 1 is 0 followed by A113473.

Programs

  • PARI
    up_to = 78;
    A000523(n) = logint(n,2);
    A371094(n) = { my(m=1+3*n, e=valuation(m,2)); ((m*(2^e)) + (((4^e)-1)/3)); };
    A372282sq(n,k) = if(1==n,2*k-1,A371094(A372282sq(n-1,k)));
    A372354sq(n,k) = A000523(A372282sq(n,k));
    A372354list(up_to) = { my(v = vector(up_to), i=0); for(a=1,oo, for(col=1,a, i++; if(i > up_to, return(v)); v[i] = A372354sq((a-(col-1)),col))); (v); };
    v372354 = A372354list(up_to);
    A372354(n) = v372354[n];

A306714 Permanent of the circulant matrix whose first row is given by the binary expansion of n.

Original entry on oeis.org

0, 1, 1, 2, 1, 2, 2, 6, 1, 2, 4, 9, 2, 9, 9, 24, 1, 2, 2, 13, 2, 13, 13, 44, 2, 13, 13, 44, 13, 44, 44, 120, 1, 2, 4, 20, 8, 17, 17, 80, 4, 17, 36, 82, 17, 80, 82, 265, 2, 20, 17, 80, 17, 82, 80, 265, 20, 80, 82, 265, 80, 265, 265, 720, 1, 2, 2, 31, 2, 24, 24
Offset: 0

Views

Author

Alois P. Heinz, Mar 05 2019

Keywords

Examples

			The circulant matrix for n = 23 = 10111_2 is
  [1 0 1 1 1]
  [1 1 0 1 1]
  [1 1 1 0 1]
  [1 1 1 1 0]
  [0 1 1 1 1] and has permanent 44, thus a(23) = 44.
a(10) = 4 != a(12) = 2 although 10 = 1010_2 and 12 = 1100_2 have the same number of 0's and 1's.
		

Crossrefs

Programs

  • Maple
    a:= n-> (l-> LinearAlgebra[Permanent](Matrix(nops(l),
             shape=Circulant[l])))(convert(n, base, 2)):
    seq(a(n), n=0..100);

Formula

a(n) = 1 <=> n in { A000079 }.
a(n) = floor(log_2(2n))! for n in { A126646 }.
a(A000225(n)) = A000142(n) for n >= 1.
a(A000051(n)) = A040000(n).
a(A007283(n)) = A007395(n+1).

A322156 Irregular triangle where row n includes all decreasing sequences S = {k_0 = n, k_1, k_2, ..., k_m} in reverse lexicographic order such that the sum of subsequent terms k_j for all i < j <= m does not exceed any k_i.

Original entry on oeis.org

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

Views

Author

Michael De Vlieger, Dec 11 2018

Keywords

Comments

Algorithm:
Let S be a sequence starting with n. Let k be the index of a term in S, with n at position k = 0. Let S_r be the r-th sequence in row n.
Starting with S_1 = {n}, we either (A) append a 1 to the left of S_r, or (B) we drop the most recently-appended term S_(k) and increment the rightmost term (k - 1).
By default we execute (A) and test according to the following. Consider the reversed accumulation A_(r + 1) = Sum(reverse(S_(k + 1))) = Sum(k_m, k_(m - 1), ..., k_2, k_1). If S_r - A_(r + 1) contains nothing less than 0, then S_(k + 1) is retained, otherwise we execute (B).
We end after k_1 = n, since otherwise we would enter an endless loop that also increments k_0 ad infinitum.
The first sequence S in row n is {n} while the last is {n, n}.
All rows n contain {{n}, {n, 1}, {n, n}}.
Only one repeated term k may appear at the end of any S in row n.
The longest possible sequence S in row n has 2 + floor(log_2(n)) terms = 2 + A113473(n).
The sequence S describes unique integer partitions L that are recursively symmetrical. Example: We can convert S = {4, 2, 1} into the partition (7, 6, 5, 4, 3, 2, 1), a partition of N = 28. We set a 4X Durfee square with its upper-left corner at origin. Then we set 2^k = 2^1 = 2 2X squares, each with its upper-left corner in any coordinate bounded at left and top by either a previously-lain square or an axis. Finally, we set 2^2 = 4 1X squares as above once again. We obtain a Ferrer diagram as below, with the k marked, i.e., the 1st term 4X, the 2nd term 2X, the 3rd term 1X squares:
0 0 0 0 1 1 2
0 0 0 0 1 1
0 0 0 0 2
0 0 0 0
1 1 2
1 1
2
The resulting partition L is recursively self-conjugate; its arms are identical to its legs. We can eliminate the Durfee square and the other appendage and have a symmetrical partition L_1 with Durfee square of k_1 units, etc.
Were we to admit either more than 1 repeated k or a term such that S_k - A_(k + 1) had differences less than 1, we would have overlapping squares in the Ferrer diagram. Such diagrams are generated by larger n and all resulting diagrams are unique given the described algorithm.
The sequences S in row n, converted into integer partitions L, sum to n^2 <= N <= 3 * n^2.

Examples

			Triangle begins:
1; 1,1;
2; 2,1; 2,1,1; 2,2;
3; 3,1; 3,1,1; 3,2; 3,2,1; 3,3;
4; 4,1; 4,1,1; 4,2; 4,2,1; 4,2,1,1; 4,2,2; 4,3; 4,3,1; 4,4;
...
Row n = 5 starts with S_1 = 5. We append 1 to get {5,1}. 1 does not exceed 5, thus S_2 = {5,1}. We append 1 to get {5,1,1}. A = {1,2}; {5,1}-{2,1} = {3,0}, thus S_3 = {5,1,1} and we drop the last term and increment the new last term to get {5,2}. S_4 = {5,2}, and the ensuing terms {5,2,1}, {5,2,1,1}, {5,2,2} enter into the row. Since there are repeated terms at the last sequence, we drop the last term and increment the new last to get {5,3}. The terms {5,3,1}, {5,3,1,1}, {5,3,2}, {5,3,2,1}, are admitted. {5,3,2,1,1} has A = {1,2,4,6}. {5,3,2,1}-{6,4,2,1} = {-1,1,0,0}: {5,3,2,1,1} cannot be admitted, so we drop the last term and increment to {5,3,2,2} but the sum of the last two terms exceeds the second and we drop the last term and increment to {5,3,3}. For similar reasons, this cannot be admitted, so we drop the last term and increment to {5,4}. This enters as well as {5,4,1}. Since any appendage or increment proves invalid, we end up incrementing to {5,5}. The two terms are the same, therefore we end the row n = 5.
		

Crossrefs

Programs

  • Mathematica
    (* Generate sequence: *)
    f[n_] := Block[{w = {n}, c}, c[x_] := Apply[Times, Most@ x - Reverse@ Accumulate@ Reverse@ Rest@ x]; Reap[Do[Which[And[Length@ w == 2, SameQ @@ w], Sow[w]; Break[], Length@ w == 1, Sow[w]; AppendTo[w, 1], c[w] > 0, Sow[w]; AppendTo[w, 1], True, Sow[w]; w = MapAt[1 + # &, Drop[w, -1], -1]], {i, Infinity}] ][[-1, 1]] ]; Array[f, 6] // Flatten
    (* Convert S = row n to standard partition: *)
    g[w_] := Block[{k}, k = Total@ w; Total@ Map[Apply[Function[{s, t}, s Array[Boole[t <= # <= s + t - 1] &, k] ], #] &, Apply[Join, Prepend[Table[Function[{v, c}, Map[{w[[k]], # + 1} &, Map[Total[v #] &, Tuples[{0, 1}, {Length@ v}]]]] @@ {Most@ #, ConstantArray[1, Length@ # - 1]} &@ Take[w, k], {k, 2, Length@ w}], {{w[[1]], 1}}]]] ]

Formula

Row n contains A000123(n) = 2*A033485(n) sequences S.

A357812 Number of subsets of [n] in which exactly half of the elements are powers of 2.

Original entry on oeis.org

1, 1, 1, 3, 4, 10, 20, 35, 70, 126, 210, 330, 495, 715, 1001, 1365, 4368, 6188, 8568, 11628, 15504, 20349, 26334, 33649, 42504, 53130, 65780, 80730, 98280, 118755, 142506, 169911, 906192, 1107568, 1344904, 1623160, 1947792, 2324784, 2760681, 3262623, 3838380
Offset: 0

Views

Author

Alois P. Heinz, Oct 13 2022

Keywords

Examples

			a(6) = 20: {}, {1,3}, {1,5}, {1,6}, {2,3}, {2,5}, {2,6}, {3,4}, {4,5}, {4,6}, {1,2,3,5}, {1,2,3,6}, {1,2,5,6}, {1,3,4,5}, {1,3,4,6}, {1,4,5,6}, {2,3,4,5}, {2,3,4,6}, {2,4,5,6}, {1,2,3,4,5,6}.
		

Crossrefs

Programs

  • Maple
    a:= n-> binomial(n, max(0, 1+ilog[2](n))):
    seq(a(n), n=0..40);
  • Python
    from math import comb
    def A357812(n): return comb(n,n.bit_length()) # Chai Wah Wu, Oct 14 2022

Formula

a(n) = binomial(n,A029837(n+1)).
a(n) = binomial(n,A113473(n)) for n>0, a(0) = 1.
a(n) = Sum_{j>=0} binomial(A029837(n+1),j)*binomial(n-A029837(n+1),j).
Showing 1-10 of 15 results. Next