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

A018900 Sums of two distinct powers of 2.

Original entry on oeis.org

3, 5, 6, 9, 10, 12, 17, 18, 20, 24, 33, 34, 36, 40, 48, 65, 66, 68, 72, 80, 96, 129, 130, 132, 136, 144, 160, 192, 257, 258, 260, 264, 272, 288, 320, 384, 513, 514, 516, 520, 528, 544, 576, 640, 768, 1025, 1026, 1028, 1032, 1040, 1056, 1088, 1152, 1280, 1536, 2049, 2050, 2052, 2056, 2064, 2080, 2112, 2176, 2304, 2560, 3072
Offset: 1

Views

Author

Jonn Dalton (jdalton(AT)vnet.ibm.com), Dec 11 1996

Keywords

Comments

Appears to give all k such that 8 is the highest power of 2 dividing A005148(k). - Benoit Cloitre, Jun 22 2002
Seen as a triangle read by rows, T(n,k) = 2^(k-1) + 2^n, 1 <= k <= n, the sum of the n-th row equals A087323(n). - Reinhard Zumkeller, Jun 24 2009
Numbers whose base-2 sum of digits is 2. - Tom Edgar, Aug 31 2013
All odd terms are A000051. - Robert G. Wilson v, Jan 03 2014
A239708 holds the subsequence of terms m such that m - 1 is prime. - Hieronymus Fischer, Apr 20 2014

Examples

			From _Hieronymus Fischer_, Apr 27 2014: (Start)
a(1) = 3, since 3 = 2^1 + 2^0.
a(5) = 10, since 10 = 2^3 + 2^1.
a(10^2) = 16640
a(10^3) = 35184372089344
a(10^4) = 2788273714550169769618891533295908724670464 = 2.788273714550...*10^42
a(10^5) = 3.6341936214780344527466190...*10^134
a(10^6) = 4.5332938264998904048012398...*10^425
a(10^7) = 1.6074616084721302346802429...*10^1346
a(10^8) = 1.4662184497310967196301632...*10^4257
a(10^9) = 2.3037539289782230932863807...*10^13462
a(10^10) = 9.1836811272250798973464436...*10^42571
(End)
		

Crossrefs

Cf. A000079, A014311, A014312, A014313, A023688, A023689, A023690, A023691 (Hamming weight = 1, 3, 4, ..., 9).
Sum of base-b digits equal b: A226636 (b = 3), A226969 (b = 4), A227062 (b = 5), A227080 (b = 6), A227092 (b = 7), A227095 (b = 8), A227238 (b = 9), A052224 (b = 10). - M. F. Hasler, Dec 23 2016

