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

A006095 Gaussian binomial coefficient [n, 2] for q = 2.

Original entry on oeis.org

0, 0, 1, 7, 35, 155, 651, 2667, 10795, 43435, 174251, 698027, 2794155, 11180715, 44731051, 178940587, 715795115, 2863245995, 11453115051, 45812722347, 183251413675, 733006703275, 2932028910251, 11728119835307, 46912487729835
Offset: 0

Views

Author

Keywords

Comments

Number of 4-block coverings of an n-set where every element of the set is covered by exactly 3 blocks (if offset is 3), so a(n) = (1/4!)*(4^n-6*2^n+8). - Vladeta Jovovic, Feb 20 2001
Number of non-coprime pairs of polynomials (f,g) with binary coefficients where both f and g have degree n+1 and nonzero constant term. - Luca Mariot and Enrico Formenti, Sep 26 2016
Number of triplets found from the integers 1 to 2^n-1 by converting to binary and performing an XOR operation on the corresponding bits of each pair. Defining addition in this carryless way (0+0=1+1=0, 0+1=1+0=1), each triplet (A,B,C) has the property A+B=C, A+C=B and B+C=A. For example, n=3 gives the 7 triplets (1,2,3), (1,4,5), (1,6,7), (2,4,6), (2,5,7), (3,4,7) and (3,5,6). Each integer appears in the set of triplets 2^(n-1)-1 times, for example 3 for n=3. - Ian Duff, Oct 05 2019
Number of 2-dimensional vector subspaces of (Z_2)^n, so also number of Klein subgroups of the group (C_2)^n. - Robert FERREOL, Jul 28 2021

References

  • J. Goldman and G.-C. Rota, The number of subspaces of a vector space, pp. 75-83 of W. T. Tutte, editor, Recent Progress in Combinatorics. Academic Press, NY, 1969.
  • I. P. Goulden and D. M. Jackson, Combinatorial Enumeration. Wiley, NY, 1983, p. 99.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • M. Sved, Gaussians and binomials, Ars. Combinatoria, 17A (1984), 325-351.

Crossrefs

First differences: A006516.
Gaussian binomial coefficient [n, k] for q = 2: A000225 (k = 1), this sequence (k = 2), A006096 (k = 3), A006097 (k = 4), A006110 (k = 5), A022189 - A022195 (k = 6 thru 12).

Programs

  • Maple
    a:= n-> add((4^(n-1-j) - 2^(n-1-j))/2, j=0..n-1):
    seq(a(n), n=0..24); # Zerinvary Lajos, Jan 04 2007
    A006095 := -z^2/(z-1)/(2*z-1)/(4*z-1); # Simon Plouffe in his 1992 dissertation. [adapted to offset 0 by Peter Luschny, Jul 20 2021]
    a := n -> (2^n - 2)*(2^n - 1)/6:
    seq(a(n), n = 0..24); # Peter Luschny, Jul 20 2021
  • Mathematica
    Join[{a=0,b=0},Table[c=6*b-8*a+1;a=b;b=c,{n,60}]] (* Vladimir Joseph Stephan Orlovsky, Feb 06 2011 *)
    CoefficientList[Series[x^2/((1-x)(1-2x)(1-4x)),{x,0,30}],x] (* or *) LinearRecurrence[{7,-14,8},{0,0,1},30] (* Harvey P. Dale, Jul 22 2011 *)
    (* Next, using elementary symmetric functions *)
    f[k_] := 2^(k - 1); t[n_] := Table[f[k], {k, 1, n}]
    a[n_] := SymmetricPolynomial[2, t[n]]
    Table[a[n], {n, 2, 32}]    (* A203235 *)
    Table[a[n]/2, {n, 2, 32}]  (* A006095 *)
    (* Clark Kimberling, Dec 31 2011 *)
    Table[QBinomial[n, 2, 2], {n, 0, 24}] (* Arkadiusz Wesolowski, Nov 12 2015 *)
  • PARI
    a(n) = (2^n - 1)*(2^(n-1) - 1)/3 \\ Charles R Greathouse IV, Jul 25 2011
    
  • PARI
    concat([0, 0], Vec(x^2/((1-x)*(1-2*x)*(1-4*x)) + O(x^50))) \\ Altug Alkan, Nov 12 2015
  • Sage
    [gaussian_binomial(n,2,2) for n in range(0,25)] # Zerinvary Lajos, May 24 2009
    

Formula

