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

A286586 a(n) = A006047(A048673(n)).

Original entry on oeis.org

2, 3, 2, 6, 4, 9, 3, 12, 8, 6, 6, 18, 2, 18, 3, 24, 4, 12, 4, 12, 4, 9, 6, 36, 18, 27, 6, 36, 12, 54, 6, 48, 6, 6, 8, 24, 6, 18, 24, 24, 12, 6, 9, 18, 12, 36, 2, 72, 18, 27, 12, 54, 4, 81, 12, 72, 12, 18, 8, 108, 12, 9, 12, 96, 9, 36, 4, 12, 18, 36, 8, 48, 16, 27, 24, 36, 9, 36, 12, 48, 72, 18, 6, 12, 24, 54, 27, 36, 24, 18, 16, 72, 8, 81, 2
Offset: 1

Views

Author

Antti Karttunen, May 31 2017

Keywords

Crossrefs

Programs

  • Python
    from sympy.ntheory.factor_ import digits
    from sympy import factorint, nextprime
    from operator import mul
    from functools import reduce
    def a006047(n):
        d=digits(n, 3)
        return n + 1 if n<3 else reduce(mul, [1 + d[i] for i in range(1, len(d))])
    def a048673(n):
        f = factorint(n)
        return 1 if n==1 else (1 + reduce(mul, [nextprime(i)**f[i] for i in f]))//2
    def a(n): return a006047(a048673(n))
    print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Jun 12 2017
  • Scheme
    (define (A286586 n) (A006047 (A048673 n)))
    

Formula

a(n) = A006047(A048673(n)).
For n >= 0, a(A000079(n)) = A042950(n).

A286633 Base-3 {digit+1} product of A254103: a(n) = A006047(A254103(n)).

Original entry on oeis.org

1, 2, 3, 2, 6, 4, 9, 3, 12, 2, 6, 6, 18, 8, 18, 4, 24, 12, 27, 6, 12, 3, 9, 4, 36, 4, 12, 6, 36, 2, 6, 12, 48, 6, 18, 12, 54, 16, 36, 9, 24, 24, 54, 4, 18, 8, 18, 6, 72, 24, 54, 6, 24, 12, 27, 6, 72, 36, 81, 12, 12, 6, 18, 18, 96, 36, 81, 12, 36, 6, 18, 36, 108, 8, 24, 18, 72, 24, 54, 8, 48, 12, 36, 18, 108, 2, 6, 24, 36, 4, 12, 12, 36, 3, 9, 4
Offset: 0

Views

Author

Antti Karttunen, Jun 03 2017

Keywords

Comments

Reflecting the structure of A254103 also this sequence can be represented as a binary tree:
1
|
...................2...................
3 2
6......../ \........4 9......../ \........3
/ \ / \ / \ / \
/ \ / \ / \ / \
/ \ / \ / \ / \
12 2 6 6 18 8 18 4
24 12 27 6 12 3 9 4 36 4 12 6 36 2 6 12
etc.

Crossrefs