Programs

  • C
    unsigned hakmem175(unsigned x) {
        unsigned s, o, r;
        s = x & -x; r = x + s;
        o = x ^ r;  o = (o >> 2) / s;
        return r | o;
    }
    unsigned A018900(int n) {
        if (n == 1) return 3;
        return hakmem175(A018900(n - 1));
    } // Peter Luschny, Jan 01 2014
    
  • Haskell
    a018900 n = a018900_list !! (n-1)
    a018900_list = elemIndices 2 a073267_list  -- Reinhard Zumkeller, Mar 07 2012
    
  • Maple
    a:= n-> (i-> 2^i+2^(n-1-i*(i-1)/2))(floor((sqrt(8*n-1)+1)/2)):
    seq(a(n), n=1..100);  # Alois P. Heinz, Feb 01 2022
  • Mathematica
    Select[ Range[ 1056 ], (Count[ IntegerDigits[ #, 2 ], 1 ]==2)& ]
    Union[Total/@Subsets[2^Range[0,10],{2}]] (* Harvey P. Dale, Mar 04 2012 *)
  • PARI
    for(m=1,9,for(n=0,m-1,print1(2^m+2^n", "))) \\ Charles R Greathouse IV, Sep 09 2011
    
  • PARI
    is(n)=hammingweight(n)==2 \\ Charles R Greathouse IV, Mar 03 2014
    
  • PARI
    for(n=0,10^5,if(hammingweight(n)==2,print1(n,", "))); \\ Joerg Arndt, Mar 04 2014
    
  • PARI
    a(n)= my(t=sqrtint(n*8)\/2); 2^t + 2^(n-1-t*(t-1)/2); \\ Ruud H.G. van Tol, Nov 30 2024
    
  • Python
    print([n for n in range(1, 3001) if bin(n)[2:].count("1")==2]) # Indranil Ghosh, Jun 03 2017
    
  • Python
    A018900_list = [2**a+2**b for a in range(1,10) for b in range(a)] # Chai Wah Wu, Jan 24 2021
    
  • Python
    from math import isqrt, comb
    def A018900(n): return (1<<(m:=isqrt(n<<3)+1>>1))+(1<<(n-1-comb(m,2))) # Chai Wah Wu, Oct 30 2024
  • Smalltalk
    distinctPowersOf: b
      "Version 1: Answers the n-th number of the form b^i + b^j, i>j>=0, where n is the receiver.
      b > 1 (b = 2, for this sequence).
      Usage: n distinctPowersOf: 2
      Answer: a(n)"
      | n i j |
      n := self.
      i := (8*n - 1) sqrtTruncated + 1 // 2.
      j := n - (i*(i - 1)/2) - 1.
      ^(b raisedToInteger: i) + (b raisedToInteger: j)
    [by Hieronymus Fischer, Apr 20 2014]
    ------------
    
  • Smalltalk
    distinctPowersOf: b
      "Version 2: Answers an array which holds the first n numbers of the form b^i + b^j, i>j>=0, where n is the receiver. b > 1 (b = 2, for this sequence).
      Usage: n distinctPowersOf: 2
      Answer: #(3 5 6 9 10 12 ...) [first n terms]"
      | k p q terms |
      terms := OrderedCollection new.
      k := 0.
      p := b.
      q := 1.
      [k < self] whileTrue:
             [[q < p and: [k < self]] whileTrue:
                       [k := k + 1.
                       terms add: p + q.
                       q := b * q].
             p := b * p.
             q := 1].
      ^terms as Array
    [by Hieronymus Fischer, Apr 20 2014]
    ------------
    
  • Smalltalk
    floorDistinctPowersOf: b
      "Answers an array which holds all the numbers b^i + b^j < n, i>j>=0, where n is the receiver.
      b > 1 (b = 2, for this sequence).
      Usage: n floorDistinctPowersOf: 2
      Answer: #(3 5 6 9 10 12 ...) [all terms < n]"
      | a n p q terms |
      terms := OrderedCollection new.
      n := self.
      p := b.
      q := 1.
      a := p + q.
      [a < n] whileTrue:
             [[q < p and: [a < n]] whileTrue:
                       [terms add: a.
                       q := b * q.
                       a := p + q].
             p := b * p.
             q := 1.
             a := p + q].
      ^terms as Array
    [by Hieronymus Fischer, Apr 20 2014]
    ------------
    
  • Smalltalk
    invertedDistinctPowersOf: b
      "Given a number m which is a distinct power of b, this method answers the index n such that there are uniquely defined i>j>=0 for which b^i + b^j = m, where m is the receiver;  b > 1 (b = 2, for this sequence).
      Usage: m invertedDistinctPowersOf: 2
      Answer: n such that a(n) = m, or, if no such n exists, min (k | a(k) >= m)"
      | n i j k m |
      m := self.
      i := m integerFloorLog: b.
      j := m - (b raisedToInteger: i) integerFloorLog: b.
      n := i * (i - 1) / 2 + 1 + j.
      ^n
    [by Hieronymus Fischer, Apr 20 2014]
    

Formula

a(n) = 2^trinv(n-1) + 2^((n-1)-((trinv(n-1)*(trinv(n-1)-1))/2)), i.e., 2^A002024(n)+2^A002262(n-1). - Antti Karttunen
a(n) = A059268(n-1) + A140513(n-1). A000120(a(n)) = 2. Complement of A161989. A151774(a(n)) = 1. - Reinhard Zumkeller, Jun 24 2009
A073267(a(n)) = 2. - Reinhard Zumkeller, Mar 07 2012
Start with A000051. If n is in sequence, then so is 2n. - Ralf Stephan, Aug 16 2013
a(n) = A057168(a(n-1)) for n>1 and a(1) = 3. - Marc LeBrun, Jan 01 2014
From Hieronymus Fischer, Apr 20 2014: (Start)
Formulas for a general parameter b according to a(n) = b^i + b^j, i>j>=0; b = 2 for this sequence.
a(n) = b^i + b^j, where i = floor((sqrt(8n - 1) + 1)/2), j = n - 1 - i*(i - 1)/2 [for a Smalltalk implementation see Prog section, method distinctPowersOf: b (2 versions)].
a(A000217(n)) = (b + 1)*b^(n-1) = b^n + b^(n-1).
a(A000217(n)+1) = 1 + b^(n+1).
a(n + 1 + floor((sqrt(8n - 1) + 1)/2)) = b*a(n).
a(n + 1 + floor(log_b(a(n)))) = b*a(n).
a(n + 1) = b^2/(b+1) * a(n) + 1, if n is a triangular number (s. A000217).
a(n + 1) = b*a(n) + (1-b)* b^floor((sqrt(8n - 1) + 1)/2), if n is not a triangular number.
The next term can also be calculated without using the index n. Let m be a term and i = floor(log_b(m)), then:
a(n + 1) = b*m + (1-b)* b^i, if floor(log_b(m/(b+1))) + 1 < i,
a(n + 1) = b^2/(b+1) * m + 1, if floor(log_b(m/(b+1))) + 1 = i.
Partial sum:
Sum_{k=1..n} a(k) = ((((b-1)*(j+1)+i-1)*b^(i-j) + b)*b^j - i)/(b-1), where i = floor((sqrt(8*n - 1) + 1)/2), j = n - 1 - i*(i - 1)/2.
Inverse:
For each sequence term m, the index n such that a(n) = m is determined by n := i*(i-1)/2 + j + 1, where i := floor(log_b(m)), j := floor(log_b(m - b^floor(log_b(m)))) [for a Smalltalk implementation see Prog section, method invertedDistinctPowersOf: b].
Inequalities:
a(n) <= (b+1)/b * b^floor(sqrt(2n)+1/2), equality holds for triangular numbers.
a(n) > b^floor(sqrt(2n)+1/2).
a(n) < b^sqrt(2n)*sqrt(b).
a(n) > b^sqrt(2n)/sqrt(b).
Asymptotic behavior:
lim sup a(n)/b^sqrt(2n) = sqrt(b).
lim inf a(n)/b^sqrt(2n) = 1/sqrt(b).
lim sup a(n)/b^(floor(sqrt(2n))) = b.
lim inf a(n)/b^(floor(sqrt(2n))) = 1.
lim sup a(n)/b^(floor(sqrt(2n)+1/2)) = (b+1)/b.
lim inf a(n)/b^(floor(sqrt(2n)+1/2)) = 1.
(End)
Sum_{n>=1} 1/a(n) = A179951. - Amiram Eldar, Oct 06 2020

Extensions

Edited by M. F. Hasler, Dec 23 2016

A023359 Number of compositions (ordered partitions) of n into powers of 2.

Original entry on oeis.org

1, 1, 2, 3, 6, 10, 18, 31, 56, 98, 174, 306, 542, 956, 1690, 2983, 5272, 9310, 16448, 29050, 51318, 90644, 160118, 282826, 499590, 882468, 1558798, 2753448, 4863696, 8591212, 15175514, 26805983, 47350056, 83639030, 147739848, 260967362
Offset: 0

Views

Author

Keywords

Comments

a(n) is the number of partitions of 2n into n parts, with each partition realized into non-symmetric permutations ignoring 1's. For example a(6): the partitions of 12 into 6 are: 111117 (1), 111126 (1), 111135 (1), 111144 (1), 111225 (2), 111234 (3), 111333 (1), 112233 (3), 112224 (2), 122223 (2), 222222 (1), where the number in brackets is the number of non-symmetric permutations ignoring 1's (e.g., 111234, ignore 1's -> 234 and we can also have 243 and 324, 112233->2233 or 2323 or 2332). The sum of the bracketed numbers is a(6)=18. - Jon Perry, Jun 22 2003
a(n) is an eigensequence for the sequence array of the Fredholm-Rueppel sequence A036987. - Paul Barry, Nov 03 2010
a(n) is the number of ways to express n in Napier's location numerals (see Wikipedia). - P. Christopher Staecker, Jul 04 2024

Examples

			A(x) = A(x^2) + x*A(x^2)^2 + x^2*A(x^2)^3 + x^3*A(x^2)^4 + ... = 1 + x + 2x^2 + 3x^3 + 6x^4 + 10x^5 + 18x^6 + 31x^7 + ....
From _Joerg Arndt_, Dec 28 2012: (Start)
There are a(6)=18 compositions of 6 into powers of 2:
[ 1]  [ 1 1 1 1 1 1 ]
[ 2]  [ 1 1 1 1 2 ]
[ 3]  [ 1 1 1 2 1 ]
[ 4]  [ 1 1 2 1 1 ]
[ 5]  [ 1 1 2 2 ]
[ 6]  [ 1 1 4 ]
[ 7]  [ 1 2 1 1 1 ]
[ 8]  [ 1 2 1 2 ]
[ 9]  [ 1 2 2 1 ]
[10]  [ 1 4 1 ]
[11]  [ 2 1 1 1 1 ]
[12]  [ 2 1 1 2 ]
[13]  [ 2 1 2 1 ]
[14]  [ 2 2 1 1 ]
[15]  [ 2 2 2 ]
[16]  [ 2 4 ]
[17]  [ 4 1 1 ]
[18]  [ 4 2 ]
(End)
		

Crossrefs

The column sums of the table A073265.

Programs

  • Maple
    a:= proc(n) option remember;
          `if`(n=0, 1, add(a(n-2^i), i=0..ilog2(n)))
        end:
    seq(a(n), n=0..50);  # Alois P. Heinz, Jan 11 2014
  • Mathematica
    CoefficientList[Series[1/(1 - Sum[x^(2^i), {i, 0, 20}]), {x, 0, 20}], x]
    a[0] = 1; a[n_] := a[n] = Sum[a[n-2^k], {k, 0, Log[2, n]}]; Table[a[n], {n, 0, 50}] (* Jean-François Alcover, Oct 25 2015, after Alois P. Heinz *)
  • PARI
    {a(n) = local(A, m); if( n<0, 0, m=1; A = 1 + O(x); while( m<=n, m*=2; A = 1 /(1 / subst(A, x, x^2) - x)); polcoeff(A, n))}; /* Michael Somos, Dec 20 2002 */
    
  • PARI
    N=66; x='x+O('x^N);
    Vec( 1/(1-sum(k=0,ceil(log(N)/log(2)), x^(2^k) ) ) )
    /* Joerg Arndt, Oct 21 2012 */

Formula

G.f.: 1 / (1 - Sum_{k>=0} x^(2^k)). - Joerg Arndt, Oct 21 2012
a(n) = [n=0] + Sum_{k>=0} a(n-2^k). - Len Smiley, May 07 2001
A(x) = A(x^2)/(1 - x*A(x^2)). - Paul D. Hanna, Dec 16 2002
INVERT transform of characteristic function of powers of 2, i.e., A036987 interpreted with an offset 1 instead of 0. - Antti Karttunen, Dec 12 2003
a(n) seems to be asymptotic to A*B^n where A=0.332198..., B=1.766398... - Benoit Cloitre, Dec 17 2002. More accurately: B=1.76639811455017359722848839244009973023206928795707277527828507440838434..., A=0.58679374529351144845013208294162259198824401250194713608555348278359775... - Vaclav Kotesovec, Apr 30 2014
Satisfies A(x) = 1 + A(x) * Sum_{k>=0} x^(2^k). a(m) == 1 (mod 2) when m=2^n-1, otherwise a(m) == 0 (mod 2). - Paul D. Hanna, Aug 27 2003
a(m) == 0 (mod 4) if A000120(m+2) >= 4. In general, a(m) == 0 (mod 2^N) if A000120(m+2^(N-1)) >= 2^N. - Giedrius Alkauskas, Mar 05 2010

Extensions

Edited by Franklin T. Adams-Watters, Aug 05 2005

A073202 Array of fix-count sequences for the table A073200.

Original entry on oeis.org

1, 1, 1, 0, 1, 1, 1, 2, 1, 1, 0, 3, 0, 1, 1, 2, 8, 1, 0, 1, 1, 0, 20, 0, 0, 0, 1, 1, 5, 60, 2, 0, 1, 0, 1, 1, 0, 181, 0, 0, 0, 0, 0, 1, 1, 14, 584, 5, 0, 2, 0, 1, 2, 1, 1, 0, 1916, 0, 0, 0, 0, 0, 5, 0, 1, 1, 42, 6476, 14, 0, 5, 0, 0, 14, 1, 2, 1, 1, 0, 22210, 0, 0, 0, 0, 0, 42, 0, 1, 0, 1, 1
Offset: 0

Views

Author

Antti Karttunen, Jun 25 2002

Keywords

Comments

Each row of this table gives the counts of elements fixed by the Catalan bijection (given in the corresponding row of A073200) when it acts on A000108(n) structures encoded in the range [A014137(n-1)..A014138(n-1)] of the sequence A014486/A063171.

Crossrefs

Cf. also A073201, A073203.
Few EIS-sequences which occur in this table. Only the first known occurrence(s) given (marked with ? if not yet proved/unclear):
Rows 0, 2, 4, etc.: "Aerated Catalan numbers" shifted right and prepended with 1 (Cf. A000108), Row 1: A073190, Rows 3, 5, 261, 2614, 2618, 17517, etc: A019590 but with offset 0 instead of 1 (means that the Catalan bijections like A073269, A073270, A057501, A057505, A057503 and A057161 never fix any Catalan structure of size larger than 1).
Row 6: A036987, Row 7: A000108, Rows 12, 14, 20, ...: A057546, Rows 16, 18: A034731, Row 41: A073268, Row 105: essentially A073267, Row 57, ..., 164: A001405, Row 168: A073192, Row 416: essentially A023359 ?, Row 10435: also A036987.

A073290 Permutation A069767 applied twice ("squared").

Original entry on oeis.org

0, 1, 2, 3, 5, 4, 6, 8, 7, 12, 13, 11, 10, 9, 15, 14, 19, 21, 22, 16, 20, 18, 17, 31, 32, 34, 35, 36, 30, 33, 29, 26, 27, 28, 25, 24, 23, 40, 41, 39, 38, 37, 52, 51, 56, 58, 59, 60, 62, 63, 64, 43, 42, 53, 57, 61, 47, 55, 49, 50, 44, 54, 48, 46, 45, 87, 88, 90, 91, 92, 96, 97
Offset: 0

Views

Author

Antti Karttunen, Jun 25 2002

Keywords

Crossrefs

Inverse permutation: A073291. Occurs for first time in A073200 as row 105. A073267 gives essentially (apart from the first two terms) the counts of elements fixed. Cf. A073292-A073299.

Formula

a(n) = A069767(A069767(n)).

A151759 G.f.: Theta^3, where Theta = Sum_{k>=0} x^(2^k).

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Jun 22 2009

Keywords

Comments

Number of ways to write n as an ordered sum of 3 powers of 2. - Ilya Gutkovskiy, Feb 02 2021

Crossrefs

(Sum_{k>=0} x^(2^k))^m; A209229 (m=1), A073267 (m=2), this sequence (m=3), A151760 (m=4), A151761 (m=5), A151762 (m=6).

Programs

  • Maple
    b:= proc(n, t) option remember; `if`(n=0, `if`(t=0, 1, 0),
          `if`(t<1, 0, add(b(n-2^j, t-1), j=0..ilog2(n))))
        end:
    a:= n-> b(n, 3):
    seq(a(n), n=0..104);  # Alois P. Heinz, Feb 02 2021
  • Mathematica
    b[n_, t_] := b[n, t] = If[n == 0, If[t == 0, 1, 0],
         If[t < 1, 0, Sum[b[n - 2^j, t - 1], {j, 0, Floor@Log2[n]}]]];
    a[n_] := b[n, 3];
    Table[a[n], {n, 0, 104}] (* Jean-François Alcover, Mar 08 2022, after Alois P. Heinz *)

A151761 G.f.: Theta^5, where Theta = Sum_{k>=0} x^(2^k).

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 5, 10, 15, 25, 31, 30, 40, 50, 50, 60, 75, 65, 55, 70, 66, 70, 90, 100, 100, 90, 90, 100, 110, 100, 120, 120, 75, 65, 95, 70, 90, 110, 130, 100, 126, 110, 130, 140, 150, 140, 160, 120, 100, 90, 130, 100, 150, 140, 160, 120, 110, 100, 160, 120, 120, 120, 120
Offset: 0

Views

Author

N. J. A. Sloane, Jun 22 2009

Keywords

Comments

Number of ways to write n as an ordered sum of 5 powers of 2. - Ilya Gutkovskiy, Feb 02 2021

Crossrefs

(Sum_{k>=0} x^(2^k))^m; A209229 (m=1), A073267 (m=2), A151759 (m=3), A151760 (m=4), this sequence (m=5), A151762 (m=6).
Cf. A151758.

Programs

  • Maple
    b:= proc(n, t) option remember; `if`(n=0, `if`(t=0, 1, 0),
          `if`(t<1, 0, add(b(n-2^j, t-1), j=0..ilog2(n))))
        end:
    a:= n-> b(n, 5):
    seq(a(n), n=0..62);  # Alois P. Heinz, Feb 02 2021
  • Mathematica
    b[n_, t_] := b[n, t] = If[n == 0, If[t == 0, 1, 0],
         If[t < 1, 0, Sum[b[n - 2^j, t - 1], {j, 0, Floor@Log2[n]}]]];
    a[n_] := b[n, 5];
    Table[a[n], {n, 0, 62}] (* Jean-François Alcover, Apr 25 2022, after Alois P. Heinz *)

A151762 G.f.: Theta^6, where Theta = Sum_{k>=0} x^(2^k).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 1, 6, 15, 26, 45, 66, 76, 96, 126, 140, 165, 210, 221, 210, 240, 252, 246, 300, 346, 360, 366, 380, 396, 420, 440, 480, 525, 450, 405, 450, 416, 396, 510, 540, 510, 516, 582, 540, 636, 660, 720, 720, 706, 600, 630, 620, 636, 660, 800, 720, 756, 660, 720
Offset: 0

Views

Author

N. J. A. Sloane, Jun 22 2009

Keywords

Comments

Number of ways to write n as an ordered sum of 6 powers of 2. - Ilya Gutkovskiy, Feb 02 2021

Crossrefs

(Sum_{k>=0} x^(2^k))^m; A209229 (m=1), A073267 (m=2), A151759 (m=3), A151760 (m=4), A151761 (m=5), this sequence (m=6).
Cf. A151758.

Programs

  • Maple
    b:= proc(n, t) option remember; `if`(n=0, `if`(t=0, 1, 0),
          `if`(t<1, 0, add(b(n-2^j, t-1), j=0..ilog2(n))))
        end:
    a:= n-> b(n, 6):
    seq(a(n), n=0..58);  # Alois P. Heinz, Feb 02 2021
  • Mathematica
    b[n_, t_] := b[n, t] = If[n == 0, If[t == 0, 1, 0],
         If[t < 1, 0, Sum[b[n - 2^j, t - 1], {j, 0, Floor@Log2[n]}]]];
    a[n_] := b[n, 6];
    Table[a[n], {n, 0, 58}] (* Jean-François Alcover, Apr 25 2022, after Alois P. Heinz *)

A072823 Numbers that are not the sum of two powers of 2.

Original entry on oeis.org

1, 7, 11, 13, 14, 15, 19, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 35, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 67, 69, 70, 71, 73, 74, 75, 76, 77, 78, 79, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97
Offset: 1

Views

Author

Jeremy Gardiner, Jul 21 2002

Keywords

Comments

1 and integers with three or more 1-bits in their binary expansion. - Vladimir Baltic, Jul 23 2002
Appears to be the numbers k >1 for which there exist an x and y (x>y) such that x OR y = k, x+y != k, and xGary Detlefs, Jun 02 2014

Crossrefs

Programs

  • Haskell
    a072823 n = a072823_list !! (n-1)
    a072823_list = tail $ elemIndices 0 a073267_list
    -- Reinhard Zumkeller, Mar 07 2012
    
  • Maple
    f:= x -> convert(convert(x,base,2),`+`)>2:
    {1} union select(f, {$2..1000}); # Robert Israel, Jun 08 2014
  • Mathematica
    Join[{1}, Select[Range[100], DigitCount[#, 2, 1] >= 3&]] (* Jean-François Alcover, Mar 08 2019 *)
  • Python
    from math import comb
    from itertools import count, islice
    def A072823(n):
        def f(x):
            s = bin(x)[2:]
            c = n-1+(l:=len(s))+comb(l-1,2)
            try:
                c += l-1-s[1:].index('1')
            except:
                pass
            return c
        m, k = n-1, f(n-1)
        while m != k: m, k = k, f(k)
        return m
    def A072823_gen(): # generator of terms
        return filter(lambda n:n==1 or n.bit_count()>2,count(1))
    A072823_list = list(islice(A072823_gen(),50)) # Chai Wah Wu, Oct 30 2024

Formula

A073267(a(n)) = 0. [Reinhard Zumkeller, Mar 07 2012]

A073265 Table T(n,k) (listed antidiagonalwise in order T(1,1), T(2,1), T(1,2), T(3,1), T(2,2), ...) giving the number of compositions (ordered partitions) of n into exactly k powers of 2.

Original entry on oeis.org

1, 1, 0, 0, 1, 0, 1, 2, 0, 0, 0, 1, 1, 0, 0, 0, 2, 3, 0, 0, 0, 0, 2, 3, 1, 0, 0, 0, 1, 0, 4, 4, 0, 0, 0, 0, 0, 1, 6, 6, 1, 0, 0, 0, 0, 0, 2, 3, 8, 5, 0, 0, 0, 0, 0, 0, 2, 3, 13, 10, 1, 0, 0, 0, 0, 0, 0, 0, 6, 12, 15, 6, 0, 0, 0, 0, 0, 0, 0, 2, 6, 10, 25, 15, 1, 0, 0, 0, 0, 0, 0, 0, 0, 4, 16, 31, 26, 7, 0, 0, 0, 0, 0, 0, 0
Offset: 1

Views

Author

Antti Karttunen, Jun 25 2002

Keywords

Examples

			T(6,3) = 4 because there are four ordered partitions of 6 into 3 powers of 2, namely: 4+1+1, 1+4+1, 1+1+4 and 2+2+2 and it is recursively computed from T(5,2)+T(4,2)+T(2,2) = 2+1+1.
		

Crossrefs

The first row is equal to the characteristic function of A000079, i.e., A036987 with offset 1 instead of 0 and the second row is A073267. The column sums give A023359. A073266 gives the upper triangular region of this array.

Programs

  • Maple
    T:= proc(n, k) option remember; `if`(k>n, 0,
          `if`(n=k, 1, add(T(n-2^j, k-1), j=0..ilog2(n))))
        end:
    seq(seq(T(d-k+1, k), k=1..d), d=1..20);  # Alois P. Heinz, Mar 26 2014
  • Mathematica
    T[n_, k_] := If[k>n, 0, SeriesCoefficient[Sum[x^(2^j), {j, 0, Log[2, n] // Ceiling} ]^k, {x, 0, n}]]; Table[T[n-k+1, k], {n, 1, 20}, {k, 1, n}] // Flatten (* Jean-François Alcover, Mar 06 2015, after Emeric Deutsch *)

Formula

T(0, k) = T(n, 0) = 0, T(n, k) = 0 if k > n, T(n, 1) = 1 if n = 2^m, 0 otherwise and in other cases T(n, k) = Sum_{i=0..floor(log_2(n-1))} T(n-(2^i), k-1).
T(n, k) is the coefficient of x^n in the formal power series (x + x^2 + x^4 + x^8 + x^16 + ...)^k. - Emeric Deutsch, Feb 04 2005

A151758 G.f.: Theta^2-Theta, where Theta = Sum_{k>=0} x^(2^k).

Original entry on oeis.org

0, -1, 0, 2, 0, 2, 2, 0, 0, 2, 2, 0, 2, 0, 0, 0, 0, 2, 2, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 0

Views

Author

N. J. A. Sloane, Jun 22 2009

Keywords

Comments

If we omit the "-x" term and divide by 2, we get the characteristic function of the numbers with binary weight 2 (A018900, A151774).

Crossrefs

Programs

  • Mathematica
    w[n_] := IntegerDigits[n, 2] // Total;
    a[n_] := If[n == 1, -1, 2 Boole[w[n] == 2]];
    a /@ Range[0, 104] (* Jean-François Alcover, Mar 31 2021 *)
Showing 1-10 of 17 results. Next