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

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

A163511 a(0)=1. a(n) = p(A000120(n)) * Product_{m=1..A000120(n)} p(m)^A163510(n,m), where p(m) is the m-th prime.

Original entry on oeis.org

1, 2, 4, 3, 8, 9, 6, 5, 16, 27, 18, 25, 12, 15, 10, 7, 32, 81, 54, 125, 36, 75, 50, 49, 24, 45, 30, 35, 20, 21, 14, 11, 64, 243, 162, 625, 108, 375, 250, 343, 72, 225, 150, 245, 100, 147, 98, 121, 48, 135, 90, 175, 60, 105, 70, 77, 40, 63, 42, 55, 28, 33, 22, 13, 128
Offset: 0

Views

Author

Leroy Quet, Jul 29 2009

Keywords

Comments

This is a permutation of the positive integers.
From Antti Karttunen, Jun 20 2014: (Start)
Note the indexing: the domain starts from 0, while the range excludes zero, thus this is neither a bijection on the set of nonnegative integers nor on the set of positive natural numbers, but a bijection from the former set to the latter.
Apart from that discrepancy, this could be viewed as yet another "entanglement permutation" where the two complementary pairs to be interwoven together are even and odd numbers (A005843/A005408) which are entangled with the complementary pair even numbers (taken straight) and odd numbers in the order they appear in A003961: (A005843/A003961). See also A246375 which has almost the same recurrence.
Note how the even bisection halved gives the same sequence back. (For a(0)=1, take ceiling of 1/2).
(End)
From Antti Karttunen, Dec 30 2017: (Start)
This irregular table can be represented as a binary tree. Each child to the left is obtained by doubling the parent, and each child to the right is obtained by applying A003961 to the parent:
1
|
...................2...................
4 3
8......../ \........9 6......../ \........5
/ \ / \ / \ / \
/ \ / \ / \ / \
/ \ / \ / \ / \
16 27 18 25 12 15 10 7
32 81 54 125 36 75 50 49 24 45 30 35 20 21 14 11
etc.
Sequence A005940 is obtained by scanning the same tree level by level in mirror image fashion. Also in binary trees A253563 and A253565 the terms on level of the tree are some permutation of the terms present on the level n of this tree. A252464(n) gives the distance of n from 1 in all these trees, and A252463 gives the parent of the node containing n.
A252737(n) gives the sum and A252738(n) the product of terms on row n (where 1 is on row 0, 1 on row 1, 3 and 4 on row 2, etc.). A252745(n) gives the number of nodes on level n whose left child is smaller than the right child, and A252744(n) is an indicator function for those nodes.
(End)
Note that the idea behind maps like this (and the mirror image A005940) admits also using alternative orderings of primes, not just standard magnitude-wise ordering (A000040). For example, A332214 is a similar sequence but with primes rearranged as in A332211, and A332817 is obtained when primes are rearranged as in A108546. - Antti Karttunen, Mar 11 2020
From Lorenzo Sauras Altuzarra, Nov 28 2020: (Start)
This sequence is generated from A228351 by applying the following procedure: 1) eliminate the compositions that end in one unless the first one, 2) subtract one unit from every component, 3) replace every tuple [t_1, ..., t_r] by Product_{k=1..r} A000040(k)^(t_k) (see the examples).
Is it true that a(n) = A337909(n+1) if and only if a(n+1) is not a term of A161992?
Does this permutation have any other cycle apart from (1), (2) and (6, 9, 16, 7)? (End)
From Antti Karttunen, Jul 25 2023: (Start)
(In the above question, it is assumed that the starting offset would be 1 instead of 0).
Questions:
Does a(n) = 1+A054429(n) hold only when n is of the form 2^k times 1, 3 or 7, i.e., one of the terms of A029748?
It seems that A007283 gives all fixed points of map n -> a(n), like A335431 seems to give all fixed points of map n -> A332214(n). Is there a general rule for mappings like these that the fixed points (if they exist) must be of the form 2^k times a certain kind of prime, i.e., that any odd composite (times 2^k) can certainly be excluded? See also note in A029747.
(End)
If the conjecture given in A364297 holds, then it implies the above conjecture about A007283. See also A364963. - Antti Karttunen, Sep 06 2023
Conjecture: a(n^k) is never of the form x^k, for any integers n > 0, k > 1, x >= 1. This holds at least for squares, cubes, seventh and eleventh powers (see A365808, A365801, A366287 and A366391). - Antti Karttunen, Sep 24 2023, Oct 10 2023.
See A365805 for why the above holds for any n^k, with k > 1. - Antti Karttunen, Nov 23 2023

Examples

			For n=3, whose binary representation is "11", we have A000120(3)=2, with A163510(3,1) = A163510(3,2) = 0, thus a(3) = p(2) * p(1)^0 * p(2)^0 = 3*1*1 = 3.