Programs

  • Python
    from sympy.ntheory.factor_ import digits
    from operator import mul
    from functools import reduce
    def a006047(n):
        d=digits(n, 3)
        return reduce(mul, [1 + d[i] for i in range(1, len(d))])
    def a254103(n):
        if n==0: return 0
        if n%2==0: return 3*a254103(n//2) - 1
        else: return (3*(1 + a254103((n - 1)//2)))//2
    def a(n): return a006047(a254103(n)) # Indranil Ghosh, Jun 06 2017
  • Scheme
    (define (A286633 n) (A006047 (A254103 n)))
    

Formula

a(n) = A006047(A254103(n)).
For n >= 0, a(A000079(n)) = A042950(n).

A286587 a(n) = A006047(A244154(n)).

Original entry on oeis.org

2, 3, 2, 6, 4, 9, 8, 12, 3, 6, 3, 18, 18, 12, 6, 24, 6, 18, 4, 12, 8, 54, 12, 36, 18, 27, 24, 24, 12, 81, 72, 48, 2, 9, 6, 36, 12, 6, 12, 24, 9, 36, 24, 108, 4, 18, 36, 72, 8, 27, 18, 54, 36, 144, 72, 48, 27, 18, 48, 162, 288, 108, 54, 96, 4, 27, 24, 18, 9, 36, 6, 72, 16, 18, 36, 12, 72, 54, 144, 48, 8, 162, 48, 72, 18, 36, 54, 216, 24
Offset: 0

Views

Author

Antti Karttunen, May 31 2017

Keywords

Crossrefs

Programs

Formula

a(n) = A006047(A244154(n)).
a(n) = A286586(A005940(1+n)).
For n >= 0, a(A000225(n)) = A042950(n).

A268127 a(n) = (A005704(n)-A006047(n))/3.

Original entry on oeis.org

0, 0, 0, 1, 1, 1, 3, 3, 3, 7, 8, 9, 12, 13, 14, 19, 20, 21, 30, 33, 36, 42, 45, 48, 57, 60, 63, 79, 86, 93, 103, 111, 119, 132, 141, 150, 168, 180, 192, 209, 222, 235, 257, 271, 285, 316, 335, 354, 380, 400, 420, 453, 474, 495, 543, 573, 603, 639, 672, 705, 747
Offset: 0

Views

Author

Tom Edgar, Jan 26 2016

Keywords

Crossrefs

Programs

  • Mathematica
    b[n_] := b[n] = If[n <= 2, n+1, b[n-1] + b[Floor[n/3]]];
    c = Nest[Join[#, 2#, 3#]&, {1}, 4];
    a[n_] := (b[n] - c[[n+1]])/3;
    Table[a[n], {n, 0, 60}] (* Jean-François Alcover, Dec 12 2018 *)
  • Sage
    def b(n):
        A=[1]
        for i in [1..n]:
            A.append(A[i-1] + A[floor(i/3)])
        return A[n]
    [(b(n)-prod(x+1 for x in n.digits(3)))/3 for n in [0..60]]

Formula

Let b(0) = 1 and b(n) = b(n-1) + b(floor(n/3)) and let c(n) = Product_{i=0..k}(n_i+1) where n = Sum_{i=0..k}n_i*3^i is the ternary representation of n. Then a(n) = (1/3)*(b(n) - c(n)).

A353330 a(n) = A006047(A156552(n)).

Original entry on oeis.org

1, 2, 3, 2, 4, 6, 9, 6, 3, 2, 12, 6, 12, 18, 4, 6, 12, 8, 36, 6, 3, 6, 16, 18, 4, 18, 12, 18, 81, 6, 144, 8, 12, 24, 9, 2, 324, 24, 12, 8, 432, 8, 108, 24, 12, 6, 576, 18, 9, 18, 48, 72, 11664, 6, 4, 54, 12, 216, 972, 24, 3888, 162, 12, 6, 36, 18, 1728, 24, 12, 24, 8748, 6, 5184, 648, 27, 18, 16, 72, 34992, 54, 4, 72
Offset: 1

Views

Author

Antti Karttunen, Apr 20 2022

Keywords

Crossrefs

Programs

  • PARI
    A006047(n) = { my(m=1, d); while(n, d = (n%3); m *= (1+d); n = (n-d)/3); m; };
    A156552(n) = { my(f = factor(n), p, p2 = 1, res = 0); for(i = 1, #f~, p = 1 << (primepi(f[i, 1]) - 1); res += (p * p2 * (2^(f[i, 2]) - 1)); p2 <<= f[i, 2]); res };
    A353330(n) = A006047(A156552(n));

Formula

a(n) = A006047(A156552(n)).

A353360 a(n) = A006047(A048675(n)).

Original entry on oeis.org

1, 2, 3, 3, 4, 2, 9, 2, 4, 6, 12, 4, 12, 2, 3, 4, 12, 6, 36, 3, 4, 18, 16, 6, 9, 6, 3, 4, 81, 6, 144, 6, 3, 18, 4, 3, 324, 24, 12, 6, 432, 6, 108, 3, 9, 24, 576, 3, 12, 2, 12, 12, 11664, 6, 9, 6, 48, 6, 972, 9, 3888, 216, 4, 3, 4, 6, 1728, 12, 12, 8, 8748, 6, 5184, 162, 4, 48, 9, 18, 34992, 9, 9, 648, 15552, 4, 36, 72
Offset: 1

Views

Author

Antti Karttunen, Apr 20 2022

Keywords

Crossrefs

Cf. also A332813, A332823 and A353330.

Programs

  • PARI
    A006047(n) = { my(m=1, d); while(n, d = (n%3); m *= (1+d); n = (n-d)/3); m; };
    A048675(n) = { my(f = factor(n)); sum(k=1, #f~, f[k, 2]*2^primepi(f[k, 1]))/2; };
    A353360(n) = A006047(A048675(n));

Formula

a(n) = A006047(A048675(n)).

A130830 Irregular triangle read by rows: row(n) consists of the first A011764(n-1) terms of A006047.

Original entry on oeis.org

1, 2, 3, 1, 2, 3, 2, 4, 6, 3, 6, 9, 1, 2, 3, 2, 4, 6, 3, 6, 9, 2, 4, 6, 4, 8, 12, 6, 12, 18, 3, 6, 9, 6, 12, 18, 9, 18, 27, 2, 4, 6, 4, 8, 12, 6, 12, 18, 4, 8, 12, 8, 16, 24, 12, 24, 36, 6, 12, 18, 12, 24, 36, 18, 36, 54, 3, 6, 9, 6, 12, 18, 9, 18, 27, 6, 12, 18, 12, 24, 36, 18, 36, 54, 9, 18, 27
Offset: 1

Views

Author

Roger L. Bagula, Aug 20 2007

Keywords

Examples

			Triangle begins:
{1, 2, 3},
{1, 2, 3, 2, 4, 6, 3, 6, 9},
{1, 2, 3, 2, 4, 6, 3, 6, 9, 2, 4, 6, 4, 8, 12, 6, 12, 18, 3, 6, 9, 6, 12, 18, 9, 18, 27, 2, 4, 6, 4, 8, 12, 6, 12, 18, 4, 8, 12, 8, 16, 24, 12, 24, 36, 6, 12, 18, 12, 24, 36, 18, 36, 54, 3, 6, 9, 6, 12, 18, 9, 18, 27, 6, 12, 18, 12, 24, 36, 18, 36, 54, 9, 18, 27, 18, 36, 54, 27, 54, 81}, ...
		

Crossrefs

Extensions

Edited by N. J. A. Sloane, Jun 07 2008

A331279 a(n) = A122111(A006047(n)).

Original entry on oeis.org

1, 2, 4, 2, 3, 6, 4, 6, 9, 2, 3, 6, 3, 5, 10, 6, 10, 15, 4, 6, 9, 6, 10, 15, 9, 15, 25, 2, 3, 6, 3, 5, 10, 6, 10, 15, 3, 5, 10, 5, 7, 14, 10, 14, 21, 6, 10, 15, 10, 14, 21, 15, 21, 35, 4, 6, 9, 6, 10, 15, 9, 15, 25, 6, 10, 15, 10, 14, 21, 15, 21, 35, 9, 15, 25, 15, 21, 35, 25, 35, 49, 2, 3, 6, 3, 5, 10, 6, 10, 15, 3, 5, 10, 5, 7
Offset: 0

Views

Author

Antti Karttunen, Jan 13 2020

Keywords

Crossrefs

Programs

  • PARI
    A006047(n) = { my(m=1, d); while(n, d = (n%3); m *= (1+d); n = (n-d)/3); m; };
    A064989(n) = {my(f); f = factor(n); if((n>1 && f[1,1]==2), f[1,2] = 0); for (i=1, #f~, f[i,1] = precprime(f[i,1]-1)); factorback(f)};
    A122111(n) = if(1==n,n,prime(bigomega(n))*A122111(A064989(n)));
    A331279(n) = A122111(A006047(n));

Formula

a(n) = A122111(A006047(n)).
For all n >= 0, A056239(a(n)) = A053735(n).

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

A053735 Sum of digits of (n written in base 3).

Original entry on oeis.org

0, 1, 2, 1, 2, 3, 2, 3, 4, 1, 2, 3, 2, 3, 4, 3, 4, 5, 2, 3, 4, 3, 4, 5, 4, 5, 6, 1, 2, 3, 2, 3, 4, 3, 4, 5, 2, 3, 4, 3, 4, 5, 4, 5, 6, 3, 4, 5, 4, 5, 6, 5, 6, 7, 2, 3, 4, 3, 4, 5, 4, 5, 6, 3, 4, 5, 4, 5, 6, 5, 6, 7, 4, 5, 6, 5, 6, 7, 6, 7, 8, 1, 2, 3, 2, 3, 4, 3, 4, 5, 2, 3, 4, 3, 4, 5, 4, 5, 6, 3, 4, 5, 4, 5, 6
Offset: 0

Views

Author

Henry Bottomley, Mar 28 2000

Keywords

Comments

Also the fixed point of the morphism 0->{0,1,2}, 1->{1,2,3}, 2->{2,3,4}, etc. - Robert G. Wilson v, Jul 27 2006

Examples

			a(20) = 2 + 0 + 2 = 4 because 20 is written as 202 base 3.
From _Omar E. Pol_, Feb 20 2010: (Start)
This can be written as a triangle with row lengths A025192 (see the example in the entry A000120):
0,
1,2,
1,2,3,2,3,4,
1,2,3,2,3,4,3,4,5,2,3,4,3,4,5,4,5,6,
1,2,3,2,3,4,3,4,5,2,3,4,3,4,5,4,5,6,3,4,5,4,5,6,5,6,7,2,3,4,3,4,5,4,5,6,3,...
where the k-th row contains a(3^k+i) for 0<=i<2*3^k and converges to A173523 as k->infinity. (End) [Changed conjectures to statements in this entry. - _Franklin T. Adams-Watters_, Jul 02 2015]
G.f. = x + 2*x^2 + x^3 + 2*x^4 + 3*x^5 + 2*x^6 + 3*x^7 + 4*x^8 + x^9 + 2*x^10 + ...
		

Crossrefs

Cf. A065363, A007089, A173523. See A134451 for iterations.
Sum of digits of n written in bases 2-16: A000120, this sequence, A053737, A053824, A053827, A053828, A053829, A053830, A007953, A053831, A053832, A053833, A053834, A053835, A053836.
Related base-3 sequences: A006047, A230641, A230642, A230643, A230853, A230854, A230855, A230856, A230639, A230640, A010063 (trajectory of 1), A286585, A286632, A289813, A289814.

Programs

  • Haskell
    a053735 = sum . a030341_row
    -- Reinhard Zumkeller, Feb 21 2013, Feb 19 2012
    
  • MATLAB
    m=1; for u=0:104; sol(m)=sum(dec2base(u,3)-'0'); m=m+1;end
    sol; % Marius A. Burtea, Jan 17 2019
  • Magma
    [&+Intseq(n,3):n in [0..104]]; // Marius A. Burtea, Jan 17 2019
    
  • Maple
    seq(convert(convert(n,base,3),`+`),n=0..100); # Robert Israel, Jul 02 2015
  • Mathematica
    Table[Plus @@ IntegerDigits[n, 3], {n, 0, 100}] (* or *)
    Nest[Join[#, # + 1, # + 2] &, {0}, 6] (* Robert G. Wilson v, Jul 27 2006 and modified Jul 27 2014 *)
  • PARI
    {a(n) = if( n<1, 0, a(n\3) + n%3)}; /* Michael Somos, Mar 06 2004 */
    
  • PARI
    A053735(n)=sumdigits(n,3) \\ Requires version >= 2.7. Use sum(i=1,#n=digits(n,3),n[i]) in older versions. - M. F. Hasler, Mar 15 2016
    
  • Scheme
    (define (A053735 n) (let loop ((n n) (s 0)) (if (zero? n) s (let ((d (mod n 3))) (loop (/ (- n d) 3) (+ s d)))))) ;; For R6RS standard. Use modulo instead of mod in older Schemes like MIT/GNU Scheme. - Antti Karttunen, Jun 03 2017
    

Formula

From Benoit Cloitre, Dec 19 2002: (Start)
a(0) = 0, a(3n) = a(n), a(3n + 1) = a(n) + 1, a(3n + 2) = a(n) + 2.
a(n) = n - 2*Sum_{k>0} floor(n/3^k) = n - 2*A054861(n). (End)
a(n) = A062756(n) + 2*A081603(n). - Reinhard Zumkeller, Mar 23 2003
G.f.: (Sum_{k >= 0} (x^(3^k) + 2*x^(2*3^k))/(1 + x^(3^k) + x^(2*3^k)))/(1 - x). - Michael Somos, Mar 06 2004, corrected by Franklin T. Adams-Watters, Nov 03 2005
In general, the sum of digits of (n written in base b) has generating function (Sum_{k>=0} (Sum_{0 <= i < b} i*x^(i*b^k))/(Sum_{i=0..b-1} x^(i*b^k)))/(1-x). - Franklin T. Adams-Watters, Nov 03 2005
First differences of A094345. - Vladeta Jovovic, Nov 08 2005
a(A062318(n)) = n and a(m) < n for m < A062318(n). - Reinhard Zumkeller, Feb 26 2008
a(n) = A138530(n,3) for n > 2. - Reinhard Zumkeller, Mar 26 2008
a(n) <= 2*log_3(n+1). - Vladimir Shevelev, Jun 01 2011
a(n) = Sum_{k>=0} A030341(n, k). - Philippe Deléham, Oct 21 2011
G.f. satisfies G(x) = (x+2*x^2)/(1-x^3) + (1+x+x^2)*G(x^3), and has a natural boundary at |x|=1. - Robert Israel, Jul 02 2015
a(n) = A056239(A006047(n)). - Antti Karttunen, Jun 03 2017
a(n) = A000120(A289813(n)) + 2*A000120(A289814(n)). - Antti Karttunen, Jul 20 2017
a(0) = 0; a(n) = a(n - 3^floor(log_3(n))) + 1. - Ilya Gutkovskiy, Aug 23 2019
Sum_{n>=1} a(n)/(n*(n+1)) = 3*log(3)/2 (Shallit, 1984). - Amiram Eldar, Jun 03 2021
Showing 1-10 of 40 results. Next