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

A319785 a(n) = A073138(n) + A038573(n).

Original entry on oeis.org

0, 2, 3, 6, 5, 9, 9, 14, 9, 15, 15, 21, 15, 21, 21, 30, 17, 27, 27, 35, 27, 35, 35, 45, 27, 35, 35, 45, 35, 45, 45, 62, 33, 51, 51, 63, 51, 63, 63, 75, 51, 63, 63, 75, 63, 75, 75, 93, 51, 63, 63, 75, 63, 75, 75, 93, 63, 75, 75, 93, 75, 93, 93, 126, 65, 99, 99, 119
Offset: 0

Views

Author

Seiichi Manyama, Sep 27 2018

Keywords

Comments

This sequence is different from A055944. For example, A055944(5) = 10 and a(5) = 9.

Crossrefs

Base b: this sequence (b=2), A319803 (b=3), A319804 (b=4), A319805 (b=5), A319806 (b=6), A319807 (b=7), A319808 (b=8), A319747 (b=9), A052008 (b=10).

Programs

  • Mathematica
    Table[FromDigits[Reverse[#], 2] + FromDigits[#, 2] & [Sort[IntegerDigits[n, 2]]], {n, 0, 100}] (* Paolo Xausa, Aug 07 2024 *)
  • PARI
    a(n) = my(dn=binary(n)); fromdigits(vecsort(dn), 2) + fromdigits(vecsort(dn,,4), 2); \\ Michel Marcus, Sep 28 2018

A159912 Partial sums of A159913(k) = 2^bitcount(2k+1)-1 = A038573(2k+1), bitcount=A000120.

Original entry on oeis.org

0, 1, 4, 7, 14, 17, 24, 31, 46, 49, 56, 63, 78, 85, 100, 115, 146, 149, 156, 163, 178, 185, 200, 215, 246, 253, 268, 283, 314, 329, 360, 391, 454, 457, 464, 471, 486, 493, 508, 523, 554, 561, 576, 591, 622, 637, 668, 699, 762, 769, 784, 799, 830, 845, 876, 907
Offset: 0

Views

Author

M. F. Hasler, May 03 2009

Keywords

Comments

More precisely, a(n)=sum(iA159913(i)), since we want the sequence to start with a(0)=0 and not with A159913(0)=1.
a(n) is also the total number of ON cells after n generations in the outward corner version of the Ulam-Warburton cellular automaton of A147562, and a(n) is also the total number of Y-toothpicks after n generations in the outward corner version of the Y-toothpick structure of A160120. - David Applegate and Omar E. Pol, Jan 24 2016

Crossrefs

Programs

  • Mathematica
    Accumulate@ Table[2^(DigitCount[n, 2][[1]] + 1) - 1, {n, 0, 54}] (* Michael De Vlieger, Jan 25 2016 *)
  • PARI
    A159912(n)=sum(i=0,n-1,1<
    				

Formula

a(n) = sum( i=0...n-1, A159913(i)) = sum(i=0..n-1, 2^A000120(i))*2-n
a(n) = n + (A160720(n) - 1)/2 = n + 2*(A266532(n) - 1)/3 = n + 2*A267700(n-1), n >= 1. - Omar E. Pol, Jan 25 2016

A100290 Numbers divisible by smallest number with same number of 1's in its binary expansion. That is, A038573(a(n)) divides a(n).

Original entry on oeis.org

1, 2, 3, 4, 6, 7, 8, 9, 12, 14, 15, 16, 18, 21, 24, 28, 30, 31, 32, 33, 35, 36, 42, 45, 48, 49, 56, 60, 62, 63, 64, 66, 70, 72, 75, 84, 90, 93, 96, 98, 105, 112, 120, 124, 126, 127, 128, 129, 132, 133, 135, 140, 144, 150, 155, 161, 165, 168, 180, 186, 189, 192, 195, 196
Offset: 1

Views

Author

Marc LeBrun, Nov 11 2004

Keywords

Comments

Contains m*(2^k-1) for 1 <= m <= 2^k + 2 and any k >= 1. - Robert Israel, Aug 04 2016

Examples

			21 is a member since 21 = 10101 base 2, which is divisible by 7 = 111 base 2.
		

Crossrefs

Programs

  • Maple
    filter:= n -> evalb(n mod (2^numboccur(1,convert(n,base,2))-1) = 0):
    select(filter, [$1..1000]); # Robert Israel, Aug 04 2016
  • Mathematica
    Select[Range[200], Divisible[#, 2^DigitCount[#, 2, 1] - 1] &] (* Ivan Neretin, Aug 03 2016 *)
  • PARI
    is(n)=n%(2^hammingweight(n)-1)==0 \\ Charles R Greathouse IV, Aug 04 2016

A106524 Interleave A038573(n+1) and 2*A038573(n+1).

Original entry on oeis.org

1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15
Offset: 0

Views

Author

Paul Barry, May 06 2005

Keywords

Comments

Row sums of number the number triangle (A106522 mod 2).

Crossrefs

Programs

  • Magma
    A106524:= func< n | 2^Multiplicity(Intseq(n+2, 2), 1) - 2^(n mod 2) >;
    [A106524(n): n in [0..100]]; // G. C. Greubel, Aug 12 2021
    
  • Mathematica
    a[n_]:= (2^DigitCount[Floor[(n+2)/2], 2, 1] - 1)*(3 - (-1)^n)/2;
    Table[a[n], {n, 0, 100}] (* G. C. Greubel, Aug 11 2021 *)
  • PARI
    a(n) = bitneg(n%2, hammingweight(n+2)); \\ Kevin Ryde, Aug 25 2021
  • Sage
    def A000120(n): return sum(n.digits(2))
    def A106524(n): return 2^A000120(n+2) - 2^(n%2)
    [A106524(n) for n in (0..100)] # G. C. Greubel, Aug 11 2021
    

Formula

a(n) = (Sum_{k=0..n+2} binomial(n+2, k)) mod 2 - (3 - (-1)^n)/2.
a(n) = ( (Sum_{k=0..(n/2+1)} binomial(n/2+1, k)) mod 2 - 1 )*(1 + (-1)^n)/2 + ( (Sum_{k=0..(n+1)/2} binomial((n+1)/2, k)) mod 2 - 1)*(1 - (-1)^n)/2.
a(n) = A001316(n+2) - A000034(n).

A380544 Numbers of the form A073138(k) XOR A038573(k).

Original entry on oeis.org

0, 3, 5, 9, 15, 17, 27, 33, 51, 63, 65, 99, 119, 129, 195, 231, 255, 257, 387, 455, 495, 513, 771, 903, 975, 1023, 1025, 1539, 1799, 1935, 2015, 2049, 3075, 3591, 3855, 3999, 4095, 4097, 6147, 7175, 7695, 7967, 8127, 8193, 12291, 14343, 15375, 15903, 16191, 16383, 16385
Offset: 1

Views

Author

Keywords

Comments

The plot of the sequence has a blancmange appearance. The discontinuities in the curve are at a(n) = k^2 + 1.
The bit length of a(n+1) appears to be A000267(n)+1.
The number of 0-bits in the binary expansion of a(n+1) appears to be A082375(n).

Examples

			k = 17. A073138(17) = 24 = 11000_2. A038573(17) = 3 = 00011_2. 11000_2 XOR 00011_2 = 11011_2 = 27. 27 is a term.
		

Crossrefs

Subsequence of A006995.

Programs

  • Mathematica
    s[n_, k_] := (2^n-1)*(2^(k-n)+1); Join[{0}, Table[s[n, k], {k, 2, 15}, {n, 1, Floor[k/2]}] // Flatten] (* Amiram Eldar, Jun 23 2025 *)
  • PARI
    a8(n) = fromdigits(vecsort(binary(n), , 4), 2);
    a3(n) = 2^hammingweight(n)-1;
    lista(nn) = Set(vector(nn, n, bitxor(a3(n), a8(n)))); \\ Michel Marcus, Jun 23 2025

Extensions

More terms from Michel Marcus, Jun 23 2025

A001316 Gould's sequence: a(n) = Sum_{k=0..n} (binomial(n,k) mod 2); number of odd entries in row n of Pascal's triangle (A007318); a(n) = 2^A000120(n).

Original entry on oeis.org

1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, 4, 8, 8, 16, 8, 16, 16, 32, 8, 16, 16, 32, 16, 32, 32, 64, 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, 4, 8, 8, 16, 8, 16, 16, 32
Offset: 0

Views

Author

Keywords

Comments

Also called Dress's sequence.
This sequence might be better called Glaisher's sequence, since James Glaisher showed that odd binomial coefficients are counted by 2^A000120(n) in 1899. - Eric Rowland, Mar 17 2017 [However, the name "Gould's sequence" is deeply entrenched in the literature. - N. J. A. Sloane, Mar 17 2017] [Named after the American mathematician Henry Wadsworth Gould (b. 1928). - Amiram Eldar, Jun 19 2021]
All terms are powers of 2. The first occurrence of 2^k is at n = 2^k - 1; e.g., the first occurrence of 16 is at n = 15. - Robert G. Wilson v, Dec 06 2000
a(n) is the highest power of 2 dividing binomial(2n,n) = A000984(n). - Benoit Cloitre, Jan 23 2002
Also number of 1's in n-th row of triangle in A070886. - Hans Havermann, May 26 2002. Equivalently, number of live cells in generation n of a one-dimensional cellular automaton, Rule 90, starting with a single live cell. - Ben Branman, Feb 28 2009. Ditto for Rule 18. - N. J. A. Sloane, Aug 09 2014. This is also the odd-rule cellular automaton defined by OddRule 003 (see Ekhad-Sloane-Zeilberger "Odd-Rule Cellular Automata on the Square Grid" link). - N. J. A. Sloane, Feb 25 2015
Also number of numbers k, 0<=k<=n, such that (k OR n) = n (bitwise logical OR): a(n) = #{k : T(n,k)=n, 0<=k<=n}, where T is defined as in A080098. - Reinhard Zumkeller, Jan 28 2003
To construct the sequence, start with 1 and use the rule: If k >= 0 and a(0),a(1),...,a(2^k-1) are the first 2^k terms, then the next 2^k terms are 2*a(0),2*a(1),...,2*a(2^k-1). - Benoit Cloitre, Jan 30 2003
Also, numerator((2^k)/k!). - Mohammed Bouayoun (mohammed.bouayoun(AT)sanef.com), Mar 03 2004
The odd entries in Pascal's triangle form the Sierpiński Gasket (a fractal). - Amarnath Murthy, Nov 20 2004
Row sums of Sierpiński's Gasket A047999. - Johannes W. Meijer, Jun 05 2011
Fixed point of the morphism "1" -> "1,2", "2" -> "2,4", "4" -> "4,8", ..., "2^k" -> "2^k,2^(k+1)", ... starting with a(0) = 1; 1 -> 12 -> 1224 -> = 12242448 -> 122424482448488(16) -> ... . - Philippe Deléham, Jun 18 2005
a(n) = number of 1's of stage n of the one-dimensional cellular automaton with Rule 90. - Andras Erszegi (erszegi.andras(AT)chello.hu), Apr 01 2006
a(33)..a(63) = A117973(1)..A117973(31). - Stephen Crowley, Mar 21 2007
Or the number of solutions of the equation: A000120(x) + A000120(n-x) = A000120(n). - Vladimir Shevelev, Jul 19 2009
For positive n, a(n) equals the denominator of the permanent of the n X n matrix consisting entirely of (1/2)'s. - John M. Campbell, May 26 2011
Companions to A001316 are A048896, A105321, A117973, A151930 and A191488. They all have the same structure. We observe that for all these sequences a((2*n+1)*2^p-1) = C(p)*A001316(n), p >= 0. If C(p) = 2^p then a(n) = A001316(n), if C(p) = 1 then a(n) = A048896(n), if C(p) = 2^p+2 then a(n) = A105321(n+1), if C(p) = 2^(p+1) then a(n) = A117973(n), if C(p) = 2^p-2 then a(n) = (-1)*A151930(n) and if C(p) = 2^(p+1)+2 then a(n) = A191488(n). Furthermore for all a(2^p - 1) = C(p). - Johannes W. Meijer, Jun 05 2011
a(n) = number of zeros in n-th row of A219463 = number of ones in n-th row of A047999. - Reinhard Zumkeller, Nov 30 2012
This is the Run Length Transform of S(n) = {1,2,4,8,16,...} (cf. A000079). The Run Length Transform of a sequence {S(n), n>=0} is defined to be the sequence {T(n), n>=0} given by T(n) = Product_i S(i), where i runs through the lengths of runs of 1's in the binary expansion of n. E.g., 19 is 10011 in binary, which has two runs of 1's, of lengths 1 and 2. So T(19) = S(1)*S(2). T(0)=1 (the empty product). - N. J. A. Sloane, Sep 05 2014
A105321(n+1) = a(n+1) + a(n). - Reinhard Zumkeller, Nov 14 2014
a(n) = A261363(n,n) = number of distinct terms in row n of A261363 = number of odd terms in row n+1 of A261363. - Reinhard Zumkeller, Aug 16 2015
From Gary W. Adamson, Aug 26 2016: (Start)
A production matrix for the sequence is lim_{k->infinity} M^k, the left-shifted vector of M:
1, 0, 0, 0, 0, ...
2, 0, 0, 0, 0, ...
0, 1, 0, 0, 0, ...
0, 2, 0, 0, 0, ...
0, 0, 1, 0, 0, ...
0, 0, 2, 0, 0, ...
0, 0, 0, 1, 0, ...
...
The result is equivalent to the g.f. of Apr 06 2003: Product_{k>=0} (1 + 2*z^(2^k)). (End)
Number of binary palindromes of length n for which the first floor(n/2) symbols are themselves a palindrome (Ji and Wilf 2008). - Jeffrey Shallit, Jun 15 2017

Examples

			Has a natural structure as a triangle:
  1,
  2,
  2,4,
  2,4,4,8,
  2,4,4,8,4,8,8,16,
  2,4,4,8,4,8,8,16,4,8,8,16,8,16,16,32,
  2,4,4,8,4,8,8,16,4,8,8,16,8,16,16,32,4,8,8,16,8,16,16,32,8,16,16,32,16,32,32,64,
  ...
The rows converge to A117973.
From _Omar E. Pol_, Jun 07 2009: (Start)
Also, triangle begins:
   1;
   2,2;
   4,2,4,4;
   8,2,4,4,8,4,8,8;
  16,2,4,4,8,4,8,8,16,4,8,8,16,8,16,16;
  32,2,4,4,8,4,8,8,16,4,8,8,16,8,16,16,32,4,8,8,16,8,16,16,32,8,16,16,32,16,32,32;
  64,2,4,4,8,4,8,8,16,4,8,8,16,8,16,16,32,4,8,8,16,8,16,16,32,8,16,16,32,16,32,...
(End)
G.f. = 1 + 2*x + 2*x^2 + 4*x^3 + 2*x^4 + 4*x^5 + 4*x^6 + 8*x^7 + 2*x^8 + ... - _Michael Somos_, Aug 26 2015
		

References

  • Arthur T. Benjamin and Jennifer J. Quinn, Proofs that really count: the art of combinatorial proof, M.A.A., 2003, p. 75ff.
  • Steven R. Finch, Mathematical Constants, Cambridge, 2003, pp. 145-151.
  • James W. L. Glaisher, On the residue of a binomial-theorem coefficient with respect to a prime modulus, Quarterly Journal of Pure and Applied Mathematics, Vol. 30 (1899), pp. 150-156.
  • H. W. Gould, Exponential Binomial Coefficient Series. Tech. Rep. 4, Math. Dept., West Virginia Univ., Morgantown, WV, Sep 1961.
  • Olivier Martin, Andrew M. Odlyzko, and Stephen Wolfram, Algebraic properties of cellular automata, Comm. Math. Physics, Vol. 93 (1984), pp. 219-258. Reprinted in Theory and Applications of Cellular Automata, S Wolfram, Ed., World Scientific, 1986, pp. 51-90 and in Cellular Automata and Complexity: Collected Papers of Stephen Wolfram, Addison-Wesley, 1994, pp. 71-113
  • Manfred R. Schroeder, Fractals, Chaos, Power Laws, W. H. Freeman, NY, 1991, page 383.
  • 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).
  • Andrew Wuensche, Exploring Discrete Dynamics, Luniver Press, 2011. See Fig. 2.3.

Crossrefs

Equals left border of triangle A166548. - Gary W. Adamson, Oct 16 2009
For generating functions Product_{k>=0} (1+a*x^(b^k)) for the following values of (a,b) see: (1,2) A000012 and A000027, (1,3) A039966 and A005836, (1,4) A151666 and A000695, (1,5) A151667 and A033042, (2,2) A001316, (2,3) A151668, (2,4) A151669, (2,5) A151670, (3,2) A048883, (3,3) A117940, (3,4) A151665, (3,5) A151671, (4,2) A102376, (4,3) A151672, (4,4) A151673, (4,5) A151674.
For partial sums see A006046. For first differences see A151930.
This is the numerator of 2^n/n!, while A049606 gives the denominator.
If we subtract 1 from the terms we get a pair of essentially identical sequences, A038573 and A159913.
A163000 and A163577 count binomial coefficients with 2-adic valuation 1 and 2. A275012 gives a measure of complexity of these sequences. - Eric Rowland, Mar 15 2017
Cf. A286575 (run-length transform), A368655 (binomial transform), also A037445.

Programs

  • Haskell
    import Data.List (transpose)
    a001316 = sum . a047999_row  -- Reinhard Zumkeller, Nov 24 2012
    a001316_list = 1 : zs where
       zs = 2 : (concat $ transpose [zs, map (* 2) zs])
    -- Reinhard Zumkeller, Aug 27 2014, Sep 16 2011
    (Sage, Python)
    from functools import cache
    @cache
    def A001316(n):
        if n <= 1: return n+1
        return A001316(n//2) << n%2
    print([A001316(n) for n in range(88)])  # Peter Luschny, Nov 19 2012
    
  • Maple
    A001316 := proc(n) local k; add(binomial(n,k) mod 2, k=0..n); end;
    S:=[1]; S:=[op(S),op(2*s)]; # repeat ad infinitum!
    a := n -> 2^add(i,i=convert(n,base,2)); # Peter Luschny, Mar 11 2009
  • Mathematica
    Table[ Sum[ Mod[ Binomial[n, k], 2], {k, 0, n} ], {n, 0, 100} ]
    Nest[ Join[#, 2#] &, {1}, 7] (* Robert G. Wilson v, Jan 24 2006 and modified Jul 27 2014 *)
    Map[Function[Apply[Plus,Flatten[ #1]]], CellularAutomaton[90,{{1},0},100]] (* Produces counts of ON cells. N. J. A. Sloane, Aug 10 2009 *)
    ArrayPlot[CellularAutomaton[90, {{1}, 0}, 20]] (* Illustration of first 20 generations. - N. J. A. Sloane, Aug 14 2014 *)
    Table[2^(RealDigits[n - 1, 2][[1]] // Total), {n, 1, 100}] (* Gabriel C. Benamy, Dec 08 2009 *)
    CoefficientList[Series[Exp[2*x], {x, 0, 100}], x] // Numerator (* Jean-François Alcover, Oct 25 2013 *)
    Count[#,?OddQ]&/@Table[Binomial[n,k],{n,0,90},{k,0,n}] (* _Harvey P. Dale, Sep 22 2015 *)
    2^DigitSum[Range[0, 100], 2] (* Paolo Xausa, Jul 31 2025 *)
  • PARI
    {a(n) = if( n<0, 0, numerator(2^n / n!))};
    
  • PARI
    A001316(n)=1<M. F. Hasler, May 03 2009
    
  • PARI
    a(n)=2^hammingweight(n) \\ Charles R Greathouse IV, Jan 04 2013
    
  • Python
    def A001316(n):
        return 2**bin(n)[2:].count("1") # Indranil Ghosh, Feb 06 2017
    
  • Python
    def A001316(n): return 1<Karl-Heinz Hofmann, Aug 01 2025
    
  • Python
    import numpy # (version >= 2.0.0)
    n_up_to = 2**22
    A000079 = 1 << numpy.arange(n_up_to.bit_length())
    A001316 = A000079[numpy.bitwise_count(numpy.arange(n_up_to))]
    print(A001316[0:100]) # Karl-Heinz Hofmann, Aug 01 2025
    
  • Scheme
    (define (A001316 n) (let loop ((n n) (z 1)) (cond ((zero? n) z) ((even? n) (loop (/ n 2) z)) (else (loop (/ (- n 1) 2) (* z 2)))))) ;; Antti Karttunen, May 29 2017

Formula

a(n) = 2^A000120(n).
a(0) = 1; for n > 0, write n = 2^i + j where 0 <= j < 2^i; then a(n) = 2*a(j).
a(n) = 2*a(n-1)/A006519(n) = A000079(n)*A049606(n)/A000142(n).
a(n) = A038573(n) + 1.
G.f.: Product_{k>=0} (1+2*z^(2^k)). - Ralf Stephan, Apr 06 2003
a(n) = Sum_{i=0..2*n} (binomial(2*n, i) mod 2)*(-1)^i. - Benoit Cloitre, Nov 16 2003
a(n) mod 3 = A001285(n). - Benoit Cloitre, May 09 2004
a(n) = 2^n - 2*Sum_{k=0..n} floor(binomial(n, k)/2). - Paul Barry, Dec 24 2004
a(n) = Product_{k=0..log_2(n)} 2^b(n, k), b(n, k) = coefficient of 2^k in binary expansion of n. - Paul D. Hanna
Sum_{k=0..n-1} a(k) = A006046(n).
a(n) = n/2 + 1/2 + (1/2)*Sum_{k=0..n} (-(-1)^binomial(n,k)). - Stephen Crowley, Mar 21 2007
G.f. for a(n)/A156769(n): (1/2)*z^(1/2)*sinh(2*z^(1/2)). - Johannes W. Meijer, Feb 20 2009
Equals infinite convolution product of [1,2,0,0,0,0,0,0,0] aerated (A000079 - 1) times, i.e., [1,2,0,0,0,0,0,0,0] * [1,0,2,0,0,0,0,0,0] * [1,0,0,0,2,0,0,0,0]. - Mats Granvik, Gary W. Adamson, Oct 02 2009
a(n) = f(n, 1) with f(x, y) = if x = 0 then y otherwise f(floor(x/2), y*(1 + x mod 2)). - Reinhard Zumkeller, Nov 21 2009
a(n) = 2^(number of 1's in binary form of (n-1)). - Gabriel C. Benamy, Dec 08 2009
a((2*n+1)*2^p-1) = (2^p)*a(n), p >= 0. - Johannes W. Meijer, Jun 05 2011
a(n) = A000120(A001317(n)). - Reinhard Zumkeller, Nov 24 2012
a(n) = A226078(n,1). - Reinhard Zumkeller, May 25 2013
a(n) = lcm(n!, 2^n) / n!. - Daniel Suteu, Apr 28 2017
a(n) = A061142(A005940(1+n)). - Antti Karttunen, May 29 2017
a(0) = 1, a(2*n) = a(n), a(2*n+1) = 2*a(n). - Daniele Parisse, Feb 15 2024
a(n*m) <= a(n)^A000120(m). - Joe Amos, Mar 27 2025

Extensions

Additional comments from Henry Bottomley, Mar 12 2001
Further comments from N. J. A. Sloane, May 30 2009

A027649 a(n) = 2*(3^n) - 2^n.

Original entry on oeis.org

1, 4, 14, 46, 146, 454, 1394, 4246, 12866, 38854, 117074, 352246, 1058786, 3180454, 9549554, 28665046, 86027906, 258149254, 774578834, 2323998646, 6972520226, 20918609254, 62757924914, 188277969046, 564842295746, 1694543664454, 5083664547794, 15251060752246
Offset: 0

Views

Author

Keywords

Comments

Poly-Bernoulli numbers B_n^(k) with k=-2.
Binomial transform of A007051, if both sequences start at 0. Binomial transform of A000225(n+1). - Paul Barry, Mar 24 2003
Euler expands (1-z)/(1-5z+6z^2) and finds the general term. Section 226 of the Introductio indicates that he could have written down the recursion relation: a(n) = 5 a(n-1)-6 a(n-2). - V. Frederick Rickey (fred-rickey(AT)usma.edu), Feb 10 2006
Let R be a binary relation on the power set P(A) of a set A having n = |A| elements such that for every element x, y of P(A), xRy if x is a subset of y or y is a subset of x. Then a(n) = |R|. - Ross La Haye, Dec 22 2006
With regard to the comment by Ross La Haye: For proper subsets see A056182. - For nonempty subsets see A091344. - For nonempty proper subsets see a(n+1) in A260217. - Manfred Boergens, Aug 02 2023
If x, y are two n-bit binary strings then a(n) gives the number of pairs (x,y) such that XOR(x, y) = ABS(x - y). - Ramasamy Chandramouli, Feb 15 2009
Equals row sums of the triangular version of A038573. - Gary W. Adamson, Jun 04 2009
Inverse binomial transform of A085350. - Paul Curtz, Nov 14 2009
Related to the number of even a's in a nontrivial cycle (should one exist) in the 3x+1 Problem, where a <= floor(log_2(2*(3^n) - 2^n)). The value n correlates to the number of odds in such a nontrivial cycle. See page 1288 of Crandall's paper. Also, this relation gives another proof that the number of odds divided by the number of evens in a nontrivial cycle is bounded by log 2 / log 3 (this observation does not resolve the finite cycles conjecture as the value could be arbitrarily close to this bound). However, the same argument gives that log 2 / log 3 is less than or equal to the number of odds divided by the number of evens in a divergent sequence (should one exist), as log 2 / log 3 is the limit value for a cycle of an arbitrarily large length, where the length is given by the value n. - Jeffrey R. Goodwin, Aug 04 2011
Row sums of Riordan triangle A106516. - Wolfdieter Lang, Jan 09 2015
Number of restricted barred preferential arrangements having 3 bars in which the sections are all restricted sections such that (for fixed sections i and j) section i or section j is empty. - Sithembele Nkonkobe, Oct 12 2015
This is also row 2 of A281891: for n >= 1, when consecutive positive integers are written as a product of primes in nondecreasing order, a factor of 2 or 3 occurs in n-th position a(n) times out of every 6^n. - Peter Munn, May 18 2017
Also row sums of A124929. - Omar E. Pol, Jun 15 2017
This is the sum of A318921(n) for n in the range 2^(k+1) to 2^(k+2)-1. See A318921 for proof. - N. J. A. Sloane, Sep 25 2018
a(n) is also the number of acyclic orientations of the complete bipartite graph K_{2,n}. - Vincent Pilaud, Sep 15 2020
a(n-1) is also the number of n-digit numbers whose largest decimal digit is 2. - Stefano Spezia, Nov 15 2023

References

  • Leonhard Euler, Introductio in analysin infinitorum (1748), section 216.

Crossrefs

Row n = 2 of array A099594.
Also occurs as a row, column, diagonal or as row sums in A038573, A085870, A090888, A106516, A217764, A281891.

Programs

  • Haskell
    a027649 n = a027649_list !! n
    a027649_list = map fst $ iterate (\(u, v) -> (3 * u + v, 2 * v)) (1, 1)
    -- Reinhard Zumkeller, Jun 09 2013
    
  • Magma
    [2*(3^n)-2^n: n in [0..30]]; // Vincenzo Librandi, Jul 17 2011
    
  • Maple
    a(n, k):= (-1)^n*sum( (-1)^'m'*'m'!*Stirling2(n,'m')/('m'+1)^k,'m'=0..n);
    seq(a(n, -2), n=0..30);
  • Mathematica
    Table[2(3^n)-2^n,{n,0,30}] (* or *) LinearRecurrence[ {5,-6},{1,4},31]  (* Harvey P. Dale, Apr 22 2011 *)
  • PARI
    a(n)=2*(3^n)-2^n \\ Charles R Greathouse IV, Jul 16 2011
    
  • PARI
    Vec((1-x)/((1-2*x)*(1-3*x)) + O(x^50)) \\ Altug Alkan, Oct 12 2015
    
  • SageMath
    [2*(3^n - 2^(n-1)) for n in (0..30)] # G. C. Greubel, Aug 01 2022

Formula

G.f.: (1-x)/((1-2*x)*(1-3*x)).
a(n) = 3*a(n-1) + 2^(n-1), with a(0) = 1.
a(n) = Sum_{k=0..n} binomial(n, k)*(2^(k+1) - 1). - Paul Barry, Mar 24 2003
Partial sums of A053581. - Paul Barry, Jun 26 2003
Main diagonal of array (A085870) defined by T(i, 1) = 2^i - 1, T(1, j) = 2^j - 1, T(i, j) = T(i-1, j) + T(i-1, j-1). - Benoit Cloitre, Aug 05 2003
a(n) = A090888(n, 3). - Ross La Haye, Sep 21 2004
a(n) = Sum_{k=0..n} binomial(n+2, k+1)*Sum_{j=0..floor(k/2)} A001045(k-2j). - Paul Barry, Apr 17 2005
a(n) = Sum_{k=0..n} Sum_{j=0..n} binomial(n,j)*binomial(j+1,k+1). - Paul Barry, Sep 18 2006
a(n) = A166060(n+1)/6. - Philippe Deléham, Oct 21 2009
a(n) = 5*a(n-1) - 6*a(n-2), a(0)=1, a(1)=4. - Harvey P. Dale, Apr 22 2011
a(n) = A217764(n,2). - Ross La Haye, Mar 27 2013
For n>0, a(n) = 3 * a(n-1) + 2^(n-1) = 2 * (a(n-1) + 3^(n-1)). - J. Conrad, Oct 29 2015
for n>0, a(n) = 2 * (1 + 2^(n-2) + Sum_{x=1..n-2} Sum_{k=0..x-1} (binomial(x-1,k)*(2^(k+1) + 2^(n-x+k)))). - J. Conrad, Dec 10 2015
E.g.f.: exp(2*x)*(2*exp(x) - 1). - Stefano Spezia, May 18 2024

Extensions

Better formulas from David W. Wilson and Michael Somos
Incorrect formula removed by Charles R Greathouse IV, Mar 18 2010
Duplications (due to corrections to A numbers) removed by Peter Munn, Jun 15 2017

A135416 a(n) = A036987(n)*(n+1)/2.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, based on a message from Guy Steele and Don Knuth, Mar 01 2008

Keywords

Comments

Guy Steele defines a family of 36 integer sequences, denoted here by GS(i,j) for 1 <= i, j <= 6, as follows. a[1]=1; a[2n] = i-th term of {0,1,a[n],a[n]+1,2a[n],2a[n]+1}; a[2n+1] = j-th term of {0,1,a[n],a[n]+1,2a[n],2a[n]+1}. The present sequence is GS(1,5).
The full list of 36 sequences:
GS(1,1) = A000007
GS(1,2) = A000035
GS(1,3) = A036987
GS(1,4) = A007814
GS(1,5) = A135416 (the present sequence)
GS(1,6) = A135481
GS(2,1) = A135528
GS(2,2) = A000012
GS(2,3) = A000012
GS(2,4) = A091090
GS(2,5) = A135517
GS(2,6) = A135521
GS(3,1) = A036987
GS(3,2) = A000012
GS(3,3) = A000012
GS(3,4) = A000120
GS(3,5) = A048896
GS(3,6) = A038573
GS(4,1) = A135523
GS(4,2) = A001511
GS(4,3) = A008687
GS(4,4) = A070939
GS(4,5) = A135529
GS(4,6) = A135533
GS(5,1) = A048298
GS(5,2) = A006519
GS(5,3) = A080100
GS(5,4) = A087808
GS(5,5) = A053644
GS(5,6) = A000027
GS(6,1) = A135534
GS(6,2) = A038712
GS(6,3) = A135540
GS(6,4) = A135542
GS(6,5) = A054429
GS(6,6) = A003817
(with a(0)=1): Moebius transform of A038712.

Crossrefs

Equals A048298(n+1)/2. Cf. A036987, A182660.

Programs

  • Maple
    GS:=proc(i,j,M) local a,n; a:=array(1..2*M+1); a[1]:=1;
    for n from 1 to M do
    a[2*n] :=[0,1,a[n],a[n]+1,2*a[n],2*a[n]+1][i];
    a[2*n+1]:=[0,1,a[n],a[n]+1,2*a[n],2*a[n]+1][j];
    od: a:=convert(a,list); RETURN(a); end;
    GS(1,5,200):
  • Mathematica
    i = 1; j = 5; Clear[a]; a[1] = 1; a[n_?EvenQ] := a[n] = {0, 1, a[n/2], a[n/2]+1, 2*a[n/2], 2*a[n/2]+1}[[i]]; a[n_?OddQ] := a[n] = {0, 1, a[(n-1)/2], a[(n-1)/2]+1, 2*a[(n-1)/2], 2*a[(n-1)/2]+1}[[j]]; Array[a, 105] (* Jean-François Alcover, Sep 12 2013 *)
  • PARI
    A048298(n) = if(!n,0,if(!bitand(n,n-1),n,0));
    A135416(n) = (A048298(n+1)/2); \\ Antti Karttunen, Jul 22 2018
    
  • Python
    def A135416(n): return int(not(n&(n+1)))*(n+1)>>1 # Chai Wah Wu, Jul 06 2022

Formula

G.f.: sum{k>=1, 2^(k-1)*x^(2^k-1) }.
Recurrence: a(2n+1) = 2a(n), a(2n) = 0, starting a(1) = 1.

Extensions

Formulae and comments by Ralf Stephan, Jun 20 2014

A073138 Largest number having in its binary representation the same number of 0's and 1's as n.

Original entry on oeis.org

0, 1, 2, 3, 4, 6, 6, 7, 8, 12, 12, 14, 12, 14, 14, 15, 16, 24, 24, 28, 24, 28, 28, 30, 24, 28, 28, 30, 28, 30, 30, 31, 32, 48, 48, 56, 48, 56, 56, 60, 48, 56, 56, 60, 56, 60, 60, 62, 48, 56, 56, 60, 56, 60, 60, 62, 56, 60, 60, 62, 60, 62, 62, 63, 64, 96, 96, 112, 96, 112, 112
Offset: 0

Views

Author

Reinhard Zumkeller, Jul 16 2002

Keywords

Comments

From Trevor Green (green(AT)snoopy.usask.ca), Nov 26 2003: (Start)
a(n)/n has an accumulation point at x exactly when x is in the interval [1, 2]. Proof: Clearly n <= a(n) < 2n. Let b(n) = a(n)/n, then b(n) must always lie in [1,2) and all the accumulation points of the sequence must lie in [1,2]. We shall show that every such number is an accumulation point.
First, consider any d-bit integer n. Suppose that z of these bits are 0. Let n' be the (d+z)-bit integer whose first d bits are the same as those of n and whose remaining bits are all 1. Then a(n') will have to be the (d+z)-bit integer whose first d bits are all 1 and whose last z bits are all 0.
Thus n' = (n+1)*2^z-1; a(n') = (2^d-1)2^z; and b(n') = (2^d-1)/(n+1) + epsilon, where 0 < epsilon < 2^(1-d). So to get an accumulation point x, we just choose n(d) to be the d-bit integer such that (2^d-1)/(n(d)+1) < x <= (2^d-1)/n(d), or equivalently, n(d) = floor((2^d-1)/x). If x lies in [1,2), then n(d) will always be a d-bit number for sufficiently large d.
Then n'(d) yields an increasing subsequence of the integers for which b(n'(d)) converges to x. For x = 2, choose n(d) = 2^(d-1), which is always a d-bit number; then b(n'(d)) = (2^d-1)/(2^(d-1)+1) + epsilon = 2 + epsilon', where epsilon' also heads for 0 as d blows up. This proves the claim.
(End)

Examples

			a(20)=24, as 20='10100' and 24 is the greatest number having two 1's and three 0's: 17='10001', 18='10010', 20='10100' and 24='11000'.
		

Crossrefs

Cf. A030109.
Cf. A038573.
Decimal equivalent of A221714. - N. J. A. Sloane, Jan 26 2013

Programs

  • Haskell
    a073138 n = a038573 n * a080100 n  -- Reinhard Zumkeller, Jan 16 2012
    
  • Maple
    a:= n-> Bits[Join](sort(Bits[Split](n))):
    seq(a(n), n=0..100);  # Alois P. Heinz, Jun 26 2021
  • Mathematica
    f[n_] := Module[{idn=IntegerDigits[n, 2], o, l}, l=Length[idn]; o=Count[idn, 1]; FromDigits[Join[Table[1, {o}], Table[0, {l-o}]], 2]]; Table[f[i], {i, 0, 70}]
    ln[n_] := Module[{idn=IntegerDigits[n, 2], len, zer}, len=Length[idn]; zer=Count[idn, 0]; FromDigits[Join[Table[1, {len-zer}], Table[0, {zer}]], 2]]; Table[ln[i], {i, 0, 70}]
    a[z_] := 2^(Floor[Log[2, z]] + 1) * (1 - 2^(-Sum[k, {k, IntegerDigits[n, 2]}])) Column[Table[a[p], {p, 500}], Right] (* Trevor G. Hyde (thyde12(AT)amherst.edu), Jul 14 2008 *)
    Table[FromDigits[ReverseSort[IntegerDigits[n,2]],2],{n,0,70}] (* Harvey P. Dale, Mar 13 2023 *)
  • PARI
    a(n) = fromdigits(vecsort(binary(n),,4), 2); \\ Michel Marcus, Sep 26 2018
    
  • Python
    def a(n): return int("".join(sorted(bin(n)[2:], reverse=True)), 2)
    print([a(n) for n in range(71)]) # Michael S. Branicky, Jun 27 2021
    
  • Python
    def A073138(n): return (m:=1<>n.bit_count()) # Chai Wah Wu, Aug 18 2025

Formula

a(n+1) = a(floor(n/2))*2 + (n mod 2)*(2^floor(log_2(n)) - a(floor(n/2))); a(0)=0.
A023416(a(n)) = A023416(n), A000120(a(n)) = A000120(n).
a(0)=0, a(1)=1, a(2n) = 2a(n), a(2n+1) = a(n) + 2^floor(log_2(n)). - Ralf Stephan, Oct 05 2003
a(n) = 2^(floor(log_2(n)) + 1) * (1 - 2^(-d(n))) where d(n) = digit sum of base-2 expansion of n. - Trevor G. Hyde (thyde12(AT)amherst.edu), Jul 14 2008
a(n) = A038573(n) * A080100(n). - Reinhard Zumkeller, Jan 16 2012
n <= a(n) < 2n. - Charles R Greathouse IV, Aug 07 2024

A267700 "Tree" sequence in a 90-degree sector of the cellular automaton of A160720.

Original entry on oeis.org

0, 1, 2, 5, 6, 9, 12, 19, 20, 23, 26, 33, 36, 43, 50, 65, 66, 69, 72, 79, 82, 89, 96, 111, 114, 121, 128, 143, 150, 165, 180, 211, 212, 215, 218, 225, 228, 235, 242, 257, 260, 267, 274, 289, 296, 311, 326, 357, 360, 367, 374, 389, 396, 411, 426, 457, 464, 479, 494, 525, 540, 571, 602, 665, 666, 669, 672, 679, 682, 689
Offset: 0

Views

Author

Omar E. Pol, Jan 19 2016

Keywords

Comments

Conjecture: this is also the "tree" sequence in a 120-degree sector of the cellular automaton of A266532.
It appears that this is also the partial sums of A038573.
a(n) is also the total number of ON cells after n-th stage in the tree that arises from one of the four spokes in a 90-degree sector of the cellular automaton A160720 on the square grid.
Note that the structure of A160720 is also the "outward" version of the Ulam-Warburton cellular automaton of A147562.
It appears that A038573 gives the number of cells turned ON at n-th stage.
Conjecture: a(n) is also the total number of Y-toothpicks after n-th stage in the tree that arises from one of the three spokes in a 120-degree sector of the cellular automaton of A266532 on the triangular grid.
Note that the structure of A266532 is also the "outward" version of the Y-toothpick cellular automaton of A160120.
It appears that A038573 also gives the number of Y-toothpicks added at n-th stage.
Comment from N. J. A. Sloane, Jan 23 2016: All the above conjectures are true!
From Gus Wiseman, Mar 31 2019: (Start)
a(n) is also the number of nondecreasing binary-containment pairs of positive integers up to n. A pair of positive integers is a binary containment if the positions of 1's in the reversed binary expansion of the first are a subset of the positions of 1's in the reversed binary expansion of the second. For example, the a(1) = 1 through a(6) = 12 pairs are:
(1,1) (1,1) (1,1) (1,1) (1,1) (1,1)
(2,2) (1,3) (1,3) (1,3) (1,3)
(2,2) (2,2) (1,5) (1,5)
(2,3) (2,3) (2,2) (2,2)
(3,3) (3,3) (2,3) (2,3)
(4,4) (3,3) (2,6)
(4,4) (3,3)
(4,5) (4,4)
(5,5) (4,5)
(4,6)
(5,5)
(6,6)
(End)

Crossrefs

Programs

  • Mathematica
    Accumulate[Table[2^DigitCount[n,2,1]-1,{n,0,30}]] (* based on conjecture confirmed by Sloane, Gus Wiseman, Mar 31 2019 *)

Formula

a(n) = (A160720(n+1) - 1)/4.
Conjecture 1: a(n) = (A266532(n+1) - 1)/3.
Conjecture 2: a(n) = A160720(n+1) - A266532(n+1).
All of the above conjectures are true. - N. J. A. Sloane, Jan 23 2016
(Conjecture) a(n) = A267610(n) + n. - Gus Wiseman, Mar 31 2019
Showing 1-10 of 39 results. Next