For n=9, "1001" in binary, we have A000120(9)=2, with A163510(9,1) = 0 and A163510(9,2) = 2, thus a(9) = p(2) * p(1)^0 * p(2)^2 = 3*1*9 = 27.
For n=10, "1010" in binary, we have A000120(10)=2, with A163510(10,1) = 1 and A163510(10,2) = 1, thus a(10) = p(2) * p(1)^1 * p(2)^1 = 3*2*3 = 18.
For n=15, "1111" in binary, we have A000120(15)=4, with A163510(15,1) = A163510(15,2) = A163510(15,3) = A163510(15,4) = 0, thus a(15) = p(4) * p(1)^0 * p(2)^0 * p(3)^0 * p(4)^0 = 7*1*1*1*1 = 7.
[1], [2], [1,1], [3], [1,2], [2,1] ... -> [1], [2], [3], [1,2], ... -> [0], [1], [2], [0,1], ... -> 2^0, 2^1, 2^2, 2^0*3^1, ... = 1, 2, 4, 3, ... - _Lorenzo Sauras Altuzarra_, Nov 28 2020
		

Crossrefs

Inverse: A243071.
Cf. A007283 (known positions where a(n)=n), A029747, A029748, A364255 [= gcd(n,a(n))], A364258 [= a(n)-n], A364287 (where a(n) < n), A364292 (where a(n) <= n), A364494 (where n|a(n)), A364496 (where a(n)|n), A364963, A364297.
Cf. A365808 (positions of squares), A365801 (of cubes), A365802 (of fifth powers), A365805 [= A052409(a(n))], A366287, A366391.
Cf. A005940, A332214, A332817, A366275 (variants).

