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

A000975 a(2n) = 2*a(2n-1), a(2n+1) = 2*a(2n)+1 (also a(n) is the n-th number without consecutive equal binary digits).

Original entry on oeis.org

0, 1, 2, 5, 10, 21, 42, 85, 170, 341, 682, 1365, 2730, 5461, 10922, 21845, 43690, 87381, 174762, 349525, 699050, 1398101, 2796202, 5592405, 11184810, 22369621, 44739242, 89478485, 178956970, 357913941, 715827882, 1431655765, 2863311530, 5726623061, 11453246122
Offset: 0

Views

Author

Keywords

Comments

Might be called the "Lichtenberg sequence" after Georg Christoph Lichtenberg, who discussed it in 1769 in connection with the Chinese Rings puzzle (baguenaudier). - Andreas M. Hinz, Feb 15 2017
Number of steps to change from a binary string of n 0's to n 1's using a Gray code. - Jon Stadler (jstadler(AT)coastal.edu)
Popular puzzles such as Spin-Out and The Brain Puzzler are based on the Gray binary system and require a(n) steps to complete for some number n.
Conjecture: {a(n)} also gives all j for which A048702(j) = A000217(j); i.e., if we take the a(n)-th triangular number (a(n)^2 + a(n))/2 and multiply it by 3, we get a(n)-th even-length binary palindrome A048701(a(n)) concatenated from a(n) and its reverse. E.g., a(4) = 10, which is 1010 in binary; the tenth triangular number is 55, and 55*3 = 165 = 10100101 in binary. - Antti Karttunen, circa 1999. (This has been now proved by Paul K. Stockmeyer in his arXiv:1608.08245 paper.) - Antti Karttunen, Aug 31 2016
Number of ways to tie a tie of n or fewer half turns, excluding mirror images. Also number of walks of length n or less on a triangular lattice with the following restrictions; given l, r and c as the lattice axes. 1. All steps are taken in the positive axis direction. 2. No two consecutive steps are taken on the same axis. 3. All walks begin with l. 4. All walks end with rlc or lrc. - Bill Blewett, Dec 21 2000
a(n) is the minimal number of vertices to be selected in a vertex-cover of the balanced tree B_n. - Sen-peng Eu, Jun 15 2002
A087117(a(n)) = A038374(a(n)) = 1 for n > 1; see also A090050. - Reinhard Zumkeller, Nov 20 2003
Intersection of A003754 and A003714; complement of A107907. - Reinhard Zumkeller, May 28 2005
Equivalently, numbers m whose binary representation is effectively, for some number k, both the lazy Fibonacci and the Zeckendorf representation of k (in which case k = A022290(m)). - Peter Munn, Oct 06 2022
a(n+1) gives row sums of Riordan array (1/(1-x), x(1+2x)). - Paul Barry, Jul 18 2005
Total number of initial 01's in all binary words of length n+1. Example: a(3) = 5 because the binary words of length 4 that start with 01 are (01)00, (01)(01), (01)10 and (01)11 and the total number of initial 01's is 5 (shown between parentheses). a(n) = Sum_{k >= 0} k*A119440(n+1, k). - Emeric Deutsch, May 19 2006
In Norway we call the 10-ring puzzle "strikketoy" or "knitwear" (see link). It takes 682 moves to free the two parts. - Hans Isdahl, Jan 07 2008
Equals A002450 and A020988 interlaced. - Zak Seidov, Feb 10 2008
For n > 1, let B_n = the complete binary tree with vertex set V where |V| = 2^n - 1. If VC is a minimum-size vertex cover of B_n, Sen-Peng Eu points out that a(n) = |VC|. It also follows that if IS = V\VC, a(n+1) = |IS|. - K.V.Iyer, Apr 13 2009
Starting with 1 and convolved with [1, 2, 2, 2, ...] = A000295. - Gary W. Adamson, Jun 02 2009
a(n) written in base 2 is sequence A056830(n). - Jaroslav Krizek, Aug 05 2009
This is the sequence A(0, 1; 1, 2; 1) of the family of sequences [a,b:c,d:k] considered by G. Detlefs, and treated as A(a,b;c,d;k) in the W. Lang link given below. - Wolfdieter Lang, Oct 18 2010
From Vladimir Shevelev, Jan 30 2012, Feb 13 2012: (Start)
1) Denote by {n, k} the number of permutations of 1, ..., n with the up-down index k (for definition, see comment in A203827). Then max_k{n, k} = {n, a(n)} = A000111(n).
2) a(n) is the minimal number > a(n-1) with the Hamming distance d_H(a(n-1), a(n)) = n. Thus this sequence is the Hamming analog of triangular numbers 0, 1, 3, 6, 10, ... (End)
From Hieronymus Fischer, Nov 22 2012: (Start)
Represented in binary form each term after the second one contains every previous term as a substring.
The terms a(2) = 2 and a(3) = 5 are the only primes. Proof: For even n we get a(n) = 2*(2^(2*n) - 1)/3, which shows that a(n) is even, too, and obviously a(n) > 2 for all even n > 2. For odd n we have a(n) = (2^(n+1) - 1)/3 = (2^((n+1)/2) - 1) * (2^((n+1)/2) + 1)/3. Evidently, at least one of these factors is divisible by 3, both are greater than 6, provided n > 3. Hence it follows that a(n) is composite for all odd n > 3.
Represented as a binary number, a(n+1) has exactly n prime substrings. Proof: Evidently, a(1) = 1_2 has zero and a(2) = 10_2 has 1 prime substring. Let n > 1. Written in binary, a(n+1) is 101010101...01 (if n + 1 is odd) and is 101010101...10 (if n + 1 is even) with n + 1 digits. Only the 2- and 3-digits substrings 10_2 (=2) and 101_2 (=5) are prime substrings. All the other substrings are nonprime since every substring is a previous term and all terms unequal to 2 and 5 are nonprime. For even n + 1, the number of prime substrings equal to 2 = 10_2 is (n+1)/2, and the number of prime substrings equal to 5 = 101_2 is (n-1)/2, makes a sum of n. For odd n + 1 we get n/2 for both, the number of 2's and 5's prime substrings, in any case, the sum is n. (End)
Number of different 3-colorings for the vertices of all triangulated planar polygons on a base with n+2 vertices if the colors of the two base vertices are fixed. - Patrick Labarque, Feb 09 2013
A090079(a(n)) = a(n) and A090079(m) <> a(n) for m < a(n). - Reinhard Zumkeller, Feb 16 2013
a(n) is the number of length n binary words containing at least one 1 and ending in an even number (possibly zero) of 0's. a(3) = 5 because we have: 001, 011, 100, 101, 111. - Geoffrey Critzer, Dec 15 2013
a(n) is the number of permutations of length n+1 having exactly one descent such that the first element of the permutation is an even number. - Ran Pan, Apr 18 2015
a(n) is the sequence of the last row of the Hadamard matrix H(2^n) obtained via Sylvester's construction: H(2) = [1,1;1,-1], H(2^n) = H(2^(n-1))*H(2), where * is the Kronecker product. - William P. Orrick, Jun 28 2015
Conjectured record values of A264784: a(n) = A264784(A155051(n-1)). - Reinhard Zumkeller, Dec 04 2015. (This is proved by Paul K. Stockmeyer in his arXiv:1608.08245 paper.) - Antti Karttunen, Aug 31 2016
Decimal representation of the x-axis, from the origin to the right edge, of the n-th stage of growth of the two-dimensional cellular automaton defined by "Rule 131", based on the 5-celled von Neumann neighborhood. See A279053 for references and links. - Robert Price, Dec 05 2016
For n > 4, a(n-2) is the second-largest number in row n of A127824. - Dmitry Kamenetsky, Feb 11 2017
Conjecture: a(n+1) is the number of compositions of n with two kinds of parts, n and n', where the order of the 1 and 1' does not matter. For n=2, a(3) = 5 compositions, enumerated as follows: 2; 2'; 1,1; 1',1 = 1',1; 1',1'. - Gregory L. Simay, Sep 02 2017
Conjecture proved by recognizing the appropriate g.f. is x/(1 - x)(1 - x)(1 - 2*x^2 - 2x^3 - ...) = x/(1 - 2*x - x^2 + 2x^3). - Gregory L. Simay, Sep 10 2017
a(n) = 2^(n-1) + 2^(n-3) + 2^(n-5) + ... a(2*k -1) = A002450(k) is the sum of the powers of 4. a(2*k) = 2*A002450(k). - Gregory L. Simay, Sep 27 2017
a(2*n) = n times the string [10] in binary representation, a(2*n+1) = n times the string [10] followed with [1] in binary representation. Example: a(7) = 85 = (1010101) in binary, a(8) = 170 = (10101010) in binary. - Ctibor O. Zizka, Nov 06 2018
Except for 0, these are the positive integers whose binary expansion has cuts-resistance 1. For the operation of shortening all runs by 1, cuts-resistance is the number of applications required to reach an empty word. Cuts-resistance 2 is A329862. - Gus Wiseman, Nov 27 2019
From Markus Sigg, Sep 14 2020: (Start)
Let s(k) be the length of the Collatz orbit of k, e.g. s(1) = 1, s(2) = 2, s(3) = 5. Then s(a(n)) = n+3 for n >= 3. Proof by induction: s(a(3)) = s(5) = 6 = 3+3. For odd n >= 5 we have s(a(n)) = s(4*a(n-2)+1) = s(12*a(n-2)+4)+1 = s(3*a(n-2)+1)+3 = s(a(n-2))+2 = (n-2)+3+2 = n+3, and for even n >= 4 this gives s(a(n)) = s(2*a(n-1)) = s(a(n-1))+1 = (n-1)+3+1 = n+3.
Conjecture: For n >= 3, a(n) is the second largest natural number whose Collatz orbit has length n+3. (End)
From Gary W. Adamson, May 14 2021: (Start)
With offset 1 the sequence equals the numbers of 1's from n = 1 to 3, 3 to 7, 7 to 15, ...; of A035263; as shown below:
..1 3 7 15...
..1 0 1 1 1 0 1 0 1 0 1 1 1 0 1...
..1.....2...........5......................10...; a(n) = Sum_(k=1..2n-1)A035263(k)
.....1...........2.......................5...; as to zeros.
..1's in the Tower of Hanoi game represent CW moves On disks in the pattern:
..0, 1, 2, 0, 1, 2, ... whereas even numbered disks move in the pattern:
..0, 2, 1, 0, 2, 1, ... (End)
Except for 0, numbers that are repunits in Gray-code representation (A014550). - Amiram Eldar, May 21 2021
From Gus Wiseman, Apr 20 2023: (Start)
Also the number of nonempty subsets of {1..n} with integer median, where the median of a multiset is the middle part in the odd-length case, and the average of the two middle parts in the even-length case. For example, the a(1) = 1 through a(4) = 10 subsets are:
{1} {1} {1} {1}
{2} {2} {2}
{3} {3}
{1,3} {4}
{1,2,3} {1,3}
{2,4}
{1,2,3}
{1,2,4}
{1,3,4}
{2,3,4}
The complement is counted by A005578.
For mean instead of median we have A051293, counting empty sets A327475.
For normal multisets we have A056450, strongly normal A361202.
For partitions we have A325347, strict A359907, complement A307683.
(End)

