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

A036992 Numbers not in A036990 nor A036991.

Original entry on oeis.org

6, 9, 14, 17, 22, 25, 26, 28, 30, 33, 35, 37, 38, 41, 46, 49, 54, 57, 58, 60, 62, 65, 67, 69, 70, 73, 78, 81, 86, 89, 90, 92, 94, 97, 99, 101, 102, 105, 106, 108, 110, 113, 114, 116, 118, 120, 121, 122, 124, 126, 129, 131, 133, 134, 135, 137, 139, 141, 142, 145, 147
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Haskell
    a036992 n = a036992_list !! (n-1)
    a036992_list = c a036990_list (tail a036991_list) [0..] where
       c us'@(u:us) vs'@(v:vs) (w:ws)
         | w == u    = c us vs' ws
         | w == v    = c us' vs ws
         | otherwise = w : c us' vs' ws
    -- Reinhard Zumkeller, Jul 31 2013

Formula

a(n) ~ n. [Charles R Greathouse IV, Sep 21 2011]

Extensions

More terms from Erich Friedman.

A367626 First differences of A036991.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Nov 25 2023

Keywords

Comments

Entries are powers of 2 (see A036991 and A367627).

Crossrefs

Programs

  • Python
    from itertools import count, islice
    def A367626_gen(): # generator of terms
        a = 0
        yield 1
        for n in count(1):
            s = bin(n)[2:]
            c, l = 2, len(s)
            for i in range(1,l+1):
                if (c:=c+(2 if s[l-i]=='1' else 0)) <= i:
                    break
            else:
                yield n-a<<1
                a = n
    A367626_list = list(islice(A367626_gen(),30)) # Chai Wah Wu, Nov 28 2023

A367625 (A036991(n)-1)/2.

Original entry on oeis.org

0, 1, 2, 3, 5, 6, 7, 9, 10, 11, 13, 14, 15, 19, 21, 22, 23, 25, 26, 27, 29, 30, 31, 35, 37, 38, 39, 41, 42, 43, 45, 46, 47, 51, 53, 54, 55, 57, 58, 59, 61, 62, 63, 71, 75, 77, 78, 79, 83, 85, 86, 87, 89, 90, 91, 93, 94, 95, 99, 101, 102, 103, 105, 106, 107, 109, 110, 111, 115, 117, 118, 119, 121, 122, 123, 125, 126, 127
Offset: 2

Views

Author

N. J. A. Sloane, Nov 27 2023

Keywords

Crossrefs

Programs

  • Python
    from itertools import count, islice
    def A367625_gen(startvalue=0): # generator of terms >= startvalue
        if startvalue <= 0:
            yield 0
        for n in count(max(startvalue,1)):
            s = bin(n)[2:]
            c, l = 2, len(s)
            for i in range(1,l+1):
                c += int(s[l-i])<<1
                if c <= i:
                    break
            else:
                yield n
    A367625_list = list(islice(A367625_gen(),30)) # Chai Wah Wu, Nov 28 2023

A350577 Prime numbers in A036991.

Original entry on oeis.org

3, 5, 7, 11, 13, 19, 23, 29, 31, 43, 47, 53, 59, 61, 71, 79, 83, 103, 107, 109, 127, 151, 157, 167, 173, 179, 181, 191, 199, 211, 223, 239, 251, 271, 283, 307, 311, 317, 331, 347, 349, 359, 367, 373, 379, 383, 431, 439, 443, 461, 463, 467, 479, 487, 491, 499
Offset: 1

Views

Author

Gennady Eremin, Jan 07 2022

Keywords

Comments

This sequence includes A000668.
Conjecture: The sequence is infinite. For example, in the first million primes (see A000040) 304208 numbers are terms of A036991.

Crossrefs