Programs

  • Mathematica
    f[n_] := Reverse@ Map[Ceiling[(Length@ # - 1)/2] &, DeleteCases[Split@ Join[Riffle[IntegerDigits[n, 2], 0], {0}], {k__} /; k == 1]]; {1}~Join~
    Table[Function[t, Prime[t] Product[Prime[m]^(f[n][[m]]), {m, t}]][DigitCount[n, 2, 1]], {n, 120}] (* Michael De Vlieger, Jul 25 2016 *)
  • Python
    from sympy import prime
    def A163511(n):
        if n:
            k, c, m = n, 0, 1
            while k:
                c += 1
                m *= prime(c)**(s:=(~k&k-1).bit_length())
                k >>= s+1
            return m*prime(c)
        return 1 # Chai Wah Wu, Jul 17 2023

Formula

For n >= 1, a(2n) is even, a(2n+1) is odd. a(2^k) = 2^(k+1), for all k >= 0.
From Antti Karttunen, Jun 20 2014: (Start)
a(0) = 1, a(1) = 2, a(2n) = 2*a(n), a(2n+1) = A003961(a(n)).
As a more general observation about the parity, we have:
For n >= 1, A007814(a(n)) = A135523(n) = A007814(n) + A209229(n). [This permutation preserves the 2-adic valuation of n, except when n is a power of two, in which cases that value is incremented by one.]
For n >= 1, A055396(a(n)) = A091090(n) = A007814(n+1) + 1 - A036987(n).
For n >= 1, a(A000225(n)) = A000040(n).
(End)
From Antti Karttunen, Oct 11 2014: (Start)
As a composition of related permutations:
a(n) = A005940(1+A054429(n)).
a(n) = A064216(A245612(n))
a(n) = A246681(A246378(n)).
Also, for all n >= 0, it holds that:
A161511(n) = A243503(a(n)).
A243499(n) = A243504(a(n)).
(End)
More linking identities from Antti Karttunen, Dec 30 2017: (Start)
A046523(a(n)) = A278531(n). [See also A286531.]
A278224(a(n)) = A285713(n). [Another filter-sequence.]
A048675(a(n)) = A135529(n) seems to hold for n >= 1.
A250245(a(n)) = A252755(n).
A252742(a(n)) = A252744(n).
A245611(a(n)) = A253891(n).
A249824(a(n)) = A275716(n).
A292263(a(n)) = A292264(n). [A292944(n) + A292264(n) = n.]
--
A292383(a(n)) = A292274(n).
A292385(a(n)) = A292271(n). [A292271(n) + A292274(n) = n.]
--
A292941(a(n)) = A292942(n).
A292943(a(n)) = A292944(n).
A292945(a(n)) = A292946(n). [A292942(n) + A292944(n) + A292946(n) = n.]
--
A292253(a(n)) = A292254(n).
A292255(a(n)) = A292256(n). [A292944(n) + A292254(n) + A292256(n) = n.]
--
A279339(a(n)) = A279342(n).
a(A071574(n)) = A269847(n).
a(A279341(n)) = A279338(n).
a(A252756(n)) = A250246(n).
(1+A008836(a(n)))/2 = A059448(n).
(End)
From Antti Karttunen, Jul 26 2023: (Start)
For all n >= 0, a(A007283(n)) = A007283(n).
A001222(a(n)) = A290251(n).
(End)

Extensions

More terms computed and examples added by Antti Karttunen, Jun 20 2014

A049445 Numbers k with the property that the number of 1's in binary expansion of k (see A000120) divides k.

Original entry on oeis.org

1, 2, 4, 6, 8, 10, 12, 16, 18, 20, 21, 24, 32, 34, 36, 40, 42, 48, 55, 60, 64, 66, 68, 69, 72, 80, 81, 84, 92, 96, 108, 110, 115, 116, 120, 126, 128, 130, 132, 136, 138, 144, 155, 156, 160, 162, 168, 172, 180, 184, 185, 192, 204, 205, 212, 216, 220, 222, 228
Offset: 1

Views

Author

Keywords

Comments

If instead of base 2 we take base 10, then we have the so-called Harshad or Niven numbers (i.e., positive integers divisible by the sum of their digits; A005349). - Emeric Deutsch, Apr 11 2007
A199238(a(n)) = 0. - Reinhard Zumkeller, Nov 04 2011

Examples

			20 is in the sequence because 20 is written 10100 in binary and 1 + 1 = 2, which divides 20.
21 is in the sequence because 21 is written 10101 in binary and 1 + 1 + 1 = 3, which divides 21.
22 is not in the sequence because 22 is written 10110 in binary 1 + 1 + 1 = 3, which does not divide 22.
		

Crossrefs

Programs

  • Haskell
    a049445 n = a049445_list !! (n-1)
    a049445_list = map (+ 1) $ elemIndices 0 a199238_list
    -- Reinhard Zumkeller, Nov 04 2011
    
  • Maple
    a:=proc(n) local n2: n2:=convert(n,base,2): if n mod add(n2[i],i=1..nops(n2)) = 0 then n else fi end: seq(a(n),n=1..300); # Emeric Deutsch, Apr 11 2007
  • Mathematica
    binHarshadQ[n_] := Divisible[n, Count[IntegerDigits[n, 2], 1]]; Select[Range[228], binHarshadQ] (* Jean-François Alcover, Dec 01 2011 *)
    Select[Range[300],Divisible[#,DigitCount[#,2,1]]&] (* Harvey P. Dale, Mar 20 2016 *)
  • PARI
    for(n=1,1000,b=binary(n);l=length(b); if(n%sum(i=1,l, component(b,i))==0,print1(n,",")))
    
  • PARI
    is_A049445(n)={n%norml2(binary(n))==0} \\ M. F. Hasler, Oct 09 2012
    
  • PARI
    isok(n) = ! (n % hammingweight(n)); \\ Michel Marcus, Feb 10 2016
    
  • Python
    A049445 = [n for n in range(1,10**5) if not n % sum([int(d) for d in bin(n)[2:]])] # Chai Wah Wu, Aug 22 2014

Formula

{k : A000120(k) | k}. - R. J. Mathar, Mar 03 2008
a(n) seems to be asymptotic to c*n*log(n) where 0.7 < c < 0.8. - Benoit Cloitre, Jan 22 2003
Heuristically, c should be 1/(2*log(2)), since a random d-bit number should have probability approximately 2/d of being in the sequence. - Robert Israel, Aug 22 2014
{a(n)} = {k : A199238(k) = 0}. - M. F. Hasler, Oct 09 2012
De Koninck et al. (2003) proved that the number of base-b Niven numbers not exceeding x, N_b(x), is asymptotically equal to ((2*log(b)/(b-1)^2) * Sum_{j=1..b-1} gcd(j, b-1) + o(1)) * x/log(x). For b=2, N_2(n) ~ (2*log(2) + o(1)) * x/log(x). Therefore, the constant c mentioned above is indeed 1/(2*log(2)). - Amiram Eldar, Aug 16 2020

Extensions

More terms from Michael Somos
Edited by N. J. A. Sloane, Oct 07 2005 and May 16 2008

A048883 a(n) = 3^wt(n), where wt(n) = A000120(n).

Original entry on oeis.org

1, 3, 3, 9, 3, 9, 9, 27, 3, 9, 9, 27, 9, 27, 27, 81, 3, 9, 9, 27, 9, 27, 27, 81, 9, 27, 27, 81, 27, 81, 81, 243, 3, 9, 9, 27, 9, 27, 27, 81, 9, 27, 27, 81, 27, 81, 81, 243, 9, 27, 27, 81, 27, 81, 81, 243, 27, 81, 81, 243, 81, 243, 243, 729, 3, 9, 9, 27, 9, 27, 27, 81, 9, 27, 27, 81, 27, 81
Offset: 0

Views

Author

Keywords

Comments

Or, a(n)=number of 1's ("live" cells) at stage n of a 2-dimensional cellular automata evolving by the rule: 1 if NE+NW+S=1, else 0.
This is the odd-rule cellular automaton defined by OddRule 013 (see Ekhad-Sloane-Zeilberger "Odd-Rule Cellular Automata on the Square Grid" link). - N. J. A. Sloane, Feb 25 2015
Or, start with S=[1]; replace S by [S, 3*S]; repeat ad infinitum.
Fixed point of the morphism 1 -> 13, 3 -> 39, 9 -> 9(27), ... = 3^k -> 3^k 3^(k+1), ... starting from a(0) = 1; 1 -> 13 -> 1339 -> = 1339399(27) -> 1339399(27)399(27)9(27)(27)(81) -> ..., . - Robert G. Wilson v, Jan 24 2006
Equals row sums of triangle A166453 (the square of Sierpiński's gasket, A047999). - Gary W. Adamson, Oct 13 2009
First bisection of A169697=1,5,3,19,3,. a(2n+2)+a(2n+3)=12,12,36,=12*A147610 ? Distribution of terms (in A000244): A011782=1,A000079 for first array, A000079 for second. - Paul Curtz, Apr 20 2010
a(A000225(n)) = A000244(n) and a(m) != A000244(n) for m < A000225(n). - Reinhard Zumkeller, Nov 14 2011
This sequence pertains to phenotype Punnett square mathematics. Start with X=1. Each hybrid cross involves the equation X:3X. Therefore, the ratio in the first (mono) hybrid cross is X=1:3X=3(1) or 3; or 3:1. When you move up to the next hybridization level, replace the previous cross ratio with X. X now represents 2 numbers-1:3. Therefore, the ratio in the second (di) hybrid cross is X=(1:3):3X=[3(1):3(3)] or (3:9). Put it together and you get 1:3:3:9. Each time you move up a hybridization level, replace the previous ratio with X, and use the same equation-X:3X to get its ratio. - John Michael Feuk, Dec 10 2011
Number of odd values in the n-th layer of Pascal's tetrahedron (see A268240). - Caden Le, Mar 03 2025
a(x*y) <= a(x)^A000120(y). - Joe Amos, Mar 28 2025

Examples

			From _Omar E. Pol_, Jun 07 2009: (Start)
Triangle begins:
  1;
  3;
  3,9;
  3,9,9,27;
  3,9,9,27,9,27,27,81;
  3,9,9,27,9,27,27,81,9,27,27,81,27,81,81,243;
  3,9,9,27,9,27,27,81,9,27,27,81,27,81,81,243,9,27,27,81,27,81,81,243,27,...
Or
  1;
  3,3;
  9,3,9,9;
  27,3,9,9,27,9,27,27;
  81,3,9,9,27,9,27,27,81,9,27,27,81,27,81,81;
  243,3,9,9,27,9,27,27,81,9,27,27,81,27,81,81,243,9,27,27,81,27,81,81,243,27...
(End)
		

Crossrefs

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.
A generalization of A001316. Cf. A102376.
Partial sums give A130665. - David Applegate, Jun 11 2009

Programs

  • Haskell
    a048883 = a000244 . a000120  -- Reinhard Zumkeller, Nov 14 2011
  • Mathematica
    Nest[ Join[#, 3#] &, {1}, 6] (* Robert G. Wilson v, Jan 24 2006 and modified Jul 27 2014*)
    a[n_] := 3^DigitCount[n, 2, 1]; Array[a, 80, 0] (* Jean-François Alcover, Nov 15 2017 *)
  • PARI
    a(n)=n=binary(n);3^sum(i=1,#n,n[i])
    

Formula

a(n) = Product_{k=0..log_2(n)} 3^b(n,k), where b(n,k) = coefficient of 2^k in binary expansion of n (offset 0). - Paul D. Hanna
a(n) = 3*a(n/2) if n is even, otherwise a(n) = a((n+1)/2).
G.f.: Product_{k>=0} (1+3*x^(2^k)). The generalization k^A000120 has generating function (1 + kx)*(1 + kx^2)*(1 + kx^4)*...
a(n+1) = Sum_{i=0..n} (binomial(n, i) mod 2) * Sum_{j=0..i} (binomial(i, j) mod 2). - Benoit Cloitre, Nov 16 2003
a(0)=1, a(n) = 3*a(n-A053644(n)) for n > 0. - Joe Slater, Jan 31 2016
G.f. A(x) satisfies: A(x) = (1 + 3*x) * A(x^2). - Ilya Gutkovskiy, Jul 09 2019

Extensions

Corrected by Ralf Stephan, Jun 19 2003
Entry revised by N. J. A. Sloane, May 30 2009
Offset changed to 0, Jun 11 2009

A048896 a(n) = 2^(A000120(n+1) - 1), n >= 0.

Original entry on oeis.org

1, 1, 2, 1, 2, 2, 4, 1, 2, 2, 4, 2, 4, 4, 8, 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, 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, 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
Offset: 0

Views

Author

Keywords

Comments

a(n) = 2^A048881 = 2^{maximal power of 2 dividing the n-th Catalan number (A000108)}. [Comment corrected by N. J. A. Sloane, Apr 30 2018]
Row sums of triangle A128937. - Philippe Deléham, May 02 2007
a(n) = sum of (n+1)-th row terms of triangle A167364. - Gary W. Adamson, Nov 01 2009
a(n), n >= 1: Numerators of Maclaurin series for 1 - ((sin x)/x)^2, A117972(n), n >= 2: Denominators of Maclaurin series for 1 - ((sin x)/x)^2, the correlation function in Montgomery's pair correlation conjecture. - Daniel Forgues, Oct 16 2011
For n > 0: a(n) = A007954(A007931(n)). - Reinhard Zumkeller, Oct 26 2012
a(n) = A261363(2*(n+1), n+1). - Reinhard Zumkeller, Aug 16 2015
From Gus Wiseman, Oct 30 2022: (Start)
Also the number of coarsenings of the (n+1)-th composition in standard order. The k-th composition in standard order (graded reverse-lexicographic, A066099) is obtained by taking the set of positions of 1's in the reversed binary expansion of k, prepending 0, taking first differences, and reversing again. This gives a bijective correspondence between nonnegative integers and integer compositions. See link for sequences related to standard compositions. For example, the a(10) = 4 coarsenings of (2,1,1) are: (2,1,1), (2,2), (3,1), (4).
Also the number of times n+1 appears in A357134. For example, 11 appears at positions 11, 20, 33, and 1024, so a(10) = 4.
(End)

Examples

			From _Omar E. Pol_, Jul 21 2009: (Start)
If written as a triangle:
  1;
  1,2;
  1,2,2,4;
  1,2,2,4,2,4,4,8;
  1,2,2,4,2,4,4,8,2,4,4,8,4,8,8,16;
  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;
  ...,
the first half-rows converge to Gould's sequence A001316.
(End)
		

Crossrefs

This is Guy Steele's sequence GS(3, 5) (see A135416).
Equals first right hand column of triangle A160468.
Equals A160469(n+1)/A002425(n+1).
Standard compositions are listed by A066099.
The opposite version (counting refinements) is A080100.
The version for Heinz numbers of partitions is A317141.

Programs

  • Haskell
    a048896 n = a048896_list !! n
    a048896_list = f [1] where f (x:xs) = x : f (xs ++ [x,2*x])
    -- Reinhard Zumkeller, Mar 07 2011
    
  • Haskell
    import Data.List (transpose)
    a048896 = a000079 . a000120
    a048896_list = 1 : concat (transpose
       [zipWith (-) (map (* 2) a048896_list) a048896_list,
        map (* 2) a048896_list])
    -- Reinhard Zumkeller, Jun 16 2013
    
  • Magma
    [Numerator(2^n / Factorial(n+1)): n in [0..100]]; // Vincenzo Librandi, Apr 12 2014
  • Maple
    a := n -> 2^(add(i,i=convert(n+1,base,2))-1): seq(a(n), n=0..97); # Peter Luschny, May 01 2009
  • Mathematica
    NestList[Flatten[#1 /. a_Integer -> {a, 2 a}] &, {1}, 4] // Flatten (* Robert G. Wilson v, Aug 01 2012 *)
    Table[Numerator[2^n / (n + 1)!], {n, 0, 200}] (* Vincenzo Librandi, Apr 12 2014 *)
    Denominator[Table[BernoulliB[2*n] / (Zeta[2*n]/Pi^(2*n)), {n, 1, 100}]] (* Terry D. Grant, May 29 2017 *)
    Table[Denominator[((2 n)!/2^(2 n + 1)) (-1)^n], {n, 1, 100}]/4 (* Terry D. Grant, May 29 2017 *)
    2^IntegerExponent[CatalanNumber[Range[0,100]],2] (* Harvey P. Dale, Apr 30 2018 *)
  • PARI
    a(n)=if(n<1,1,if(n%2,a(n/2-1/2),2*a(n-1)))
    
  • PARI
    a(n) = 1 << (hammingweight(n+1)-1); \\ Kevin Ryde, Feb 19 2022
    

Formula

a(n) = 2^A048881(n).
a(n) = 2^k if 2^k divides A000108(n) but 2^(k+1) does not divide A000108(n).
It appears that a(n) = Sum_{k=0..n} binomial(2*(n+1), k) mod 2. - Christopher Lenard (c.lenard(AT)bendigo.latrobe.edu.au), Aug 20 2001
a(0) = 1; a(2*n) = 2*a(2*n-1); a(2*n+1) = a(n).
a(n) = (1/2) * A001316(n+1). - Mohammed Bouayoun (bouyao(AT)wanadoo.fr), Mar 26 2004
It appears that a(n) = Sum_{k=0..2n} floor(binomial(2n+2, k+1)/2)(-1)^k = 2^n - Sum_{k=0..n+1} floor(binomial(n+1, k)/2). - Paul Barry, Dec 24 2004
a(n) = Sum_{k=0..n} (T(n,k) mod 2) where T = A039598, A053121, A052179, A124575, A126075, A126093. - Philippe Deléham, May 02 2007
a(n) = numerator(b(n)), where sin(x)^2/x = Sum_{n>0} b(n)*(-1)^n x^(2*n-1). - Vladimir Kruchinin, Feb 06 2013
a((2*n+1)*2^p-1) = A001316(n), p >= 0 and n >= 0. - Johannes W. Meijer, Feb 12 2013
a(n) = numerator(2^n / (n+1)!). - Vincenzo Librandi, Apr 12 2014
a(2n) = (2n+1)!/(n!n!)/A001803(n). - Richard Turk, Aug 23 2017
a(2n-1) = (2n-1)!/(n!(n-1)!)/A001790(n). - Richard Turk, Aug 23 2017

Extensions

New definition from N. J. A. Sloane, Mar 01 2008

A102376 a(n) = 4^A000120(n).

Original entry on oeis.org

1, 4, 4, 16, 4, 16, 16, 64, 4, 16, 16, 64, 16, 64, 64, 256, 4, 16, 16, 64, 16, 64, 64, 256, 16, 64, 64, 256, 64, 256, 256, 1024, 4, 16, 16, 64, 16, 64, 64, 256, 16, 64, 64, 256, 64, 256, 256, 1024, 16, 64, 64, 256, 64, 256, 256, 1024, 64, 256, 256, 1024, 256, 1024, 1024
Offset: 0

Views

Author

Paul Barry, Jan 05 2005

Keywords

Comments

Consider a simple cellular automaton, a grid of binary cells c(i,j), where the next state of the grid is calculated by applying the following rule to each cell: c(i,j) = ( c(i+1,j-1) + c(i+1,j+1) + c(i-1,j-1) + c(i-1,j+1) ) mod 2 If we start with a single cell having the value 1 and all the others 0, then the aggregate values of the subsequent states of the grid will be the terms in this sequence. - Andras Erszegi (erszegi.andras(AT)chello.hu), Mar 31 2006. See link for initial states. - N. J. A. Sloane, Feb 12 2015
This is the odd-rule cellular automaton defined by OddRule 033 (see Ekhad-Sloane-Zeilberger "Odd-Rule Cellular Automata on the Square Grid" link). - N. J. A. Sloane, Feb 25 2015
First differences of A116520. - Omar E. Pol, May 05 2010

Examples

			1 + 4*x + 4*x^2 + 16*x^3 + 4*x^4 + 16*x^5 + 16*x^6 + 64*x^7 + 4*x^8 + ...
From _Omar E. Pol_, Jun 07 2009: (Start)
Triangle begins:
  1;
  4;
  4,16;
  4,16,16,64;
  4,16,16,64,16,64,64,256;
  4,16,16,64,16,64,64,256,16,64,64,256,64,256,256,1024;
  4,16,16,64,16,64,64,256,16,64,64,256,64,256,256,1024,16,64,64,256,64,256,...
(End)
		

Crossrefs

For generating functions Prod_{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.
A151783 is a very similar sequence.
See A160239 for the analogous CA defined by Rule 204 on an 8-celled neighborhood.

Programs

  • Haskell
    a102376 = (4 ^) . a000120  -- Reinhard Zumkeller, Feb 13 2015
    
  • Maple
    seq(4^convert(convert(n,base,2),`+`),n=0..100); # Robert Israel, Apr 30 2017
  • Mathematica
    Table[4^DigitCount[n, 2, 1], {n, 0, 100}] (* Indranil Ghosh, Apr 30 2017 *)
  • PARI
    {a(n) = if( n<0, 0, 4^subst( Pol( binary(n)), x, 1))} /* Michael Somos, May 29 2008 */
    a(n) = 4^hammingweight(n); \\ Michel Marcus, Apr 30 2017
    
  • Python
    def a(n): return 4**bin(n)[2:].count("1") # Indranil Ghosh, Apr 30 2017
    
  • Python
    def A102376(n): return 1<<(n.bit_count()<<1) # Chai Wah Wu, Nov 15 2022

Formula

Formulas due to Paul D. Hanna: (Start)
G.f.: Product_{k>=0} 1 + 4x^(2^k).
a(n) = Product_{k=0..log_2(n)} 4^b(n, k), b(n, k)=coefficient of 2^k in binary expansion of n.
a(n) = Sum_{k=0..n} (C(n, k) mod 2)*3^A000120(n-k). (End)
a(n) = Sum_{k=0..n} (C(n, k) mod 2) * Sum_{j=0..k} (C(k, j) mod 2) * Sum_{i=0..j} (C(j, i) mod 2). - Paul Barry, Apr 01 2005
G.f. A(x) satisfies 0 = f(A(x), A(x^2), A(x^4)) where f(u, v, w) = w * (u^2 - 2*u*v + 5*v^2) - 4*v^3. - Michael Somos, May 29 2008
Run length transform of A000302. - N. J. A. Sloane, Feb 23 2015

A048881 a(n) = A000120(n+1) - 1 = wt(n+1) - 1.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Highest power of 2 dividing n-th Catalan number (A000108).
a(n) = 0 iff n = 2^k - 1, k=0,1,...
Appears to be number of binary left-rotations (iterations of A006257) to reach fixed point of form 2^k-1. Right-rotation analog is A063250. This would imply that for n >= 0, a(n)=f(n), recursively defined to be 0 for n=0, otherwise as f( ( (1-n)(1-p)(1-s) - (1-n-p-s) ) / 2) + p (s+1) / 2, where p = n mod 2 and s = - signum(n) (f(n<0) is A000120(-n)). - Marc LeBrun, Jul 11 2001
Let f(0) = 01, f(1) = 12, f(2) = 23, f(3) = 34, f(4) = 45, etc. Sequence gives concatenation of 0, f(0), f(f(0)), f(f(f(0))), ... Also f(f(...f(0)...)) converges to A000120. - Philippe Deléham, Aug 14 2003
C(n, k) is the number of occurrence of k in the n-th group of terms in this sequence read by rows: {0}; {0, 1}; {0, 1, 1, 2}; {0, 1, 1, 2, 1, 2, 2, 3}; {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 }; ... - Philippe Deléham, Jan 01 2004
Highest power of 2 dividing binomial(n,floor(n/2)). - Benoit Cloitre, Oct 20 2003
2^a(n) are numerators in the Maclaurin series for (sin x)^2. - Jacob A. Siehler, Nov 11 2009
Conjecture: a(n) is the sum of digits of the n-th word in A076478, for n >= 1; has been confirmed for n up to 20000. - Clark Kimberling, Jul 14 2021

Examples

			From _Omar E. Pol_, Mar 08 2011: (Start)
Sequence can be written in the following form (irregular triangle):
  0,
  0,1,
  0,1,1,2,
  0,1,1,2,1,2,2,3,
  0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,
  0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
  ...
Row sums are A001787.
(End)
		

Crossrefs

First differences of A078903.

Programs

  • Haskell
    a048881 n = a048881_list !! n
    a048881_list = c [0] where c (x:xs) = x : c (xs ++ [x,x+1])
    -- Reinhard Zumkeller, Mar 07 2011
    (Python 3.10+)
    def A048881(n): return (n+1).bit_count()-1 # Chai Wah Wu, Nov 15 2022
  • Maple
    A048881 := proc(n)
        A000120(n+1)-1 ;
    end proc:
    seq(A048881(n),n=0..200) ; # R. J. Mathar, Mar 12 2018
  • Mathematica
    a[n_] := IntegerExponent[ CatalanNumber[n], 2]; Table[a[n], {n, 0, 104}] (* Jean-François Alcover, Jun 21 2013 *)
  • PARI
    { a(n) = if( n<0, 0, n++; n /= 2^valuation(n,2); subst( Pol( binary( n ) ), x, 1) - 1 ) } /* Michael Somos, Aug 23 2007 */
    
  • PARI
    {a(n) = if( n<0, 0, valuation( (2*n)! / n! / (n+1)!, 2 ) ) } /* Michael Somos, Aug 23 2007 */
    
  • PARI
    a(n) = hammingweight(n+1) - 1; \\ Michel Marcus, Nov 15 2022
    

Formula

Writing n as 2^m+k with -1 <= k < 2^m-1, then a(n) = A000120(k+1). - Henry Bottomley, Mar 28 2000
a(n) = k if 2^k divides A000108(n) but 2^(k+1) does not divide A000108(n).
a(2*n) = a(n-1)+1, a(2*n+1) = a(n). - Vladeta Jovovic, Oct 10 2002
G.f.: (1/(x-x^2)) * (x^2/(1-x) - Sum_{k>=1} x^(2^k)/(1-x^(2^k))). - Ralf Stephan, Apr 13 2002
a(n) = A000120(A129760(n+1)). - Reinhard Zumkeller, Jun 30 2010
a(n+k) = A240857(n,k), 0 <= k <= n; in particular: a(n) = A240857(n,0). - Reinhard Zumkeller, Apr 14 2014
a(n) = (n+1)*2 - A101925(n+1). - Gleb Ivanov, Jan 12 2022

Extensions

Entry revised by N. J. A. Sloane, Jun 07 2009

A038573 a(n) = 2^A000120(n) - 1.

Original entry on oeis.org

0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, 3, 7, 7, 15, 7, 15, 15, 31
Offset: 0

Views

Author

Keywords

Comments

Essentially the same sequence as A001316, which has much more information, and also A159913. - N. J. A. Sloane, Jun 05 2009
Smallest number with same number of 1's in its binary expansion as n.
Fixed point of the morphism 0 -> 01, 1 -> 13, 3 -> 37, ... = k -> k, 2k+1, ... starting from a(0) = 0; 1 -> 01 -> 0113 -> 01131337 -> 011313371337377(15) -> ..., . - Robert G. Wilson v, Jan 24 2006
From Gary W. Adamson, Jun 04 2009: (Start)
As an infinite string, 2^n terms per row starting with "1": (1; 1,3; 1,3,3,7; 1,3,3,7,3,7,7,15; 1,3,3,7,3,7,7,15,3,7,7,15,7,15,15,31;...)
Row sums of that triangle = A027649: (1, 4, 14, 46, 454, ...); where the next row sum = current term of A027649 + next term in finite difference row of A027649, i.e., (1, 3, 10, 32, 100, 308, ...) = A053581. (End)
From Omar E. Pol, Jan 24 2016: (Start)
Partial sums give A267700.
a(n) is also the number of cells turned ON at n-th generation of the cellular automaton of A267700 in a 90-degree sector on the square grid.
a(n) is also the number of Y-toothpicks added at n-th generation of the structure of A267700 in a 120-degree sector on the triangular grid. (End)
Row sums of A090971. - Nikolaos Pantelidis, Nov 23 2022

Examples

			9 = 1001 -> 0011 -> 3, so a(9)=3.
From _Gary W. Adamson_, Jun 04 2009: (Start)
Triangle read by rows:
  1;
  1, 3;
  1, 3, 3, 7;
  1, 3, 3, 7, 3, 7, 7, 15;
  1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31;
  ...
Row sums: (1, 4, 14, 46, ...) = A027649 = last row terms + new set of terms such that row 3 = (1, 3, 3, 7,) + (3, 7, 7, 15) = 14 + 32 = A027649(2) + A053581(3). (End)
The rows of this triangle converge to A159913. - _N. J. A. Sloane_, Jun 05 2009
G.f. = x + x^2 + 3*x^3 + x^4 + 3*x^5 + 3*x^6 + 7*x^7 + x^8 + 3*x^9 + 3*x^10 + 7*x^11 + ... - _Michael Somos_, Jul 24 2023
		

Crossrefs

This is Guy Steele's sequence GS(3, 6) (see A135416).
Write n in b-ary, sort digits into increasing order: this sequence (b=2), A038574 (b=3), A319652 (b=4), A319653 (b=5), A319654 (b=6), A319655 (b=7), A319656 (b=8), A319657 (b=9), A004185 (b=10).
Column k=0 of A340666.

Programs

  • Haskell
    a038573 0 = 0
    a038573 n = (m + 1) * (a038573 n') + m where (n', m) = divMod n 2
    -- Reinhard Zumkeller, Oct 10 2012, Feb 07 2011
    (Python 3.10+)
    def A038573(n): return (1<Chai Wah Wu, Nov 15 2022
  • Maple
    seq(2^convert(convert(n,base,2),`+`)-1, n=0..100); # Robert Israel, Jan 24 2016
  • Mathematica
    Array[ 2^Count[ IntegerDigits[ #, 2 ], 1 ]-1&, 100 ]
    Nest[ Flatten[ # /. a_Integer -> {a, 2a + 1}] &, {0}, 7] (* Robert G. Wilson v, Jan 24 2006 *)
  • PARI
    {a(n) = 2^subst(Pol(binary(n)), x, 1) - 1};
    
  • PARI
    a(n) = 2^hammingweight(n)-1; \\ Michel Marcus, Jan 24 2016
    

Formula

a(2n) = a(n), a(2n+1) = 2*a(n)+1, a(0) = 0. a(n) = A001316(n)-1 = 2^A000120(n) - 1. - Daniele Parisse
a(n) = number of positive integers k < n such that n XOR k = n-k (cf. A115378). - Paul D. Hanna, Jan 21 2006
a(n) = f(n, 1) with f(x, y) = if x = 0 then y - 1 else f(floor(x/2), y*(1 + x mod 2)). - Reinhard Zumkeller, Nov 21 2009
a(n) = (n mod 2 + 1) * a(floor(n/2)) + n mod 2. - Reinhard Zumkeller, Oct 10 2012
a(n) = Sum_{i=1..n} C(n,i) mod 2. - Wesley Ivan Hurt, Nov 17 2017
G.f.: -1/(1 - x) + Product_{k>=0} (1 + 2*x^(2^k)). - Ilya Gutkovskiy, Aug 20 2019
G.f. A(x) = x + x^2*A(x) + (1 + 2*x)*(1 - x^2)*A(x^2). - Michael Somos, Jul 24 2023

Extensions

More terms from Erich Friedman
New definition from N. J. A. Sloane, Mar 01 2008

A092391 a(n) = n + wt(n), where wt(n) = A000120(n) = binary weight of n.

Original entry on oeis.org

0, 2, 3, 5, 5, 7, 8, 10, 9, 11, 12, 14, 14, 16, 17, 19, 17, 19, 20, 22, 22, 24, 25, 27, 26, 28, 29, 31, 31, 33, 34, 36, 33, 35, 36, 38, 38, 40, 41, 43, 42, 44, 45, 47, 47, 49, 50, 52, 50, 52, 53, 55, 55, 57, 58, 60, 59, 61, 62, 64, 64, 66, 67, 69, 65, 67, 68, 70, 70, 72, 73, 75
Offset: 0

Views

Author

Reinhard Zumkeller, May 08 2004

Keywords

Crossrefs

A010061 gives the numbers not occurring in this sequence. A228082 gives the terms of this sequence sorted into ascending order, with duplicates removed. A228085(n) gives the number of times n occurs in this sequence.

Programs

Formula

a(n) = n + A000120(n).
A010062(n+1) = a(A010062(n)).
G.f.: (1/(1 - x))*Sum_{k>=0} (2^k + 1)*x^(2^k)/(1 + x^(2^k)). - Ilya Gutkovskiy, Jul 23 2017

A294898 Deficiency minus binary weight: a(n) = A033879(n) - A000120(n) = A005187(n) - A000203(n).

Original entry on oeis.org

0, 0, 0, 0, 2, -2, 3, 0, 3, 0, 7, -6, 9, 1, 2, 0, 14, -5, 15, -4, 7, 5, 18, -14, 16, 7, 10, -3, 24, -16, 25, 0, 16, 12, 19, -21, 33, 13, 18, -12, 37, -15, 38, 1, 8, 16, 41, -30, 38, 4, 26, 3, 48, -16, 33, -11, 30, 22, 53, -52, 55, 23, 16, 0, 44, -14, 63, 8, 39, -7, 66, -53, 69, 31, 22, 9, 54, -16, 73, -28, 38, 35, 78, -59, 58
Offset: 1

Views

Author

Antti Karttunen, Nov 25 2017

Keywords

Comments

"Least deficient numbers" or "almost perfect numbers" are those k for which A033879(k) = 1, or equally, for which a(k) = -A048881(k-1). The only known solutions are powers of 2 (A000079), all present also in A295296. See also A235796 and A378988. - Antti Karttunen, Dec 16 2024

Crossrefs

Cf. A000120, A000203, A001065, A005187, A011371, A013661, A033879, A048881, A235796, A294896, A294899, A297114 (Möbius transform), A317844 (difference from a(n)), A326133, A326138, A324348 (a(n) applied to Doudna sequence), A379008 (a(n) applied to prime shift array), A378988.
Cf. A295296 (positions of zeros), A295297 (parity of a(n)).

Programs

Formula

a(n) = A005187(n) - A000203(n).
a(n) = A011371(n) - A001065(n).
a(n) = A033879(n) - A000120(n).
Sum_{k=1..n} a(k) ~ c * n^2, where c = 1 - zeta(2)/2 = 0.177532... . - Amiram Eldar, Feb 22 2024

Extensions

Name edited by Antti Karttunen, Dec 16 2024
Showing 1-10 of 2056 results. Next