G.f.: x^2/((1-x)(1-2x)(1-4x)).
a(n) = (2^n - 1)*(2^(n-1) - 1)/3 = 4^n/6 - 2^(n-1) + 1/3.
Row sums of triangle A130324. - Gary W. Adamson, May 24 2007
a(n) = Stirling2(n+1,3) + Stirling2(n+1,4). - Zerinvary Lajos, Oct 04 2007; corrected by R. J. Mathar, Mar 19 2011
a(n) = A139250(2^(n-1) - 1), n >= 1. - Omar E. Pol, Mar 03 2011
a(n) = 4*a(n-1) + 2^(n-1) - 1, n >= 2. - Vincenzo Librandi, Mar 19 2011
a(0) = 0, a(1) = 0, a(2) = 1, a(n) = 7*a(n-1) - 14*a(n-2) + 8*a(n-3). - Harvey P. Dale, Jul 22 2011
a(n) = Sum_{k=0..n-2} 2^k*C(2*n-k-2, k), n >= 2. - Johannes W. Meijer, Aug 19 2013
a(n) = Sum_{i=0..n-2, j=i..n-2} 2^{i+j} = 2^0 * (2^0 + 2^1 + ... + 2^(n-2)) + 2^1 * (2^1 + 2^2 + ... + 2^(n-2)) + ... + 2^(n-2) * 2^(n-2), n>1. - J. M. Bergot, May 08 2017
a(n) = a(n-1) + A000217(A000225(n-1)), n > 0. - Ivan N. Ianakiev, Dec 11 2017
E.g.f.: (2*exp(x)-3*exp(2*x)+exp(4*x))/6. - Paul Weisenhorn, Aug 22 2021
From Peter Bala, Jul 01 2025: (Start)
G.f. assuming an offset of 0: exp( Sum_{n >= 1} b(3*n)/b(n)*x^n/n ) = 1 + 7*x + 35*x^2 + ..., where b(n) = A000225(n) = 2^n - 1.
The following are examples of telescoping series:
Sum_{n >= 2} 2^n/a(n) = 6, follows from 1 - (1/6)*Sum_{k = 2..n} 2^k/a(k) = 1/(2^n - 1).
Sum_{n >= 2} 2^n/(a(n)*a(n+2)) = 6/49, follows from 1 - (49/6)*Sum_{k = 2..n} 2^k/(a(k)*a(k+2)) = 1/A006096(n+2);
Sum_{n >= 2} 4^n/(a(n)*a(n+2)) = 26/49, follows from 13 - (49/2)*Sum_{k = 2..n} 4^k/(a(k)*a(k+2)) = A086224(n)/A006096(n+2);
Sum_{n >= 2} 8^n/(a(n)*a(n+2)) = 129/49, follows from 43 - (49/3)*Sum_{k = 2..n} 8^k/(a(k)*a(k+2)) = A171479(n+1)/A006096(n+2). (End)

A089633 Numbers having no more than one 0 in their binary representation.

Original entry on oeis.org

0, 1, 2, 3, 5, 6, 7, 11, 13, 14, 15, 23, 27, 29, 30, 31, 47, 55, 59, 61, 62, 63, 95, 111, 119, 123, 125, 126, 127, 191, 223, 239, 247, 251, 253, 254, 255, 383, 447, 479, 495, 503, 507, 509, 510, 511, 767, 895, 959, 991, 1007, 1015, 1019, 1021, 1022, 1023
Offset: 0

Views

Author

Reinhard Zumkeller, Jan 01 2004

Keywords

Comments

Complement of A158582. - Reinhard Zumkeller, Apr 16 2009
Also union of A168604 and A030130. - Douglas Latimer, Jul 19 2012
Numbers of the form 2^t - 2^k - 1, 0 <= k < t.
n is in the sequence if and only if 2*n+1 is in the sequence. - Robert Israel, Dec 14 2018
Also the least binary rank of a strict integer partition of n, where the binary rank of a partition y is given by Sum_i 2^(y_i-1). - Gus Wiseman, May 24 2024

Examples

			From _Tilman Piesk_, May 09 2012: (Start)
This may also be viewed as a triangle:             In binary:
                  0                                         0
               1     2                                 01       10
             3    5    6                          011      101      110
           7   11   13   14                  0111     1011     1101     1110
        15   23   27   29   30          01111    10111    11011    11101    11110
      31  47   55   59   61   62
   63   95  111  119  123  125  126
Left three diagonals are A000225,  A055010, A086224. Right diagonal is A000918. Central column is A129868. Numbers in row n (counted from 0) have n binary 1s. (End)
From _Gus Wiseman_, May 24 2024: (Start)
The terms together with their binary expansions and binary indices begin:
   0:      0 ~ {}
   1:      1 ~ {1}
   2:     10 ~ {2}
   3:     11 ~ {1,2}
   5:    101 ~ {1,3}
   6:    110 ~ {2,3}
   7:    111 ~ {1,2,3}
  11:   1011 ~ {1,2,4}
  13:   1101 ~ {1,3,4}
  14:   1110 ~ {2,3,4}
  15:   1111 ~ {1,2,3,4}
  23:  10111 ~ {1,2,3,5}
  27:  11011 ~ {1,2,4,5}
  29:  11101 ~ {1,3,4,5}
  30:  11110 ~ {2,3,4,5}
  31:  11111 ~ {1,2,3,4,5}
  47: 101111 ~ {1,2,3,4,6}
  55: 110111 ~ {1,2,3,5,6}
  59: 111011 ~ {1,2,4,5,6}
  61: 111101 ~ {1,3,4,5,6}
  62: 111110 ~ {2,3,4,5,6}