Programs

  • 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(isprime and q, [$2..500])[];  # Alois P. Heinz, Jan 07 2022
  • Mathematica
    q[n_] := PrimeQ[n] && AllTrue[Accumulate[(-1)^Reverse[IntegerDigits[n, 2]]], # <= 0 &]; Select[Range[500], q] (* Amiram Eldar, Jan 07 2022 *)
  • Python
    from sympy import isprime
    def ok(n):
        if n == 0: return True
        count = {"0": 0, "1": 0}
        for bit in bin(n)[:1:-1]:
            count[bit] += 1
            if count["0"] > count["1"]: return False
        return isprime(n)
    print([k for k in range(3, 500, 2) if ok(k)]) # Michael S. Branicky, Jan 07 2022

Formula

Intersection of A000040 and A036991.

A002054 Binomial coefficient C(2n+1, n-1).

Original entry on oeis.org

1, 5, 21, 84, 330, 1287, 5005, 19448, 75582, 293930, 1144066, 4457400, 17383860, 67863915, 265182525, 1037158320, 4059928950, 15905368710, 62359143990, 244662670200, 960566918220, 3773655750150, 14833897694226, 58343356817424, 229591913401900
Offset: 1

Views

Author

Keywords

Comments

a(n) = number of permutations in S_{n+2} containing exactly one 312 pattern. E.g., S_3 has a_1 = 1 permutations containing exactly one 312 pattern, and S_4 has a_2 = 5 permutations containing exactly one 312 pattern, namely 1423, 2413, 3124, 3142, and 4231. This comment is also true if 312 is replaced by any of 132, 213, or 231 (but not 123 or 321, for which see A003517). [Comment revised by N. J. A. Sloane, Nov 26 2022]
Number of valleys in all Dyck paths of semilength n+1. Example: a(2)=5 because UD*UD*UD, UD*UUDD, UUDD*UD, UUD*UDD, UUUDDD, where U=(1,1), D=(1,-1) and the valleys are shown by *. - Emeric Deutsch, Dec 05 2003
Number of UU's (double rises) in all Dyck paths of semilength n+1. Example: a(2)=5 because UDUDUD, UDU*UDD, U*UDDUD, U*UDUDD, U*U*UDDD, the double rises being shown by *. - Emeric Deutsch, Dec 05 2003
Number of peaks at level higher than one (high peaks) in all Dyck paths of semilength n+1. Example: a(2)=5 because UDUDUD, UDUU*DD, UU*DDUD, UU*DU*DD, UUU*DDD, the high peaks being shown by *. - Emeric Deutsch, Dec 05 2003
Number of diagonal dissections of a convex (n+3)-gon into n regions. Number of standard tableaux of shape (n,n,1) (see Stanley reference). - Emeric Deutsch, May 20 2004
Number of dissections of a convex (n+3)-gon by noncrossing diagonals into several regions, exactly n-1 of which are triangular. Example: a(2)=5 because the convex pentagon ABCDE is dissected by any of the diagonals AC, BD, CE, DA, EB into regions containing exactly 1 triangle. - Emeric Deutsch, May 31 2004
Number of jumps in all full binary trees with n+1 internal nodes. In the preorder traversal of a full binary tree, any transition from a node at a deeper level to a node on a strictly higher level is called a jump. - Emeric Deutsch, Jan 18 2007
a(n) is the total number of nonempty Dyck subpaths in all Dyck paths (A000108) of semilength n. For example, the Dyck path UUDUUDDD has Dyck subpaths stretching over positions 1-8 (the entire path), 2-3, 2-7, 4-7, 5-6 and so contributes 5 to a(4). - David Callan, Jul 25 2008
a(n+1) is the total number of ascents in the set of all n-permutations avoiding the pattern 132. For example, a(2) = 5 because there are 5 ascents in the set 123, 213, 231, 312, 321. - Cheyne Homberger, Oct 25 2013
Number of increasing tableaux of shape (n+1,n+1) with largest entry 2n+1. An increasing tableau is a semistandard tableau with strictly increasing rows and columns, and set of entries an initial segment of the positive integers. Example: a(2) = 5 counts the five tableaux (124)(235), (123)(245), (124)(345), (134)(245), (123)(245). - Oliver Pechenik, May 02 2014
a(n) is the number of noncrossing partitions of 2n+1 into n-1 blocks of size 2 and 1 block of size 3. - Oliver Pechenik, May 02 2014
Number of paths in the half-plane x>=0, from (0,0) to (2n+1,3), and consisting of steps U=(1,1) and D=(1,-1). For example, for n=2, we have the 5 paths: UUUUD, UUUDU, UUDUU, UDUUU, DUUUU. - José Luis Ramírez Ramírez, Apr 19 2015
From Gus Wiseman, Aug 20 2021: (Start)
Also the number of binary numbers with 2n+2 digits and with two more 0's than 1's. For example, the a(2) = 5 binary numbers are: 100001, 100010, 100100, 101000, 110000, with decimal values 33, 34, 36, 40, 48. Allowing first digit 0 gives A001791, ranked by A345910/A345912.
Also the number of integer compositions of 2n+2 with alternating sum -2, where the alternating sum of a sequence (y_1,...,y_k) is Sum_i (-1)^(i-1) y_i. For example, the a(3) = 21 compositions are:
(35) (152) (1124) (11141) (111113)
(251) (1223) (12131) (111212)
(1322) (13121) (111311)
(1421) (14111) (121112)
(2114) (121211)
(2213) (131111)
(2312)
(2411)
The following pertain to these compositions:
- The unordered version is A344741.
- Ranked by A345924 (reverse: A345923).
- A345197 counts compositions by length and alternating sum.
- A345925 ranks compositions with alternating sum 2 (reverse: A345922).
(End)

Examples

			G.f. = x + 5*x^2 + 21*x^3 + 84*x^4 + 330*x^5 + 1287*x^6 + 5005*x^7 + ...
		

References

  • M. Abramowitz and I. A. Stegun, eds., Handbook of Mathematical Functions, National Bureau of Standards Applied Math. Series 55, 1964 (and various reprintings), p. 828.
  • George Grätzer, General Lattice Theory. Birkhauser, Basel, 1998, 2nd edition, p. 474, line -3.
  • A. P. Prudnikov, Yu. A. Brychkov and O.I. Marichev, "Integrals and Series", Volume 1: "Elementary Functions", Chapter 4: "Finite Sums", New York, Gordon and Breach Science Publishers, 1986-1992.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Diagonal 4 of triangle A100257. Also a diagonal of A033282.
Equals (1/2) A024483(n+2). Bisection of A037951 and A037955.
Cf. A001263.
Column k=1 of A263771.
Counts terms of A031445 with 2n+2 digits in binary.
Cf. binomial(2*n+m, n): A000984 (m = 0), A001700 (m = 1), A001791 (m = 2), A002694 (m = 4), A003516 (m = 5), A002696 (m = 6), A030053 - A030056, A004310 - A004318.

Programs

  • GAP
    List([1..25],n->Binomial(2*n+1,n-1)); # Muniru A Asiru, Aug 09 2018
    
  • Magma
    [Binomial(2*n+1, n-1): n in [1..30]]; // Vincenzo Librandi, Apr 20 2015
    
  • Maple
    with(combstruct): seq((count(Composition(2*n+2), size=n)), n=1..24); # Zerinvary Lajos, May 03 2007
  • Mathematica
    CoefficientList[Series[8/(((Sqrt[1-4x] +1)^3)*Sqrt[1-4x]), {x,0,22}], x] (* Robert G. Wilson v, Aug 08 2011 *)
    a[ n_]:= Binomial[2 n + 1, n - 1]; (* Michael Somos, Apr 25 2014 *)
  • PARI
    {a(n) = binomial( 2*n+1, n-1)};
    
  • Python
    from _future_ import division
    A002054_list, b = [], 1
    for n in range(1,10**3):
        A002054_list.append(b)
        b = b*(2*n+2)*(2*n+3)//(n*(n+3)) # Chai Wah Wu, Jan 26 2016
    
  • Sage
    [binomial(2*n+1, n-1) for n in (1..25)] # G. C. Greubel, Mar 22 2019

Formula

a(n) = Sum_{j=0..n-1} binomial(2*j, j) * binomial(2*n - 2*j, n-j-1)/(j+1). - Yong Kong (ykong(AT)curagen.com), Dec 26 2000
G.f.: z*C^4/(2-C), where C=[1-sqrt(1-4z)]/(2z) is the Catalan function. - Emeric Deutsch, Jul 05 2003
From Wolfdieter Lang, Jan 09 2004: (Start)
a(n) = binomial(2*n+1, n-1) = n*C(n+1)/2, C(n)=A000108(n) (Catalan).
G.f.: (1 - 2*x - (1-3*x)*c(x))/(x*(1-4*x)) with g.f. c(x) of A000108. (End)
G.f.: z*C(z)^3/(1-2*z*C(z)), where C(z) is the g.f. of Catalan numbers. - José Luis Ramírez Ramírez, Apr 19 2015
G.f.: 2F1(5/2, 2; 4; 4*x). - R. J. Mathar, Aug 09 2015
D-finite with recurrence: a(n+1) = a(n)*(2*n+3)*(2*n+2)/(n*(n+3)). - Chai Wah Wu, Jan 26 2016
From Ilya Gutkovskiy, Aug 30 2016: (Start)
E.g.f.: (BesselI(0,2*x) + (1 - 1/x)*BesselI(1,2*x))*exp(2*x).
a(n) ~ 2^(2*n+1)/sqrt(Pi*n). (End)
a(n) = (1/(n+1))*Sum_{i=0..n-1} (n+1-i)*binomial(2n+2,i), n >= 1. - Taras Goy, Aug 09 2018
G.f.: (x - 1 + (1 - 3*x)/sqrt(1 - 4*x))/(2*x^2). - Michael Somos, Jul 28 2021
From Amiram Eldar, Jan 24 2022: (Start)
Sum_{n>=1} 1/a(n) = 5/3 - 2*Pi/(9*sqrt(3)).
Sum_{n>=1} (-1)^(n+1)/a(n) = 52*log(phi)/(5*sqrt(5)) - 7/5, where phi is the golden ratio (A001622). (End)
a(n) = A001405(2*n+1) - A000108(n+1), n >= 1 (from Eremin link, page 7). - Gennady Eremin, Sep 05 2023
G.f.: x/(1 - 4*x)^2 * c(-x/(1 - 4*x))^3, where c(x) = (1 - sqrt(1 - 4*x))/(2*x) is the g.f. of the Catalan numbers A000108. - Peter Bala, Feb 03 2024
From Peter Bala, Oct 13 2024: (Start)
a(n) = Integral_{x = 0..4} x^n * w(x) dx, where the weight function w(x) = 1/(2*Pi) * sqrt(x)*(x - 3)/sqrt(4 - x) (see Penson).
G.f. x*/sqrt(1 - 4*x) * c(x)^3. (End)

A052940 a(0) = 1; a(n) = 3*2^n - 1, for n > 0.

Original entry on oeis.org

1, 5, 11, 23, 47, 95, 191, 383, 767, 1535, 3071, 6143, 12287, 24575, 49151, 98303, 196607, 393215, 786431, 1572863, 3145727, 6291455, 12582911, 25165823, 50331647, 100663295, 201326591, 402653183, 805306367, 1610612735, 3221225471, 6442450943, 12884901887
Offset: 0

Views

Author

encyclopedia(AT)pommard.inria.fr, Jan 25 2000

Keywords

Comments

A simple regular expression.
Numbers k > 1 such that a(k-1)^2 + a(k) is square, e.g., 5^2 + 11 = 6^2; 11^2 + 23 = 12^2. - Vincenzo Librandi, Aug 06 2010
Numerator of the sum of terms at the n-th level of the Calkin-Wilf tree. - Carl Najafi, Jul 10 2011

Crossrefs

Apart from initial terms, same as A055010 and A083329.
Subsequence of A036991.

Programs

  • GAP
    Concatenation([1], List([1..30], n-> 3*2^n -1)); # G. C. Greubel, Oct 18 2019
    
  • Magma
    [1] cat [3*2^n - 1: n in [1..30]]; // Vincenzo Librandi, Dec 01 2015
    
  • Maple
    spec:= [S,{S=Prod(Sequence(Union(Z,Z)),Union(Sequence(Z),Z,Z))},unlabeled ]: seq(combstruct[count ](spec,size=n), n=0..20);
    seq(`if`(n=0,1,3*2^n -1), n=0..30); # G. C. Greubel, Oct 18 2019
  • Mathematica
    Join[{1},Table[3*2^n-1,{n,30}]] (* or *) Join[{1},LinearRecurrence[{3,-2},{5,11},30]] (* Harvey P. Dale, Mar 07 2015 *)
  • PARI
    a(n)=if(n,3*2^n-1,1) \\ Charles R Greathouse IV, Oct 07 2015
    
  • PARI
    Vec((1+2*x-2*x^2)/(-1+2*x)/(-1+x) + O(x^30)) \\ Altug Alkan, Dec 01 2015
    
  • Python
    print([1] + [(3<Gennady Eremin, Aug 29 2023
  • Sage
    [1]+[3*2^n -1 for n in (1..30)] # G. C. Greubel, Oct 18 2019
    

Formula

G.f.: (1+2*x-2*x^2)/((1-x)*(1-2*x)).
a(n) = 3*a(n-1) - 2*a(n-2) for n > 2.
Binomial transform of 3 - 0^n - (-1)^n = (1, 4, 2, 4, 2, 4, 2, ...). - Paul Barry, Jun 30 2003
a(n) = A107909(A023548(n+1)) for n > 1. - Reinhard Zumkeller, May 28 2005
Row sums of triangle A134060. - Gary W. Adamson, Oct 05 2007
Equals row sums of triangle A140182. - Gary W. Adamson, May 11 2008
Equals M*Q, where M is a modified Pascal triangle (1,2) with first term "1" instead of 2; as an infinite lower triangular matrix. Q is the vector (1, 2, 2, 2, ...). - Gary W. Adamson, Nov 30 2015
From Gennady Eremin, Aug 29 2023: (Start)
a(n+1) = 2*a(n) + 1 for n > 0.
a(n) = (A000225(n+1) + A000225(n+2))/2 for n > 0. (End)

Extensions

More terms from James Sellers, Jun 08 2000
a(30)-a(32) from Vincenzo Librandi, Dec 01 2015

A036990 Numbers n such that, in the binary expansion of n, reading from right to left, the number of 1's never exceeds the number of 0's.

Original entry on oeis.org

0, 2, 4, 8, 10, 12, 16, 18, 20, 24, 32, 34, 36, 40, 42, 44, 48, 50, 52, 56, 64, 66, 68, 72, 74, 76, 80, 82, 84, 88, 96, 98, 100, 104, 112, 128, 130, 132, 136, 138, 140, 144, 146, 148, 152, 160, 162, 164, 168, 170, 172, 176, 178, 180, 184, 192, 194, 196, 200, 202, 204
Offset: 1

Views

Author

Keywords

Comments

A036989(a(n)) = 1. - Reinhard Zumkeller, Jul 31 2013

Crossrefs

Each term is 2^n * some term of A014486 (n >= 0).
Cf. A030308.

Programs

  • Haskell
    a036990 n = a036990_list !! (n-1)
    a036990_list = filter ((== 1) . a036989) [0..]
    -- Reinhard Zumkeller, Jul 31 2013
  • Mathematica
    fQ[n_] := Block[{od = ev = k = 0, id = Reverse@IntegerDigits[n, 2], lmt = Floor@Log[2, n] + 1}, While[k < lmt && od < ev + 1, If[OddQ@id[[k + 1]], od++, ev++ ]; k++ ]; If[k == lmt && od < ev + 1, True, False]]; Select[ Range[0, 204, 2], fQ@# &] (* Robert G. Wilson v, Jan 11 2007 *)
    (* b = A036989 *) b[0] = 1; b[n_?EvenQ] := b[n] = Max[b[n/2]-1, 1]; b[n_] := b[n] = b[(n-1)/2]+1; Select[Range[0, 300, 2], b[#] == 1 &] (* Jean-François Alcover, Nov 05 2013, after Reinhard Zumkeller *)

Formula

Extensions

More terms from Erich Friedman.

A061854 Nondiving binary sequences: numbers which in base 2 have at least the same number of 1's as 0's and reading the binary expansion from left (msb) to right (least significant bit), the number of 0's never exceeds the number of 1's.

Original entry on oeis.org

1, 2, 3, 5, 6, 7, 10, 11, 12, 13, 14, 15, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 42, 43, 44, 45, 46, 47, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 85, 86, 87, 89, 90, 91, 92, 93, 94, 95, 101, 102, 103, 105, 106, 107, 108, 109, 110, 111, 113, 114, 115, 116
Offset: 1

Views

Author

Antti Karttunen, May 11 2001

Keywords

Comments

"msb" = "most significant bit", A053644.
These encode lattice walks using steps (+1,+1) (= 1's in binary expansion) and (+1,-1) (= 0's in binary expansion) that start from the origin (0,0) and never "dive" under the "sea-level" y=0.
The number of such walks of length n (here: the terms of binary width n) is given by C(n,floor(n/2)) = A001405, which is based on the fact mentioned in Guy's article that the shallow diagonals of the Catalan triangle A009766 sum to A001405.
From Jason Kimberley, Feb 08 2013: (Start)
This sequence is a subsequence of A072601.
Define a map from this set onto the nonnegative integers as follows: set the output bit string to be empty, representing zero; process the input string from left to right; when 1 occurs, change the rightmost 0 in the output to 1; if there is no 0 in the output, prepend a 1; when 0 occurs in the input, change the rightmost 1 in the output to 1. The definition of this sequence ensures that we always have a 1 in the output when a 0 occurs in the input. We this map is onto by showing the restriction to the subset Asubsequence is onto. (End)
The binary representation of a(n) is the numeric representation of the left half of a symmetric balanced string of parentheses with "(" representing 1 and ")" representing 0 (see comments and examples in A001405). Some of the numbers in this sequence cannot be realized as the 1-0-pattern of the odd/even positions of 1's in any row n of A237048 that determines the parts and their widths in the symmetric representation of sigma(n), see A352696. - Hartmut F. W. Hoft, Mar 29 2022

Examples

			From _Hartmut F. W. Hoft_, Mar 29 2022: (Start)
The columns in the table are the numbers n, the base-2 representation of n, the left half of the symmetric balanced string of parentheses corresponding to n, validity of the nondiving property for n, and associated number a(n):
1   1      (      True    a(1)
2   10     ()     True    a(2)
3   11     ((     True    a(3)
4   100    ())    False    -
5   101    ()(    True    a(4)
6   110    (()    True    a(5)
7   111    (((    True    a(6)
8   1000   ()))   False    -
9   1001   ())(   False    -
10  1010   ()()   True    a(7)
...
20  10100  ()())  False    -
21  10101  ()()(  True    a(13)
...
(End)
		

Crossrefs

Programs

  • Maple
    # We use a simple backtracking algorithm: map(op,[seq(NonDivingLatticeSequences(j),j=1..10)]);
    NDLS_GLOBAL := []; NonDivingLatticeSequences := proc(n) global NDLS_GLOBAL; NDLS_GLOBAL := []; NonDivingLatticeSequencesAux(0,0,n); RETURN(NDLS_GLOBAL); end;
    NonDivingLatticeSequencesAux := proc(x,h,i) global NDLS_GLOBAL; if(0 = i) then NDLS_GLOBAL := [op(NDLS_GLOBAL),x]; else if(h > 0) then NonDivingLatticeSequencesAux((2*x),h-1,i-1); fi; NonDivingLatticeSequencesAux((2*x)+1,h+1,i-1); fi; end;
  • Mathematica
    a061854[n_] := Select[Range[n], !MemberQ[FoldList[#1+If[#2>0, 1, -1]&, 0, IntegerDigits[n, 2]], -1]]
    a061854[116] (* Hartmut F. W. Hoft, Mar 29 2022 *)
    Select[Range[120],Min[Accumulate[IntegerDigits[#,2]/.(0->-1)]]>=0&] (* Harvey P. Dale, Sep 11 2023 *)

A367627 a(n) = log_2(A367626(n)).

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Nov 25 2023

Keywords

Comments

First differences of A036991 are powers of 2 (see A036991 and A367626).

Crossrefs

Programs

  • Python
    from itertools import count, islice
    def A367627_gen(): # generator of terms
        a = 0
        yield 0
        for n in count(1):
            s = bin(n)[2:]
            c, l = 2, len(s)
            for i in range(1,l+1):
                if (c:=c+(2 if s[l-i]=='1' else 0)) <= i:
                    break
            else:
                yield (n-a).bit_length()
                a = n
    A367627_list = list(islice(A367627_gen(),30)) # Chai Wah Wu, Nov 28 2023

A036993 Numbers n with property that reading from right to left in the binary expansion of n, the number of 0's always stays ahead of the number of 1's.

Original entry on oeis.org

0, 4, 8, 16, 20, 24, 32, 36, 40, 48, 64, 68, 72, 80, 84, 88, 96, 100, 104, 112, 128, 132, 136, 144, 148, 152, 160, 164, 168, 176, 192, 196, 200, 208, 224, 256, 260, 264, 272, 276, 280, 288, 292, 296, 304, 320, 324, 328, 336, 340, 344, 352, 356, 360, 368, 384
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Haskell
    a036993 n = a036993_list !! (n-1)
    a036993_list = filter ((p 0) . a030308_row) [0..] where
       p _     []     = True
       p zeros (0:bs) = p (zeros + 1) bs
       p zeros (1:bs) = zeros > 1 && p (zeros - 1) bs
    -- Reinhard Zumkeller, Jul 31 2013
  • Mathematica
    Select[Range[0,400],Min[Accumulate[Reverse[IntegerDigits[#,2]]/.{0->1, 1->-1}]]>0&] (* Harvey P. Dale, Aug 25 2013 *)

Extensions

More terms from Erich Friedman
Showing 1-10 of 14 results. Next