Examples

			a(4)=10 since 0001, 0011, 0010, 0110, 0111, 0101, 0100, 1100, 1101, 1111 are the 10 binary strings switching 0000 to 1111.
a(3) = 1 because "lrc" is the only way to tie a tie with 3 half turns, namely, pass the business end of the tie behind the standing part to the left, bring across the front to the right, then behind to the center. The final motion of tucking the loose end down the front behind the "lr" piece is not considered a "step".
a(4) = 2 because "lrlc" is the only way to tie a tie with 4 half turns. Note that since the number of moves is even, the first step is to go to the left in front of the tie, not behind it. This knot is the standard "four in hand", the most commonly known men's tie knot. By contrast, the second most well known tie knot, the Windsor, is represented by "lcrlcrlc".
a(n) = (2^0 - 1) XOR (2^1 - 1) XOR (2^2 - 1) XOR (2^3 - 1) XOR ... XOR (2^n - 1). - _Paul D. Hanna_, Nov 05 2011
G.f. = x + 2*x^2 + 5*x^3 + 10*x^4 + 21*x^5 + 42*x^6 + 85*x^7 + 170*x^8 + ...
a(9) = 341 = 2^8 + 2^6 + 2^4 + 2^2 + 2^0 = 4^4 + 4^3 + 4^2 + 4^1 + 4^0 = A002450(5). a(10) = 682 = 2*a(9) = 2*A002450(5). - _Gregory L. Simay_, Sep 27 2017
		