(End)
		

Crossrefs

Cf. A181741 (primes), union of A081118 and A000918, apart from initial -1.
For least binary index (instead of rank) we have A001511.
Applying A019565 (Heinz number of binary indices) gives A077011.
For greatest binary index we have A029837 or A070939, opposite A070940.
Row minima of A118462 (binary ranks of strict partitions).
For sum instead of minimum we have A372888, non-strict A372890.
A000009 counts strict partitions, ranks A005117.
A048675 gives binary rank of prime indices, distinct A087207.
A048793 lists binary indices, product A096111, reverse A272020.
A277905 groups all positive integers by binary rank of prime indices.

Programs

  • Haskell
    a089633 n = a089633_list !! (n-1)
    a089633_list = [2 ^ t - 2 ^ k - 1 | t <- [1..], k <- [t-1,t-2..0]]
    -- Reinhard Zumkeller, Feb 23 2012
    
  • Maple
    seq(seq(2^a-1-2^b,b=a-1..0,-1),a=1..11); # Robert Israel, Dec 14 2018
  • Mathematica
    fQ[n_] := DigitCount[n, 2, 0] < 2; Select[ Range[0, 2^10], fQ] (* Robert G. Wilson v, Aug 02 2012 *)
  • PARI
    {insq(n) = local(dd, hf, v); v=binary(n);hf=length(v);dd=sum(i=1,hf,v[i]);if(dd<=hf-2,-1,1)}
    {for(w=0,1536,if(insq(w)>=0,print1(w,", ")))}
    \\ Douglas Latimer, May 07 2013
    
  • PARI
    isoka(n) = #select(x->(x==0), binary(n)) <= 1; \\ Michel Marcus, Dec 14 2018
    
  • Python
    from itertools import count, islice
    def A089633_gen(): # generator of terms
        return ((1<A089633_list = list(islice(A089633_gen(),30)) # Chai Wah Wu, Feb 10 2023
    
  • Python
    from math import isqrt, comb
    def A089633(n): return (1<<(a:=(isqrt((n<<3)+1)-1>>1)+1))-(1<Chai Wah Wu, Dec 19 2024

Formula

A023416(a(n)) <= 1; A023416(a(n)) = A023532(n-2) for n>1;
A000120(a(u)) <= A000120(a(v)) for uA000120(a(n)) = A003056(n).
a(0)=0, n>0: a(n+1) = Min{m>n: BinOnes(a(n))<=BinOnes(m)} with BinOnes=A000120.
If m = floor((sqrt(8*n+1) - 1) / 2), then a(n) = 2^(m+1) - 2^(m*(m+3)/2 - n) - 1. - Carl R. White, Feb 10 2009
A029931(a(n)) = n and A029931(m) != n for m < a(n). - Reinhard Zumkeller, Feb 28 2014
A265705(a(n),k) = A265705(a(n),a(n)-k), k = 0 .. a(n). - Reinhard Zumkeller, Dec 15 2015
a(A014132(n)-1) = 2*a(n-1)+1 for n >= 1. - Robert Israel, Dec 14 2018
Sum_{n>=1} 1/a(n) = A065442 + A160502 = 3.069285887459... . - Amiram Eldar, Jan 09 2024
A019565(a(n)) = A077011(n). - Gus Wiseman, May 24 2024

A036044 BCR(n): write in binary, complement, reverse.

Original entry on oeis.org

1, 0, 2, 0, 6, 2, 4, 0, 14, 6, 10, 2, 12, 4, 8, 0, 30, 14, 22, 6, 26, 10, 18, 2, 28, 12, 20, 4, 24, 8, 16, 0, 62, 30, 46, 14, 54, 22, 38, 6, 58, 26, 42, 10, 50, 18, 34, 2, 60, 28, 44, 12, 52, 20, 36, 4, 56, 24, 40, 8, 48, 16, 32, 0, 126, 62, 94, 30, 110, 46, 78, 14, 118, 54, 86
Offset: 0

Views

Author

Keywords

Comments

a(0) could be considered to be 0 if the binary representation of zero were chosen to be the empty string. - Jason Kimberley, Sep 19 2011
From Bernard Schott, Jun 15 2021: (Start)
Except for a(0) = 1, every term is even.
For each q >= 0, there is one and only one odd number h such that a(n) = 2*q iff n = h*2^m-1 for m >= 1 when q = 0, and for m >= 0 when q >= 1 (see A345401 and some examples below).
a(n) = 0 iff n = 2^m-1 for m >= 1 (Mersenne numbers) (A000225).
a(n) = 2 iff n = 3*2^m-1 for m >= 0 (A153893).
a(n) = 4 iff n = 7*2^m-1 for m >= 0 (A086224).
a(n) = 6 iff n = 5*2^m-1 for m >= 0 (A153894).
a(n) = 8 iff n = 15*2^m-1 for m >= 0 (A196305).
a(n) = 10 iff n = 11*2^m-1 for m >= 0 (A086225).
a(n) = 12 iff n = 13*2^m-1 for m >= 0 (A198274).
For k >= 1, a(n) = 2^k iff n = (2^(k+1)-1)*2^m - 1 for m >= 0.
Explanation for a(n) = 2:
For m >= 0, A153893(m) = 3*2^m-1 -> 1011...11 -> 0100...00 -> 10 -> 2 where 1011...11_2 is 10 followed by m 1's. (End)

Examples

			4 -> 100 -> 011 -> 110 -> 6.
		

Crossrefs

Cf. A035928 (fixed points), A195063, A195064, A195065, A195066.
Indices of terms 0, 2, 4, 6, 8, 10, 12, 14, 18, 22, 26, 30: A000225 \ {0}, A153893, A086224, A153894, A196305, A086225, A198274, A052996\{1,3}, A291557, A198276, A171389, A198275.

Programs

  • Haskell
    import Data.List (unfoldr)
    a036044 0 = 1
    a036044 n = foldl (\v d -> 2 * v + d) 0 (unfoldr bc n) where
       bc 0 = Nothing
       bc x = Just (1 - m, x') where (x',m) = divMod x 2
    -- Reinhard Zumkeller, Sep 16 2011
    
  • Magma
    A036044:=func; // Jason Kimberley, Sep 19 2011
    
  • Maple
    A036044 := proc(n)
        local bcr ;
        if n = 0 then
            return 1;
        end if;
        convert(n,base,2) ;
        bcr := [seq(1-i,i=%)] ;
        add(op(-k,bcr)*2^(k-1),k=1..nops(bcr)) ;
    end proc:
    seq(A036044(n),n=0..200) ; # R. J. Mathar, Nov 06 2017
  • Mathematica
    dtn[ L_ ] := Fold[ 2#1+#2&, 0, L ]; f[ n_ ] := dtn[ Reverse[ 1-IntegerDigits[ n, 2 ] ] ]; Table[ f[ n ], {n, 0, 100} ]
    Table[FromDigits[Reverse[IntegerDigits[n,2]/.{1->0,0->1}],2],{n,0,80}] (* Harvey P. Dale, Mar 08 2015 *)
  • PARI
    a(n)=fromdigits(Vecrev(apply(n->1-n,binary(n))),2) \\ Charles R Greathouse IV, Apr 22 2015
    
  • Python
    def comp(s): z, o = ord('0'), ord('1'); return s.translate({z:o, o:z})
    def BCR(n): return int(comp(bin(n)[2:])[::-1], 2)
    print([BCR(n) for n in range(75)]) # Michael S. Branicky, Jun 14 2021
    
  • Python
    def A036044(n): return -int((s:=bin(n)[-1:1:-1]),2)-1+2**len(s) # Chai Wah Wu, Feb 04 2022

Formula

a(2n) = 2*A059894(n), a(2n+1) = a(2n) - 2^floor(log_2(n)+1). - Ralf Stephan, Aug 21 2003
Conjecture: a(n) = (-1)^A023416(n)*b(n) for n > 0 with a(0) = 1 where b(2^m) = (-1)^m*(2^(m+1) - 2) for m >= 0, b(2n+1) = b(n) for n > 0, b(2n) = b(n) + b(n - 2^f(n)) + b(2n - 2^f(n)) for n > 0 and where f(n) = A007814(n) (see A329369). - Mikhail Kurkov, Dec 13 2024

A030130 Binary expansion contains a single 0.

Original entry on oeis.org

0, 2, 5, 6, 11, 13, 14, 23, 27, 29, 30, 47, 55, 59, 61, 62, 95, 111, 119, 123, 125, 126, 191, 223, 239, 247, 251, 253, 254, 383, 447, 479, 495, 503, 507, 509, 510, 767, 895, 959, 991, 1007, 1015, 1019, 1021, 1022, 1535, 1791, 1919, 1983, 2015, 2031, 2039
Offset: 1

Views

Author

Toby Donaldson (tjdonald(AT)uwaterloo.ca)

Keywords

Comments

From Reinhard Zumkeller, Aug 29 2009: (Start)
A023416(a(n)) = 1;
apart from the initial term the sequence can be seen as a triangle read by rows, see A164874;
A055010 and A086224 are subsequences, see also A000918 and A036563. (End)
Zero and numbers of form 2^m-2^k-1, 2 <= m, 0 <= k <= m-2. - Zak Seidov, Aug 06 2010

Examples

			23 is OK because it is '10111' in base 2.
		

Crossrefs

Programs

  • C
    long int element (long int i) { return (pow(2,g(i))-1-pow(2,(pow(2*g(i)-1,2)-1-8*i)/8));} long int g(long int m) {if (m==0) return(1); return ((sqrt(8*m-7)+3)/2);}
    
  • Haskell
    a030130 n = a030130_list !! (n-1)
    a030130_list = filter ((== 1) . a023416) [0..]
    -- Reinhard Zumkeller, Mar 31 2015, Dec 07 2012
    
  • Magma
    [0] cat [k:k in [0..2050]| Multiplicity(Intseq(k,2),0) eq 1]; // Marius A. Burtea, Feb 06 2020
    
  • Mathematica
    Sort[Flatten[{{0}, Table[2^n - 2^m - 1, {n, 2, 50}, {m, 0, n - 2}]}]] (* Zak Seidov, Aug 06 2010 *)
    Select[Range[0,2100],DigitCount[#,2,0]==1&] (* Harvey P. Dale, Dec 19 2021 *)
  • PARI
    print1("0, ");for(k=1,2039,my(v=digits(k,2));if(vecsum(v)==#v-1,print1(k,", "))) \\ Hugo Pfoertner, Feb 06 2020
    
  • Python
    from math import isqrt, comb
    def A030130(n): return (1<<(a:=(isqrt(n-1<<3)+1>>1)+1))-(1<Chai Wah Wu, Dec 19 2024

Formula

a(n) = 2^(g(n))-1-2^(((2*g(n)-1)^2-1-8*n)/8) with g(n)=int((sqrt(8*n-7)+3)/2) for all n>0 and g(0)=1. - Ulrich Schimke (ulrschimke(AT)aol.com)
a(n+1) = A140977(a(n)) for any n > 1. - Rémy Sigrist, Feb 06 2020
Sum_{n>=2} 1/a(n) = A160502. - Amiram Eldar, Oct 06 2020
a(n) = (A190620(n-1)-1)/2. - Chai Wah Wu, Dec 19 2024

Extensions

More terms from Erich Friedman
Offset fixed by Reinhard Zumkeller, Aug 24 2009

A036991 Numbers k with the property that in the binary expansion of k, reading from right to left, the number of 0's never exceeds the number of 1's.

Original entry on oeis.org

0, 1, 3, 5, 7, 11, 13, 15, 19, 21, 23, 27, 29, 31, 39, 43, 45, 47, 51, 53, 55, 59, 61, 63, 71, 75, 77, 79, 83, 85, 87, 91, 93, 95, 103, 107, 109, 111, 115, 117, 119, 123, 125, 127, 143, 151, 155, 157, 159, 167, 171, 173, 175, 179, 181, 183, 187, 189, 191, 199, 203
Offset: 1

Views

Author

Keywords

Comments

List of binary words that correspond to a valid pairing of parentheses. - Joerg Arndt, Nov 27 2004
This sequence includes as subsequences A000225, A002450, A007583, A036994, A052940, A112627, A113836, A113841, A290114; and also A015521 (without 0), A083713 (without 0), A086224 (without 6), A182512 (without 0). - Gennady Eremin, Nov 27 2021 and Aug 26 2023
Partial differences are powers of 2 (cf. A367626, A367627). - Gennady Eremin, Dec 23 2021
This is the sequence A030101(A014486(n)), n >= 0, sorted into ascending order. See A014486 for more references, illustrations, etc., concerning Dyck paths and other associated structures enumerated by the Catalan numbers. - Antti Karttunen, Sep 25 2023
The terms in this sequence with a given length in base 2 are counted by A001405. For example, the number of terms of bit length k=5 (these are 19, 21, 23, 27, 29, and 31) is equal to A001405(k-1) = A001405(4) = 6. - Gennady Eremin, Nov 07 2023

Examples

			From _Joerg Arndt_, Dec 05 2021: (Start)
List of binary words with parentheses for those in the sequence (indicated by P). The binary words are scanned starting from the least significant bit, while the parentheses words are written left to right:
     Binary   Parentheses (if the value is in the sequence)
00:  ..... P  [empty string]
01:  ....1 P   ()
02:  ...1.
03:  ...11 P   (())
04:  ..1..
05:  ..1.1 P   ()()
06:  ..11.
07:  ..111 P   ((()))
08:  .1...
09:  .1..1
10:  .1.1.
11:  .1.11 P   (()())
12:  .11..
13:  .11.1 P   ()(())
14:  .111.
15:  .1111 P   (((())))
16:  1....
17:  1...1
18:  1..1.
19:  1..11 P   (())()
(End)
		

Crossrefs

Cf. A350577 (primes subsequence).
See also A014486, A030101, A036988, A036990, A036992. A036994 is a subset (requires the count of zeros to be strictly less than the count of 1's).
See also A030308, A000225, A002450, A007583, A350346, A367625, A367626 & A367627 (first differences).

Programs

  • Haskell
    a036991 n = a036991_list !! (n-1)
    a036991_list = filter ((p 1) . a030308_row) [0..] where
       p     []    = True
       p ones (0:bs) = ones > 1 && p (ones - 1) bs
       p ones (1:bs) = p (ones + 1) bs
    -- Reinhard Zumkeller, Jul 31 2013
    
  • Maple
    q:= proc(n) local l, t, i; l:= Bits[Split](n); t:=0;
          for i to nops(l) do t:= t-1+2*l[i];
            if t<0 then return false fi
          od: true
        end:
    select(q, [$0..300])[];  # Alois P. Heinz, Oct 09 2019
  • Mathematica
    moreOnesRLQ[n_Integer] := Module[{digits, len, flag = True, iter = 1, ones = 0, zeros = 0}, digits = Reverse[IntegerDigits[n, 2]]; len = Length[digits]; While[flag && iter < len, If[digits[[iter]] == 1, ones++, zeros++]; flag = ones >= zeros; iter++]; flag]; Select[Range[0, 203], moreOnesRLQ] (* Alonso del Arte, Sep 21 2011 *)
    Join[{0},Select[Range[210],Min[Accumulate[Reverse[IntegerDigits[#,2]]/.{0->-1}]]>-1&]] (* Harvey P. Dale, Apr 18 2014 *)
  • PARI
    select( {is_A036991(n,c=1)=!n||!until(!n>>=1,(c-=(-1)^bittest(n,0))||return)}, [0..99]) \\ M. F. Hasler, Nov 26 2021
  • Python
    def ok(n):
        if n == 0: return True # by definition
        count = {"0": 0, "1": 0}
        for bit in bin(n)[:1:-1]:
            count[bit] += 1
            if count["0"] > count["1"]: return False
        return True
    print([k for k in range(204) if ok(k)]) # Michael S. Branicky, Nov 25 2021
    
  • Python
    from itertools import count, islice
    def A036991_gen(): # generator of terms
        yield 0
        for n in count(1):
            s = bin(n)[2:]
            c, l = 0, len(s)
            for i in range(l):
                c += int(s[l-i-1])
                if 2*c <= i:
                    break
            else:
                yield n
    A036991_list = list(islice(A036991_gen(),20)) # Chai Wah Wu, Dec 30 2021
    

Formula

If a(n) = A000225(k) for some k, then a(n+1) = a(n) + A060546(k). - Gennady Eremin, Nov 07 2023

Extensions

More terms from Erich Friedman
Edited by N. J. A. Sloane, Sep 14 2008 at the suggestion of R. J. Mathar
Offset corrected and example adjusted accordingly by Reinhard Zumkeller, Jul 31 2013

A075300 Array A read by antidiagonals upwards: A(n, k) = array A054582(n,k) - 1 = 2^n*(2*k+1) - 1 with n,k >= 0.

Original entry on oeis.org

0, 1, 2, 3, 5, 4, 7, 11, 9, 6, 15, 23, 19, 13, 8, 31, 47, 39, 27, 17, 10, 63, 95, 79, 55, 35, 21, 12, 127, 191, 159, 111, 71, 43, 25, 14, 255, 383, 319, 223, 143, 87, 51, 29, 16, 511, 767, 639, 447, 287, 175, 103, 59, 33, 18, 1023, 1535, 1279, 895, 575, 351, 207, 119
Offset: 0

Views

Author

Antti Karttunen, Sep 12 2002

Keywords

Comments

From Philippe Deléham, Feb 19 2014: (Start)
A(0,k) = 2*k = A005843(k),
A(1,k) = 4*k + 1 = A016813(k),
A(2,k) = 8*k + 3 = A017101(k),
A(n,0) = A000225(n),
A(n,1) = A153893(n),
A(n,2) = A153894(n),
A(n,3) = A086224(n),
A(n,4) = A052996(n+2),
A(n,5) = A086225(n),
A(n,6) = A198274(n),
A(n,7) = A238087(n),
A(n,8) = A198275(n),
A(n,9) = A198276(n),
A(n,10) = A171389(n). (End)
A permutation of the nonnegative integers. - Alzhekeyev Ascar M, Jun 05 2016
The values in array row n, when expressed in binary, have n trailing 1-bits. - Ruud H.G. van Tol, Mar 18 2025

Examples

			The array A begins:
   0    2    4    6    8   10   12   14   16   18 ...
   1    5    9   13   17   21   25   29   33   37 ...
   3   11   19   27   35   43   51   59   67   75 ...
   7   23   39   55   71   87  103  119  135  151 ...
  15   47   79  111  143  175  207  239  271  303 ...
  31   95  159  223  287  351  415  479  543  607 ...
  ... - _Philippe Deléham_, Feb 19 2014
From _Wolfdieter Lang_, Jan 31 2019: (Start)
The triangle T begins:
   n\k   0    1    2   3   4   5   6   7  8  9 10 ...
   0:    0
   1:    1    2
   2:    3    5    4
   3:    7   11    9   6
   4:   15   23   19  13   8
   5    31   47   39  27  17  10
   6:   63   95   79  55  35  21  12
   7:  127  191  159 111  71  43  25  14
   8:  255  383  319 223 143  87  51  29 16
   9:  511  767  639 447 287 175 103  59 33 18
  10: 1023 1535 1279 895 575 351 207 119 67 37 20
  ...
T(3, 1) = 2^2*(2*1+1) - 1 = 12 - 1 = 11.  (End)
		

Crossrefs

Inverse permutation: A075301. Transpose: A075302. The X-projection is given by A007814(n+1) and the Y-projection A025480.

Programs

  • Maple
    A075300bi := (x,y) -> (2^x * (2*y + 1))-1;
    A075300 := n -> A075300bi(A025581(n), A002262(n));
    A002262 := n -> n - binomial(floor((1/2)+sqrt(2*(1+n))),2);
    A025581 := n -> binomial(1+floor((1/2)+sqrt(2*(1+n))),2) - (n+1);
  • Mathematica
    Table[(2^# (2 k + 1)) - 1 &[m - k], {m, 0, 10}, {k, 0, m}] (* Michael De Vlieger, Jun 05 2016 *)

Formula

From Wolfdieter Lang, Jan 31 2019: (Start)
Array A(n, k) = 2^n*(2*k+1) - 1, for n >= 0 and m >= 0.
The triangle is T(n, k) = A(n-k, k) = 2^(n-k)*(2*k+1) - 1, n >= 0, k=0..n.
See also A054582 after subtracting 1. (End)
From Ruud H.G. van Tol, Mar 17 2025: (Start)
A(0, k) is even. For n > 0, A(n, k) is odd and (3 * A(n, k) + 1) / 2 = A(n-1, 3*k+1).
A(n, k) = 2^n - 1 (mod 2^(n+1)) (equivalent to the comment about trailing 1-bits). (End)

A164874 Triangle read by rows: T(1,1)=2; T(n,k)=2*T(n-1,k)+1, 1<=k

Original entry on oeis.org

2, 5, 6, 11, 13, 14, 23, 27, 29, 30, 47, 55, 59, 61, 62, 95, 111, 119, 123, 125, 126, 191, 223, 239, 247, 251, 253, 254, 383, 447, 479, 495, 503, 507, 509, 510, 767, 895, 959, 991, 1007, 1015, 1019, 1021, 1022, 1535, 1791, 1919, 1983, 2015, 2031, 2039, 2043, 2045, 2046
Offset: 1

Views

Author

Reinhard Zumkeller, Aug 29 2009

Keywords

Comments

All terms contain exactly 1 zero in binary representation.

Examples

			Initial rows:
   1:                             2
   2:                        5        6
   3:                  11        13        14
   4:             23        27       29        30
   5:        47        55        59        61        62
   6:    95       111       119      123       125       126
also in binary representation:
                                 10
                            101       110
                      1011      1101      1110
                 10111     11011     11101     11110
           101111    110111    111011    111101    111110
      1011111   1101111   1110111   1111011   1111101   1111110 .
		

Crossrefs

Programs

  • Haskell
    a164874 n k = a164874_tabl !! (n-1) !! (k-1)
    a164874_row n = a164874_tabl !! (n-1)
    a164874_tabl = map reverse $ iterate f [2] where
       f xs@(x:_) = (2 * x + 2) : map ((+ 1) . (* 2)) xs
    -- Reinhard Zumkeller, Mar 31 2015
    
  • Mathematica
    A164874row[n_] := 2^(n + 1) - 1 - BitShiftRight[2^n, Range[n]];
    Array[A164874row, 10] (* Paolo Xausa, Jun 13 2025 *)
  • Python
    from math import isqrt
    def A164874(n): return (1<<(a:=(isqrt(n<<3)+1>>1)+1))-(1<<(a*(a-1)>>1)-n)-1 # Chai Wah Wu, May 21 2025

Formula

T(n,k) = 2^(n+1) - 2^(n-k) - 1, 1 <= k <= n.
T(n,k) = A030130(n*(n-1)/2 + k + 1);
A023416(T(n,k)) = 1, 1<=k<=n;
A059673(n) = sum of n-th row;
T(n,1) = A055010(n);
T(n,2) = A086224(n-2) for n > 1;
T(n,n-1) = A036563(n+1) for n > 1;
T(n,n) = A000918(n+1).

A198274 a(n) = 13*2^n-1.

Original entry on oeis.org

12, 25, 51, 103, 207, 415, 831, 1663, 3327, 6655, 13311, 26623, 53247, 106495, 212991, 425983, 851967, 1703935, 3407871, 6815743, 13631487, 27262975, 54525951, 109051903, 218103807, 436207615, 872415231, 1744830463, 3489660927, 6979321855, 13958643711
Offset: 0

Views

Author

Jeremy Gardiner, Oct 23 2011

Keywords

Comments

a(n) + a(n-1)^2 = (a(n-1)+1)^2. - Vincenzo Librandi, Mar 24 2013

Examples

			a(2) = 13*2^2-1 = 51.
		

Crossrefs

Programs

  • BASIC
    for j = 0 to 30 : print str$((13*2^j)-1)+", "; : next j
    
  • Magma
    [13*2^n-1: n in [0..30]]; // Vincenzo Librandi, Oct 28 2011
    
  • Mathematica
    Table[13 2^n - 1, {n, 0, 30}] (* Vincenzo Librandi, Mar 24 2013 *)
    LinearRecurrence[{3,-2},{12,25},40] (* Harvey P. Dale, Feb 06 2019 *)
  • PARI
    a(n) = 13*2^n-1; \\ Michel Marcus, Jan 17 2016

Formula

a(n+1) = 2*a(n) + 1.
G.f.: ( 12-11*x ) / ( (2*x-1)*(x-1) ). - R. J. Mathar, Oct 25 2011

A194693 Number of toothpicks or D-toothpicks added at n-th stage to the D-toothpick "corner" structure of A194692.

Original entry on oeis.org

2, 2, 4, 6, 8, 8, 12, 13, 12, 10, 16, 20, 32, 20, 24, 27, 20, 10, 16, 24, 36, 41, 48, 48, 54, 34, 44, 50, 80, 48, 48, 55, 36, 10, 16, 24, 36, 41, 48, 54, 68, 62, 80, 80, 124, 95, 104, 89, 94, 44, 48, 68
Offset: 1

Views

Author

Omar E. Pol, Sep 03 2011

Keywords

Comments

Sequence related to the D-toothpick "wide" triangle (See A194440 and A194441). First differences of A194692.

Examples

			Written as a triangle:
2,
2,
4,
6,8,
8,12,13,12,
10,16,20,32,20,24,27,20,
10,16,24,36,41,48,48,54,34,44,50,80,48,48,55,36,
10,16,24,36,41,48,54,68,62,80,80,124,95,104,89,94,44,...
		

Crossrefs

Formula

a(n) = A194696(n)/2.
Conjectures for n = 2^k+j, if 0<=j<=3:
a(2^k) = 7*2^(k-2)-1, if k >= 2.
a(2^k+1) = 2^k+4, if k >= 2.
a(2^k+2) = 10, if k >= 3.
a(2^k+3) = 16, if k >= 3.
End conjectures.

A198275 a(n) = 17*2^n - 1.

Original entry on oeis.org

16, 33, 67, 135, 271, 543, 1087, 2175, 4351, 8703, 17407, 34815, 69631, 139263, 278527, 557055, 1114111, 2228223, 4456447, 8912895, 17825791, 35651583, 71303167, 142606335, 285212671, 570425343, 1140850687, 2281701375, 4563402751, 9126805503, 18253611007
Offset: 0

Views

Author

Jeremy Gardiner, Oct 23 2011

Keywords

Examples

			a(2) = 17*2^2-1 = 67.
		

Crossrefs

Programs

  • BASIC
    for j = 0 to 30 : print str$((17*2^j)-1)+", "; : next j
    
  • Magma
    [17*2^n-1: n in [0..30]]; // Vincenzo Librandi, Oct 28 2011
  • Maple
    A198275:=n->17*2^n-1; seq(A198275(n), n=0..30); # Wesley Ivan Hurt, Jun 11 2014
  • Mathematica
    17*2^Range[0,30]-1 (* or *) LinearRecurrence[{3,-2},{16,33},40] (* Harvey P. Dale, Dec 03 2011 *)

Formula

a(n+1) = 2*a(n) + 1.
G.f.: ( 16-15*x ) / ( (2*x-1)*(x-1) ). - R. J. Mathar, Oct 25 2011
a(0)=16, a(1)=33, a(n)=3*a(n-1)-2*a(n-2). - Harvey P. Dale, Dec 03 2011
a(n) + a(n-1)^2 = (a(n-1)+1)^2. - Vincenzo Librandi, Jun 11 2014
Showing 1-10 of 21 results. Next