References

  • Thomas Fink and Yong Mao, The 85 Ways to Tie a Tie, Broadway Books, New York (1999), p. 138.
  • Clifford A. Pickover, The Math Book, From Pythagoras to the 57th Dimension, 250 Milestones in the History of Mathematics, Sterling Publ., NY, 2009.

Crossrefs

Partial sums of A001045.
Row sums of triangle A013580.
Equals A026644/2.
Union of the bijections A002450 and A020988. - Robert G. Wilson v, Jun 09 2014
Column k=3 of A261139.
Complement of A107907.
Row 3 of A300653.
Other sequences that relate to the binary representation of the terms: A003714, A003754, A007088, A022290, A056830, A104161, A107909.

Programs

  • GAP
    List([0..35],n->(2^(n+1)-2+(n mod 2))/3); # Muniru A Asiru, Nov 01 2018
    
  • Haskell
    a000975 n = a000975_list !! n
    a000975_list = 0 : 1 : map (+ 1)
       (zipWith (+) (tail a000975_list) (map (* 2) a000975_list))
    -- Reinhard Zumkeller, Mar 07 2012
    
  • Magma
    [(2^(n+1) - 2 + (n mod 2))/3: n in [0..40]]; // Vincenzo Librandi, Mar 18 2015
    
  • Maple
    A000975 := proc(n) option remember; if n <= 1 then n else if n mod 2 = 0 then 2*A000975(n-1) else 2*A000975(n-1)+1 fi; fi; end;
    seq(iquo(2^n,3),n=1..33); # Zerinvary Lajos, Apr 20 2008
    f:=n-> if n mod 2 = 0 then (2^n-1)/3 else (2^n-2)/3; fi; [seq(f(n),n=0..40)]; # N. J. A. Sloane, Mar 21 2017
  • Mathematica
    Array[Ceiling[2(2^# - 1)/3] &, 41, 0]
    RecurrenceTable[{a[0] == 0, a[1] == 1, a[n] == a[n - 1] + 2a[n - 2] + 1}, a, {n, 40}] (* or *)
    LinearRecurrence[{2, 1, -2}, {0, 1, 2}, 40] (* Harvey P. Dale, Aug 10 2013 *)
    f[n_] := Block[{exp = n - 2}, Sum[2^i, {i, exp, 0, -2}]]; Array[f, 33] (* Robert G. Wilson v, Oct 30 2015 *)
    f[s_List] := Block[{a = s[[-1]]}, Append[s, If[OddQ@ Length@ s, 2a + 1, 2a]]]; Nest[f, {0}, 32] (* Robert G. Wilson v, Jul 20 2017 *)
    NestList[2# + Boole[EvenQ[#]] &, 0, 39] (* Alonso del Arte, Sep 21 2018 *)
  • PARI
    {a(n) = if( n<0, 0, 2 * 2^n \ 3)}; /* Michael Somos, Sep 04 2006 */
    
  • PARI
    a(n)=if(n<=0,0,bitxor(a(n-1),2^n-1)) \\ Paul D. Hanna, Nov 05 2011
    
  • PARI
    concat(0, Vec(x/(1-2*x-x^2+2*x^3) + O(x^100))) \\ Altug Alkan, Oct 30 2015
    
  • PARI
    {a(n) = (4*2^n - 3 - (-1)^n) / 6}; /* Michael Somos, Jul 23 2017 */
    
  • Python
    def a(n): return (2**(n+1) - 2 + (n%2))//3
    print([a(n) for n in range(35)]) # Michael S. Branicky, Dec 19 2021

Formula

a(n) = ceiling(2*(2^n-1)/3).
Alternating sum transform (PSumSIGN) of {2^n - 1} (A000225).
a(n) = a(n-1) + 2*a(n-2) + 1.
a(n) = 2*2^n/3 - 1/2 - (-1)^n/6.
a(n) = Sum_{i = 0..n} A001045(i), partial sums of A001045. - Bill Blewett
a(n) = n + 2*Sum_{k = 1..n-2} a(k).
G.f.: x/((1+x)*(1-x)*(1-2*x)) = x/(1-2*x-x^2+2*x^3). - Paul Barry, Feb 11 2003
a(n) = 2*a(n-1) + a(n-2) - 2*a(n-3). - Paul Barry, Feb 11 2003
a(n) = Sum_{k = 0..floor((n-1)/2)} 2^(n-2*k-1). - Paul Barry, Nov 11 2003
a(n+1) = Sum_{k=0..floor(n/2)} 2^(n-2*k); a(n+1) = Sum_{k = 0..n} Sum_{j = 0..k} (-1)^(j+k)*2^j. - Paul Barry, Nov 12 2003
(-1)^(n+1)*a(n) = Sum_{i = 0..n} Sum_{k = 1..i} k!*k* Stirling2(i, k)*(-1)^(k-1) = (1/3)*(-2)^(n+1)-(1/6)(3*(-1)^(n+1)-1). - Mario Catalani (mario.catalani(AT)unito.it), Dec 22 2003
a(n+1) = (n!/3)*Sum_{i - (-1)^i + j = n, i = 0..n, j = 0..n} 1/(i - (-1)^i)!/j!. - Benoit Cloitre, May 24 2004
a(n) = A001045(n+1) - A059841(n). - Paul Barry, Jul 22 2004
a(n) = Sum_{k = 0..n} 2^(n-k-1)*(1-(-1)^k), row sums of A130125. - Paul Barry, Jul 28 2004
a(n) = Sum_{k = 0..n} binomial(k, n-k+1)2^(n-k); a(n) = Sum_{k = 0..floor(n/2)} binomial(n-k, k+1)2^k. - Paul Barry, Oct 07 2004
a(n) = A107909(A104161(n)); A007088(a(n)) = A056830(n). - Reinhard Zumkeller, May 28 2005
a(n) = floor(2^(n+1)/3) = ceiling(2^(n+1)/3) - 1 = A005578(n+1) - 1. - Paul Barry, Oct 08 2005
Convolution of "Number of fixed points in all 231-avoiding involutions in S_n." (A059570) with "1-n" (A024000), treating the result as if offset was 0. - Graeme McRae, Jul 12 2006
a(n) = A081254(n) - 2^n. - Philippe Deléham, Oct 15 2006
Starting (1, 2, 5, 10, 21, 42, ...), these are the row sums of triangle A135228. - Gary W. Adamson, Nov 23 2007
Let T = the 3 X 3 matrix [1,1,0; 1,0,1; 0,1,1]. Then T^n * [1,0,0] = [A005578(n), A001045(n), a(n-1)]. - Gary W. Adamson, Dec 25 2007
2^n = 2*A005578(n-1) + 2*A001045(n) + 2*a(n-2). - Gary W. Adamson, Dec 25 2007
If we define f(m,j,x) = Sum_{k=j..m} binomial(m,k)*stirling2(k,j)*x^(m-k) then a(n-3) = (-1)^(n-1)*f(n,3,-2), (n >= 3). - Milan Janjic, Apr 26 2009
a(n) + A001045(n) = A166920(n). a(n) + A001045(n+2) = A051049(n+1). - Paul Curtz, Oct 29 2009
a(n) = floor(A051049(n+1)/3). - Gary Detlefs, Dec 19 2010
a(n) = round((2^(n+2)-3)/6) = floor((2^(n+1)-1)/3) = round((2^(n+1)-2)/3); a(n) = a(n-2) + 2^(n-1), n > 1. - Mircea Merca, Dec 27 2010
a(n) = binary XOR of 2^k-1 for k=0..n. - Paul D. Hanna, Nov 05 2011
E.g.f.: 2/3*exp(2*x) - 1/2*exp(x) - 1/6*exp(-x) = 2/3*U(0); U(k) = 1 - 3/(4*(2^k) - 4*(2^k)/(1+3*(-1)^k - 24*x*(2^k)/(8*x*(2^k)*(-1)^k - (k+1)/U(k+1)))); (continued fraction). - Sergei N. Gladkovskii, Nov 21 2011
Starting with "1" = triangle A059260 * [1, 2, 2, 2, ...] as a vector. - Gary W. Adamson, Mar 06 2012
a(n) = 2*(2^n - 1)/3, for even n; a(n) = (2^(n+1) - 1)/3 = (1/3)*(2^((n+1)/2) - 1)*(2^((n+1)/2) + 1), for odd n. - Hieronymus Fischer, Nov 22 2012
a(n) + a(n+1) = 2^(n+1) - 1. - Arie Bos, Apr 03 2013
G.f.: Q(0)/(3*(1-x)), where Q(k) = 1 - 1/(4^k - 2*x*16^k/(2*x*4^k - 1/(1 + 1/(2*4^k - 8*x*16^k/(4*x*4^k + 1/Q(k+1)))))); (continued fraction). - Sergei N. Gladkovskii, May 21 2013
floor(a(n+2)*3/5) = A077854(n), for n >= 0. - Armands Strazds, Sep 21 2014
a(n) = (2^(n+1) - 2 + (n mod 2))/3. - Paul Toms, Mar 18 2015
a(0) = 0, a(n) = 2*(a(n-1)) + (n mod 2). - Paul Toms, Mar 18 2015
Binary: a(n) = (a(n-1) shift left 1) + (a(n-1)) NOR (...11110). - Paul Toms, Mar 18 2015
Binary: for n > 1, a(n) = 2*a(n-1) OR a(n-2). - Stanislav Sykora, Nov 12 2015
a(n) = A266613(n) - 20*2^(n-5), for n > 2. - Andres Cicuttin, Mar 31 2016
From Michael Somos, Jul 23 2017: (Start)
a(n) = -(2^n)*a(-n) for even n; a(n) = -(2^(n+1))*a(-n) + 1 for odd n.
0 = +a(n)*(+2 +4*a(n) -4*a(n+1)) + a(n+1)*(-1 +a(n+1)) for all n in Z. (End)
G.f.: (x^1+x^3+x^5+x^7+...)/(1-2*x). - Gregory L. Simay, Sep 27 2017
a(n+1) = A051049(n) + A001045(n). - Yuchun Ji, Jul 12 2018
a(n) = A153772(n+3)/4. - Markus Sigg, Sep 14 2020
a(4*k+d) = 2^(d+1)*a(4*k-1) + a(d), a(n+4) = a(n) + 2^n*10, a(0..3) = [0,1,2,5]. So the last digit is always 0,1,2,5 repeated. - Yuchun Ji, May 22 2023

Extensions

Additional comments from Barry E. Williams, Jan 10 2000

A033001 Every run of digits of n in base 3 has length 2.

Original entry on oeis.org

4, 8, 36, 44, 72, 76, 328, 332, 396, 400, 652, 656, 684, 692, 2952, 2960, 2988, 2992, 3568, 3572, 3600, 3608, 5868, 5876, 5904, 5908, 6160, 6164, 6228, 6232, 26572, 26576, 26640, 26644, 26896, 26900, 26928, 26936, 32112, 32120
Offset: 1

Views

Author

Keywords

Comments

See A043291 for the base 2 version (which has a very simple formula), A033002 - A033014 for bases 4 through 16, A033015 - A033029 for the variants with runs of length >= 2. - M. F. Hasler, Feb 01 2014

Programs

  • Mathematica
    Select[Range[10000], Union[Length/@Split[IntegerDigits[#, 3]]]=={2}&] (* Vincenzo Librandi, Feb 05 2014 *)
  • PARI
    is_A033001(n)=!until(!n\=9,bittest(4588304,n%27)||return)
    
  • PARI
    for(n=1,9999,is_A033001(n)&&print1(n",")) \\ (End)
    
  • PARI
    a(n) = my(v=binary(n+1)); v[1]=0; for(i=2,#v, v[i]+=(v[i]>=v[i-1])); 4*fromdigits(v,9); \\ Kevin Ryde, Mar 13 2021

Formula

a(n)=4*A043307(n). - M. F. Hasler, Feb 01 2014

A033015 Numbers whose base-2 expansion has no run of digits with length < 2.

Original entry on oeis.org

3, 7, 12, 15, 24, 28, 31, 48, 51, 56, 60, 63, 96, 99, 103, 112, 115, 120, 124, 127, 192, 195, 199, 204, 207, 224, 227, 231, 240, 243, 248, 252, 255, 384, 387, 391, 396, 399, 408, 412, 415, 448, 451, 455, 460, 463, 480, 483, 487, 496, 499, 504, 508, 511, 768
Offset: 1

Views

Author

Keywords

Comments

See A033016 and following for the variants in other bases, A043291 for run lengths equal to 2 (which has a very simple formula) and A033001 and following for the analog of the latter in other bases. - M. F. Hasler, Feb 01 2014
The number zero also satisfies the definition if we consider that its base-2 expansion is empty. - M. F. Hasler, Oct 06 2022
If we define row n as subset of terms with n bits, i.e., 2^(n-1) < a(k) < 2^n, then we get row n by duplicating the last bit (LSB) of the terms in row n-1 and appending twice the negated LSB to the terms in row n-2. This gives the FORMULA for the number of terms in row n. - M. F. Hasler, Oct 17 2022

Examples

			The first terms, written in binary, are: 11, 111, 1100, 1111, 11000, 11100, 11111, 110000, 110011, ...; cf. sequence A355280. - _M. F. Hasler_, Oct 06 2022
		

Crossrefs

Cf. A355280 (in binary).
Cf. A222813 (palindromes subsequence).
See A033001 for further cross-references.

Programs

  • Mathematica
    Select[Range[2000], Min[Length/@Split[IntegerDigits[#, 2]]]>1&] (* Vincenzo Librandi, Feb 05 2014 *)
  • PARI
    is(n)=my(t); if(n%2, t=valuation(n+1,2); if(t==1,return(0)); n>>=t); while(n, t=valuation(n,2); if(t==1,return(0)); n>>=t; t=valuation(n+1,2); if(t==1,return(0)); n>>=t); 1 \\ Charles R Greathouse IV, Mar 29 2013
    
  • PARI
    select( is_A033015(n)=!bitand(n=bitxor(n,n<<1),n<<1)&&bitand(n,3)!=2, [1..770]) \\ M. F. Hasler, Oct 06 2022 (replacing less efficient code from 2014)
    
  • PARI
    {A033015_row(n)=if(n>3, setunion([x*2+x%2|x<-A033015_row(n-1)], [x*4+3-x%2*3|x<-A033015_row(n-2)]), n>1, [2^n-1], [])} \\ "Row" of n-digit terms. For (very) large n one could use memoization rather than this naive recursive definition.
    concat(apply(A033015_row, [1..9])) \\ To get the "flattened" sequence. - M. F. Hasler, Oct 17 2022
    
  • Python
    from itertools import groupby
    def ok(n): return all(len(list(g)) >= 2 for k, g in groupby(bin(n)[2:]))
    print([i for i in range(1, 769) if ok(i)]) # Michael S. Branicky, Jan 04 2021
    
  • Python
    def A033015_row(n): # terms with n bits <=> in [2^(n-1) .. 2^n]
        return [[], [], [3], [7]][n] if n < 4 else sorted(
        [x*2+x%2 for x in A033015_row(n-1)] +
        [x*4+3-x%2*3 for x in A033015_row(n-2)]) # M. F. Hasler, Oct 17 2022
    print(sum((A033015_row(n)for n in range(11)),[]))

Formula

The number of n-bit terms is Fibonacci(n-1) = A000045(n-1). - M. F. Hasler, Oct 17 2022

Extensions

Extended by Ray Chandler, Dec 18 2009

A043307 a(n) = A033001(n)/4.

Original entry on oeis.org

1, 2, 9, 11, 18, 19, 82, 83, 99, 100, 163, 164, 171, 173, 738, 740, 747, 748, 892, 893, 900, 902, 1467, 1469, 1476, 1477, 1540, 1541, 1557, 1558, 6643, 6644, 6660, 6661, 6724, 6725, 6732, 6734, 8028, 8030, 8037, 8038, 8101, 8102, 8118, 8119
Offset: 1

Views

Author

Keywords

Comments

Also: Numbers which, written in base 9, have only digits 0, 1 or 2, and no two adjacent digits equal. - M. F. Hasler, Feb 03 2014

Crossrefs

Programs

  • Maple
    A[1]:= [1,2]:
    for d from 2 to 6 do
      A[d]:= map(t -> seq(9*t+j,j=subs(t mod 9 = NULL, [0,1,2])), A[d-1])
    od:
    seq(op(A[d]),d=1..6); # Robert Israel, Jan 29 2017
  • Mathematica
    Table[FromDigits[#,9]&/@Select[Tuples[{0,1,2},n],Min[Abs[Differences[#]]]>0&],{n,2,5}]// Flatten// Union (* Harvey P. Dale, May 27 2023 *)
  • PARI
    is_A043307(n)=(n=[n])&&!until(!n[1],((n=divrem(n[1],9))[2]<3 && n[1]%3!=n[2])||return) \\ M. F. Hasler, Feb 03 2014
    
  • PARI
    a(n) = my(v=binary(n+1)); v[1]=0; for(i=2,#v, v[i]+=(v[i]>=v[i-1])); fromdigits(v,9); \\ Kevin Ryde, Mar 13 2021

Formula

From Robert Israel, Jan 29 2017: (Start)
If a(n) == 0 (mod 3) then a(2*n+1) = 9*a(n) + 1 else a(2*n+1) = 9*a(n).
If a(n) == 2 (mod 3) then a(2*n+2) = 9*a(n) + 1 else a(2*n+1) = 9*a(n)+2.
a(4k+5) = 9*a(2k+2).
(End)

A043320 Numbers which, written in base 256, have all digits less than 16 and no two adjacent digits equal.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 256, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 512, 513, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 768, 769, 770, 772, 773, 774
Offset: 1

Views

Author

Keywords

Comments

Sequence A033014 consists of the numbers that have all base 16 digits repeated *exactly* twice. (This is equivalent to say that the base-256 digits are 0x00, 0x11, 0x22,... or 0xFF, in hex notation, and no two adjacent base-256 digits are equal.) Thus, these numbers are divisible by 0x11 = 17, and the result of the division is a number which has no other base-256 digits than 0x00, 0x01,... or 0x0F, and no two adjacent digits equal. Conversely, it is clear that exactly these numbers are terms of A033014 when multiplied by 17 = 0x11. - M. F. Hasler, Feb 05 2014

Crossrefs

Programs

  • Mathematica
    Select[Range[20000], Union[Length/@Split[IntegerDigits[#, 16]]]=={2}&]/17 (* Vincenzo Librandi, Feb 06 2014 *)
  • PARI
    is_A043320(n)={(n=[n])&&!until(!n[1], ((n=divrem(n[1], 256))[2]<16 && n[1]%16!=n[2])||return)} \\ M. F. Hasler, Feb 03 2014
    
  • Python
    from itertools import count, islice, groupby
    def A043320_gen(startvalue=1): # generator of terms >= startvalue
        return filter(lambda n:set(len(list(g)) for k, g in groupby(hex(17*n)[2:]))=={2},count(max(startvalue,1)))
    A043320_list = list(islice(A043320_gen(),20)) # Chai Wah Wu, Mar 10 2023

Formula

a(n) = A033014(n)/17. [This was initially the definition of the sequence. - M. F. Hasler, Feb 03 2014]

Extensions

New definition by M. F. Hasler, Feb 03 2014

A140690 A positive integer n is included if n written in binary can be subdivided into a number of runs all of equal-length, the first run from the left consisting of all 1's, the next run consisting of all 0's, the next run consisting of all 1's, the next run consisting of all 0's, etc.

Original entry on oeis.org

1, 2, 3, 5, 7, 10, 12, 15, 21, 31, 42, 51, 56, 63, 85, 127, 170, 204, 240, 255, 341, 455, 511, 682, 819, 992, 1023, 1365, 2047, 2730, 3276, 3640, 3855, 4032, 4095, 5461, 8191, 10922, 13107, 16256, 16383, 21845, 29127, 31775, 32767, 43690, 52428, 61680
Offset: 1

Views

Author

Leroy Quet, Jul 11 2008

Keywords

Comments

Also: numbers of the form (2^s-1)*[4^{s*(k+1)}-1]/(4^s-1) or 2^s(2^s-1)*[4^{s*(k+1)}-1]/(4^s-1), s>=1, k>=0. Subsequences are, with the possible exception of terms at n=0, A002450(n), A043291(n), A015565(2n), A093134(2n+1), A000225(n), A020522(n). [R. J. Mathar, Aug 04 2008]
From Emeric Deutsch, Jan 25 2018: (Start)
Also the indices of the compositions having equal parts.
We define the index of a composition to be the positive integer whose binary form has run-lengths (i.e. runs of 1's, runs of 0's, etc., from left to right) equal to the parts of the composition. Example: the composition [1,1,3,1] has index 46 since the binary form of 46 is 101110. The integer 992 is in the sequence since its binary form is 1111100000 and the composition [5,5] has equal parts. The integer 100 is not in the sequence since its binary form is 1100100 and the composition [2,2,1,2] does not have equal parts.
The command c(n) from the Maple program yields the composition having index n. (End)

Examples

			819 in binary is 1100110011. The runs of 0's and 1's are (11)(00)(11)(00)(11). Each run (alternating 1's and 0's) is the same length. So 819 is in the sequence.
		

Crossrefs

Programs

  • Haskell
    import Data.Set (singleton, deleteFindMin, insert)
    a140690 n = a140690_list !! (n-1)
    a140690_list = f $ singleton (1, 1, 2) where
       f s | k == 1 = m : f (insert (2*b-1, 1, 2*b) $ insert (b*m, k+1, b) s')
           | even k    = m : f (insert (b*m+b-1, k+1, b) s')
           | otherwise = m : f (insert (b*m, k+1, b) s')
           where ((m, k, b), s') = deleteFindMin s
    -- Reinhard Zumkeller, Feb 21 2014
  • Maple
    Runs := proc (L) local j, r, i, k: j := 1: r[j] := L[1]: for i from 2 to nops(L) do if L[i] = L[i-1] then r[j] := r[j], L[i] else j := j+1: r[j] := L[i] end if end do: [seq([r[k]], k = 1 .. j)] end proc: RunLengths := proc (L) map(nops, Runs(L)) end proc: c := proc (n) ListTools:-Reverse(convert(n, base, 2)): RunLengths(%) end proc: A := {}: for n to 62000 do if nops(convert(c(n), set)) = 1 then A := `union`(A, {n}) else  end if end do: A; # most of the Maple program is due to W. Edwin Clark. - Emeric Deutsch, Jan 25 2018
  • Mathematica
    Select[Range[62000],Length[Union[Length/@Split[IntegerDigits[#,2]]]]==1&] (* Harvey P. Dale, Mar 22 2012 *)

Extensions

Terms beyond 42 from R. J. Mathar, Aug 04 2008

A077854 Expansion of 1/((1-x)*(1-2*x)*(1+x^2)).

Original entry on oeis.org

1, 3, 6, 12, 25, 51, 102, 204, 409, 819, 1638, 3276, 6553, 13107, 26214, 52428, 104857, 209715, 419430, 838860, 1677721, 3355443, 6710886, 13421772, 26843545, 53687091, 107374182, 214748364, 429496729, 858993459, 1717986918, 3435973836, 6871947673
Offset: 0

Views

Author

N. J. A. Sloane, Nov 17 2002

Keywords

Comments

Partial sums of A007910. - Mircea Merca, Dec 27 2010
This is the decimal representation of the middle column of "Rule 54" elementary cellular automaton. - Karl V. Keller, Jr., Sep 26 2021
This same sequence (except that the offset is changed to 4) is 2^n with the final digit chopped off. - J. Lowell, May 11 2022

Examples

			The sequence in hexadecimal shows the pattern
1, 3, 6, c,
19, 33, 66, cc,
199, 333, 666, ccc,
1999, 3333, 6666, cccc,
19999, 33333, 66666, ccccc,
199999, 333333, 666666, cccccc,
1999999, 3333333, 6666666, ccccccc,
19999999, 33333333, 66666666, cccccccc,
... - _Armands Strazds_, Oct 09 2014
		

Crossrefs

Equals A007909(n+3) - [n congruent 2, 3 mod 4].
Cf. A130306, A043291 (subsequence); A000975, A007910, A133872, A259661 (binary).

Programs

  • Haskell
    import Data.Bits (xor)
    a077854 n = a077854_list !! n
    a077854_list = scanl1 xor $ tail a000975_list :: [Integer]
    -- Reinhard Zumkeller, Jan 04 2013
    
  • Magma
    [Round((2^(n+4)-5)/10): n in [0..40]]; // Vincenzo Librandi, Jun 25 2011
    
  • Maple
    a := proc(n) option remember; if n=0 then RETURN(1); fi; if n=1 then RETURN(3); fi; if n=2 then RETURN(6); fi; if n=3 then RETURN(12); fi; 3*a(n-1)-3*a(n-2)+3*a(n-3)-2*a(n-4); end;
    seq(iquo(2^n,5),n=3..35); # Zerinvary Lajos, Apr 20 2008
  • Mathematica
    CoefficientList[Series[1/((1 - x) (1 - 2 x) (1 + x^2)), {x, 0, 32}], x] (* Michael De Vlieger, Mar 29 2016 *)
    LinearRecurrence[{3,-3,3,-2},{1,3,6,12},40] (* Harvey P. Dale, Feb 06 2019 *)
  • PARI
    a(n)=(16<Charles R Greathouse IV, Sep 23 2012
    
  • PARI
    Vec(1/(1-3*x+3*x^2-3*x^3+2*x^4)+O(x^99)) \\ Derek Orr, Oct 26 2014
    
  • Python
    print([2**(n+3)//5 for n in range(50)]) # Karl V. Keller, Jr., Sep 26 2021

Formula

a(n) = 3*a(n-1) - 3*a(n-2) + 3*a(n-3) - 2*a(n-4), with initial values a(0) = 1, a(1) = 3, a(2) = 6, a(3) = 12.
a(n) = (1/10)*(2^(n+4) + (-1)^floor(n/2) - 2*(-1)^floor((n+1)/2) - 5).
Row sums of A130306. - Gary W. Adamson, May 20 2007
a(n) = floor(2^(n+3)/5). - Gary Detlefs, Sep 06 2010
a(n) = round((2^(n+4)-5)/10) = floor((2^(n+3)-1)/5) = ceiling((2^(n+3)-4)/5) = round((2^(n+3)-2)/5); a(n) = a(n-4) + 3*2^(n-1), n > 3. - Mircea Merca, Dec 27 2010
a(n) = 2^(n+1) - 1 - a(n-2); a(n) = a(n-1)/2 for n == 2, 3 (mod 4); a(n) = (a(n-1)-1)/2 for n == 0, 1 (mod 4). - Arie Bos, Apr 06 2013
a(n) = floor(A000975(n+2)*3/5). - Armands Strazds, Oct 18 2014
a(n) = Sum_{k=1..n+3} floor(1 + sin(k*Pi/2 + 3*Pi/4))*2^(n-k+3). - Andres Cicuttin, Mar 28 2016
a(n) = (-15 + 3*2^(3+n) + 2^(1 + n - 4*floor((1+n)/4)) + 2^(2 + n - 4*floor((2+n)/4)))/15. - Andres Cicuttin, Mar 28 2016
a(n) = (16*2^n+(-1)^((2*n-1+(-1)^n)/4)-2*(-1)^((2*n+1-(-1)^n)/4)-5)/10. - Wesley Ivan Hurt, Apr 01 2016

A033114 Base-4 digits are, in order, the first n terms of the periodic sequence with initial period 1,0.

Original entry on oeis.org

1, 4, 17, 68, 273, 1092, 4369, 17476, 69905, 279620, 1118481, 4473924, 17895697, 71582788, 286331153, 1145324612, 4581298449, 18325193796, 73300775185, 293203100740, 1172812402961, 4691249611844, 18764998447377, 75059993789508
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

Formula

a(n) = floor(4^(n+1)/15) = 4^(n+1)/15 - 1/6 - (-1)^n/10. - Benoit Cloitre, Apr 18 2003
G.f.: 1/((1-x)*(1+x)*(1-4*x)); a(n) = 3*a(n-1) + 4*a(n-2)+1. Partial sum of A015521. - Paul Barry, Nov 12 2003
a(n) = Sum_{k=0..floor(n/2)} 4^(n-2*k); a(n) = Sum_{k=0..n} Sum_{j=0..k} (-1)^(j+k)*4^j. - Paul Barry, Nov 12 2003
Convolution of A000302 and A059841 (4^n and periodic{1, 0}). a(n) = Sum_{k=0..n} (1 + (-1)^(n-k))*4^k/2. - Paul Barry, Jul 19 2004
a(n) = Sum_{k=0..n} (-1)^(n-k)*(J(2*k+1)-1)/2, J(n)=A001045(n). - Paul Barry, Mar 06 2008
a(n) = round((8*4^n-5)/30) = ceiling((4*4^n-4)/15) = round((4*4^n-4)/15); a(n) = a(n-2) + 4^(n-1), n > 1. - Mircea Merca, Dec 28 2010
a(n) = A117616(n)/2. - J. M. Bergot, Apr 22 2015
a(n) = A043291(n)/3; a(n+1) = 4*a(n) + A000035(n). - Robert Israel, Apr 22 2015
a(n)+a(n+1) = A002450(n+1). - R. J. Mathar, Feb 27 2019

A153435 Numbers with 2n binary digits where every run length is 2, written in binary.

Original entry on oeis.org

11, 1100, 110011, 11001100, 1100110011, 110011001100, 11001100110011, 1100110011001100, 110011001100110011, 11001100110011001100, 1100110011001100110011, 110011001100110011001100
Offset: 1

Views

Author

Omar E. Pol, Dec 26 2008

Keywords

Comments

A043291 written in base 2.

Examples

			n ... a(n) ....... A043291(n)
1 ... 11 ............. 3
2 ... 1100 .......... 12
3 ... 110011 ........ 51
4 ... 11001100 ..... 204
5 ... 1100110011 ... 819
		

Crossrefs

Cf. A043291.

Programs

  • Maple
    A153435:=n->(-101-99*(-1)^n+2^(3+2*n)*25^(1+n))/1818; seq(A153435(n), n=1..20); # Wesley Ivan Hurt, Apr 19 2014
  • Mathematica
    Table[(-101 - 99*(-1)^n + 2^(3 + 2*n)*25^(1 + n))/1818, {n, 20}] (* Wesley Ivan Hurt, Apr 19 2014 *)
    CoefficientList[Series[11/((x - 1) (x + 1) (100 x - 1)), {x, 0, 30}], x] (* Vincenzo Librandi, Apr 20 2014 *)
  • PARI
    Vec(11*x / ((x-1)*(x+1)*(100*x-1)) + O(x^100)) \\ Colin Barker, Apr 19 2014

Formula

From Colin Barker, Apr 19 2014: (Start)
a(n) = (-101-99*(-1)^n+2^(3+2*n)*25^(1+n))/1818.
a(n) = 100*a(n-1)+a(n-2)-100*a(n-3).
G.f.: 11*x / ((x-1)*(x+1)*(100*x-1)).(End).

A033002 Every run of digits of n in base 4 has length 2.

Original entry on oeis.org

5, 10, 15, 80, 90, 95, 160, 165, 175, 240, 245, 250, 1285, 1290, 1295, 1440, 1445, 1455, 1520, 1525, 1530, 2565, 2570, 2575, 2640, 2650, 2655, 2800, 2805, 2810, 3845, 3850, 3855, 3920, 3930, 3935, 4000, 4005, 4015, 20560
Offset: 1

Views

Author

Keywords

Comments

See A043291 and A033001 through A033014 for the analog in other bases, A033015 - A033029 for the variants with run lengths >= 2. - M. F. Hasler, Feb 04 2014

Programs

  • Mathematica
    Select[Range[10000], Union[Length/@Split[IntegerDigits[#, 4]]]=={2}&] (* Vincenzo Librandi, Feb 05 2014 *)

Formula

a(n) = 5*A043308(n) (= 5*n for n<4). - M. F. Hasler, Feb 04 2014
Showing 1-10 of 38 results. Next