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

A029931 If 2n = Sum 2^e_i, a(n) = Sum e_i.

Original entry on oeis.org

0, 1, 2, 3, 3, 4, 5, 6, 4, 5, 6, 7, 7, 8, 9, 10, 5, 6, 7, 8, 8, 9, 10, 11, 9, 10, 11, 12, 12, 13, 14, 15, 6, 7, 8, 9, 9, 10, 11, 12, 10, 11, 12, 13, 13, 14, 15, 16, 11, 12, 13, 14, 14, 15, 16, 17, 15, 16, 17, 18, 18, 19, 20, 21, 7, 8, 9, 10, 10, 11, 12, 13, 11, 12, 13, 14, 14, 15, 16
Offset: 0

Views

Author

Keywords

Comments

Write n in base 2, n = sum b(i)*2^(i-1), then a(n) = sum b(i)*i. - Benoit Cloitre, Jun 09 2002
May be regarded as a triangular array read by rows, giving weighted sum of compositions in standard order. The standard order of compositions is given by A066099. - Franklin T. Adams-Watters, Nov 06 2006
Sum of all positive integer roots m_i of polynomial {m,k} - see link [Shevelev]; see also A264613. - Vladimir Shevelev, Dec 13 2015
Also the sum of binary indices of n, where a binary index of n (A048793) is any position of a 1 in its reversed binary expansion. For example, the binary indices of 11 are {1,2,4}, so a(11) = 7. - Gus Wiseman, May 22 2024

Examples

			14 = 8+4+2 so a(7) = 3+2+1 = 6.
Composition number 11 is 2,1,1; 1*2+2*1+3*1 = 7, so a(11) = 7.
The triangle starts:
  0
  1
  2 3
  3 4 5 6
The reversed binary expansion of 18 is (0,1,0,0,1) with 1's at positions {2,5}, so a(18) = 2 + 5 = 7. - _Gus Wiseman_, Jul 22 2019
		

Crossrefs

Other sequences that are built by replacing 2^k in the binary representation with other numbers: A022290 (Fibonacci), A059590 (factorials), A073642, A089625 (primes), A116549, A326031.
Cf. A001793 (row sums), A011782 (row lengths), A059867, A066099, A124757.
Row sums of A048793 and A272020.
Contains exactly A000009(n) copies of n.
For length instead of sum we have A000120, complement A023416.
For minimum instead of sum we have A001511, opposite A000012.
For maximum instead of sum we have A029837 or A070939, opposite A070940.
For product instead of sum we have A096111.
The reverse version is A230877, row sums of A371572.
The reverse complement is A359359, row sums of A371571.
The complement is A359400, row sums of A368494.
Numbers k such that a(k) is prime are A372689.
A014499 lists binary indices of prime numbers.
A019565 gives Heinz number of binary indices, inverse A048675.
A372471 lists binary indices of primes, row-sums A372429.

Programs

  • Haskell
    a029931 = sum . zipWith (*) [1..] . a030308_row
    -- Reinhard Zumkeller, Feb 28 2014
    
  • Maple
    HammingWeight := n -> add(i, i = convert(n, base, 2)):
    a := proc(n) option remember; `if`(n = 0, 0,
    ifelse(n::even, a(n/2) + HammingWeight(n/2), a(n-1) + 1)) end:
    seq(a(n), n = 0..78); # Peter Luschny, Oct 30 2021
  • Mathematica
    a[n_] := (b = IntegerDigits[n, 2]).Reverse @ Range[Length @ b]; Array[a,78,0] (* Jean-François Alcover, Apr 28 2011, after B. Cloitre *)
  • PARI
    for(n=0,100,l=length(binary(n)); print1(sum(i=1,l, component(binary(n),i)*(l-i+1)),","))
    
  • PARI
    a(n) = my(b=binary(n)); b*-[-#b..-1]~; \\ Ruud H.G. van Tol, Oct 17 2023
    
  • Python
    def A029931(n): return sum(i if j == '1' else 0 for i, j in enumerate(bin(n)[:1:-1],1)) # Chai Wah Wu, Dec 20 2022
    (C#)
    ulong A029931(ulong n) {
        ulong result = 0, counter = 1;
        while(n > 0) {
            if (n % 2 == 1)
              result += counter;
            counter++;
            n /= 2;
        }
        return result;
    } // Frank Hollstein, Jan 07 2023

Formula

a(n) = a(n - 2^L(n)) + L(n) + 1 [where L(n) = floor(log_2(n)) = A000523(n)] = sum of digits of A048794 [at least for n < 512]. - Henry Bottomley, Mar 09 2001
a(0) = 0, a(2n) = a(n) + e1(n), a(2n+1) = a(2n) + 1, where e1(n) = A000120(n). a(n) = log_2(A029930(n)). - Ralf Stephan, Jun 19 2003
G.f.: (1/(1-x)) * Sum_{k>=0} (k+1)*x^2^k/(1+x^2^k). - Ralf Stephan, Jun 23 2003
a(n) = Sum_{k>=0} A030308(n,k)*A000027(k+1). - Philippe Deléham, Oct 15 2011
a(n) = sum of n-th row of the triangle in A213629. - Reinhard Zumkeller, Jun 17 2012
From Reinhard Zumkeller, Feb 28 2014: (Start)
a(A089633(n)) = n and a(m) != n for m < A089633(n).
a(n) = Sum_{k=1..A070939(n)} k*A030308(n,k-1). (End)
a(n) = A073642(n) + A000120(n). - Peter Kagey, Apr 04 2016

Extensions

More terms from Erich Friedman

A073642 Replace 2^k in the binary representation of n with k (i.e., if n = 2^b + 2^c + 2^d + ... then a(n) = b + c + d + ...).

Original entry on oeis.org

0, 0, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 5, 5, 6, 6, 4, 4, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 9, 9, 10, 10, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 10, 10, 11, 11, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, 13, 13, 14, 14, 15, 15, 6, 6, 7, 7, 8, 8, 9, 9, 9, 9, 10, 10, 11, 11, 12, 12, 10, 10, 11, 11, 12, 12, 13, 13
Offset: 0

Views

Author

Benoit Cloitre, Aug 29 2002

Keywords

Comments

For n >= 1, a(n) is the n-th row sum of the irregular triangle A133457. - Vladimir Shevelev, Dec 14 2015
For n >= 0, 2^a(n) is the number of partitions of n whose dimension (given by the hook-length formula) is an odd integer. See the MacDonald reference. - Arvind Ayyer, May 12 2016

Examples

			9 = 2^3 + 2^0, hence a(9) = 3 + 0 = 3;
25 = 2^4 + 2^3 + 2^0, hence a(25) = 4 + 3 + 0 = 7.
		

Crossrefs

Programs

  • Haskell
    a073642 = sum . zipWith (*) [0..] . a030308_row
    -- Reinhard Zumkeller, Jun 01 2013
    
  • Maple
    A073642 := proc(n)
            local bdgs ;
            bdgs := convert(n,base,2) ;
            add( op(i,bdgs)*(i-1), i=1..nops(bdgs)) ;
    end proc: # R. J. Mathar, Nov 17 2011
  • Mathematica
    Total[Flatten[Position[Rest[Reverse[IntegerDigits[#, 2]]], 1]]] & /@ Range[0, 87] (* Jayanta Basu, Jul 03 2013 *)
  • PARI
    a(n)=sum(i=1,length(binary(n)), component(binary(n),i)*(length(binary(n))-i))
    
  • PARI
    a(n) = my(b=binary(n)); b*-[-#b+1..0]~; \\ Ruud H.G. van Tol, Oct 17 2023
    
  • Python
    def A073642(n):
        a, i = 0, 0
        while n > 0:
            a, n, i = a+(n%2)*i, n//2, i+1
        return a
    print([A073642(n) for n in range(30)]) # A.H.M. Smeets, Aug 17 2019

Formula

a(n) = log_2(A059867(n)).
It seems that for n > 10 a(n) < n/(2*log(n)) and that Sum_{k=1..n} a(k) is asymptotic to C*n*log(n)^2 with 1/2 > C > 0.47.
a(1)=0, a(2n) = a(n) + e1(n), a(2n+1) = a(2n), where e1(n) = A000120(n). - Ralf Stephan, Jun 19 2003
If n = 2^log_2(n) then a(n) = log_2(n); otherwise, a(n) = log_2(n) + a(n-2^log_2(n)), where log_2=A000523. a(2*n+1) = a(2*n), as the least significant bit of n does not contribute to a(n). - Reinhard Zumkeller, Aug 17 2003, edited by A.H.M. Smeets, Aug 17 2019
a(n) = A029931(floor(n/2)). - Franklin T. Adams-Watters, Oct 22 2011
a(n) = Sum_{k=0..A070939(n)-1} k*A030308(n,k). - Reinhard Zumkeller, Jun 01 2013
Conjecture: a(n) = (3*A011371(n) - Sum_{k=1..n} A007814(k)^2)/2 for n > 0. - Velin Yanev, Sep 09 2017
G.f.: (1/(1 - x)) * Sum_{k>=1} k*x^(2^k)/(1 + x^(2^k)). - Ilya Gutkovskiy, Aug 17 2019
From A.H.M. Smeets, Aug 17 2019: (Start)
floor(log_2(n)) <= a(n) <= floor(log_2(n+2)*(log_2(n+2)-1)/2), n > 0.
Lower bound: floor(log_2(n)) = a(n) for n = 2^m or n = 2^m+1, m >= 0.
Upper bound: a(n) = floor(log_2(n+2)*(log_2(n+2)-1)/2) for n = 2^m-2 or n = 2^m-1, m >= 0. (End)
From Aayush Soni, Feb 12 2022: (Start)
For k < 2^n, a((2^n)+k) + a((2^n)-k-1) = n*(n+1)/2.
Proof: Any (n+1)-bit number 111...11_2 can only be split into two numbers 2^n + k and 2^n - k - 1 which never share any bits in common. Since a(111...11_2) = 0+1+2+...+n, this implies the stated formula. (End)

Extensions

a(0)=0 and offset corrected by Philippe Deléham, Apr 20 2009

A348296 Irregular table T(n, k), n > 0, k = 1..A000120(n), read by rows; the n-th contains, in ascending order, the distinct powers of 2 summing to n.

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Jul 18 2022

Keywords

Examples

			Triangle T(n, k) begins:
  n   n-th row
  --  ------------
   1  [1]
   2  [2]
   3  [1, 2]
   4  [4]
   5  [1, 4]
   6  [2, 4]
   7  [1, 2, 4]
   8  [8]
   9  [1, 8]
  10  [2, 8]
  11  [1, 2, 8]
  12  [4, 8]
  13  [1, 4, 8]
  14  [2, 4, 8]
  15  [1, 2, 4, 8]
		

Crossrefs

Programs

  • Mathematica
    Array[DeleteCases[Union@ NumberExpand[#, 2], 0] &, 32] // Flatten (* Michael De Vlieger, Jul 19 2022 *)
  • PARI
    row(n) = { my (r=vector(hammingweight(n))); for (k=1, #r, n -= r[k] = 2^valuation(n, 2)); return (r) }

Formula

T(n, k) = 2^A133457(n, k).
T(n, 1) = A006519(n).
T(n, A000120(n)) = A053644(n).
Sum_{k = 1..A000120(n)} T(n, k) = n.
Sum_{k = 1..A000120(n)} T(n, k) * (-1)^(k-1) = A065620(n).
Product_{k = 1..A000120(n)} T(n, k) = A059867(n).
T(2*n, k) = 2*T(n, k).

A029930 If 2n = Sum 2^e_i, a(n) = Product 2^e_i.

Original entry on oeis.org

1, 2, 4, 8, 8, 16, 32, 64, 16, 32, 64, 128, 128, 256, 512, 1024, 32, 64, 128, 256, 256, 512, 1024, 2048, 512, 1024, 2048, 4096, 4096, 8192, 16384, 32768, 64, 128, 256, 512, 512, 1024, 2048, 4096, 1024, 2048, 4096, 8192, 8192, 16384, 32768, 65536, 2048
Offset: 0

Views

Author

Keywords

Examples

			14 = 8+4+2 so a(7) = 8*4*2 = 64.
		

Crossrefs

A bisection of A059867.

Programs

  • Maple
    HammingWeight := n -> add(i, i = convert(n, base, 2)):
    a := proc(n) option remember; `if`(n = 0, 1,
    ifelse(n::even, 2^HammingWeight(n/2)*a(n/2), 2*a(n-1))) end:
    seq(a(n), n = 0..48); # Peter Luschny, Oct 30 2021
  • Mathematica
    e1[n_] := Total[IntegerDigits[n, 2]]; a[0] = 1; a[n_] := a[n] = If[EvenQ[ n], 2^e1[n/2] a[n/2], 2 a[n-1]]; Table[a[n], {n, 0, 50}] (* Jean-François Alcover, Mar 07 2016 *)
  • PARI
    a(n) = {my(bd = Vecrev(binary(n))); prod(k=1, #bd, if (bd[k], 2^k, 1));} \\ Michel Marcus, Mar 07 2016

Formula

From Ralf Stephan, Jun 19 2003: (Start)
G.f.: Prod_{k>=0} 1+2^(k+1)x^2^k.
a(0) = 1, a(2n) = 2^e1(n)*a(n), a(2n+1) = 2a(2n), where e1(n) = A000120(n).
a(n) = 2^A029931(n). (End)

A089248 a(n) is the sum of the odd degrees of the irreducible representations of the symmetric group S_n.

Original entry on oeis.org

1, 2, 2, 8, 12, 40, 144, 128, 644, 3504, 7000, 48224, 130992, 861792, 3257600, 32768, 425988, 5833312, 27621672, 415526656, 1987852432, 17674429440, 157807273408, 265515959680, 2848581615344, 30980959604096, 114059874705248, 1365388896050048, 6215927122198944
Offset: 1

Views

Author

Yuval Dekel (dekelyuval(AT)hotmail.com), Dec 11 2003

Keywords

Comments

a(n) is divisible by 4 for n >= 4. - Eric M. Schmidt, Apr 28 2013

References

  • John McKay, Irreducible representations of odd degree, Journal of Algebra 20, 1972 pages 416-418.

Crossrefs

Programs

  • Mathematica
    h[l_] := With[{n = Length[l]}, Total[l]!/Product[Product[1 + l[[i]] - j + Sum[If[l[[k]] >= j, 1, 0], {k, i + 1, n}], {j, 1, l[[i]]}], {i, 1, n}]];
    g[n_, i_, l_] := If[n == 0 || i == 1, h[Join[l, Array[1 &, n]]], If[i < 1, 0, Flatten@ Table[g[n - i*j, i - 1, Join[l, Array[i &, j]]], {j, 0, n/i}]]];
    a[n_] := a[n] = If[n == 1, 1, Select[g[n, n, {}], OddQ] // Total];
    Table[Print[n, " ", a[n]];
    a[n], {n, 1, 50}] (* Jean-François Alcover, Sep 23 2024, after Alois P. Heinz in A060240 *)
  • Sage
    # Simple but inefficient; see links for faster code
    def A089248(n) :
        res = 0
        for P in Partitions(n) :
            deg = P.dimension()
            if is_odd(deg) : res += deg
        return res
    # Eric M. Schmidt, Apr 28 2013

Formula

a(2^n) = 2^(2^n - 1). - Eric M. Schmidt, Apr 28 2013

Extensions

More terms from Eric M. Schmidt, Apr 28 2013

A060368 Number of irreducible representations of the symmetric group S_n that have even degree.

Original entry on oeis.org

0, 0, 1, 1, 3, 3, 7, 14, 22, 26, 40, 45, 69, 71, 112, 215, 281, 353, 458, 563, 728, 874, 1127, 1447, 1830, 2180, 2754, 3206, 4053, 4580, 5818, 8317, 10111, 12246, 14819, 17849, 21509, 25759, 30929, 37082, 44327, 52662, 62749, 74151, 88110, 103510, 122706
Offset: 1

Views

Author

Avi Peretz (njk(AT)netvision.net.il), Apr 01 2001

Keywords

Examples

			a(3) = 1 because the degrees of the irreducible representations of S_3 are 1,1,2.
		

Crossrefs

Programs

  • Sage
    def A060368(n) : dig = n.digits(2); return Partitions(n).cardinality() - prod(2^n for n in range(len(dig)) if dig[n]==1) # Eric M. Schmidt, Apr 29 2013

Formula

The total number of irreducible representations of S_n is the partition function p(n) (sequence A000041) and the number of irreducible representations of the symmetric group S_n that have odd degree is given in A059867 so a(n) = A000041(n) - A059867(n) for n >= 1

Extensions

More terms from Eric M. Schmidt, Apr 29 2013

A060426 a(n) is the number of degrees in the sequence of the degrees of the irreducible representations of the symmetric group S_n that appear only once.

Original entry on oeis.org

1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 2, 3, 2, 3, 4, 4, 5, 5, 4, 6, 8, 8, 6, 7, 10, 11, 11, 15, 15, 16, 18, 21, 22, 23, 29, 33, 31, 31, 39, 43, 44, 52, 51, 58, 64, 71, 66, 82, 88, 96, 93, 103, 115, 128, 143, 150, 156, 160, 173, 199, 202, 202, 242, 263, 269, 293, 308
Offset: 1

Views

Author

Avi Peretz (njk(AT)netvision.net.il), Apr 05 2001

Keywords

Comments

Bounded above by A000700(n). - Eric M. Schmidt, Apr 29 2013

Examples

			a(6) = 1 because the degrees for S_6 are 1,1,5,5,5,5,9,9,10,10,16 and the only number that appears once is 16.
		

Crossrefs

Cf. A059867, A060368, A060369, A060437, A061569, A089248. [From M. F. Hasler, Jun 14 2009]

Programs

  • Mathematica
    h[l_] := With[{n = Length[l]}, Total[l]!/Product[Product[1 + l[[i]] - j + Sum[If[l[[k]] >= j, 1, 0], {k, i + 1, n}], {j, 1, l[[i]]}], {i, 1, n}]];
    g[n_, i_, l_] := If[n == 0 || i == 1, h[Join[l, Array[1&, n]]], If[i < 1, 0, Flatten@ Table[g[n - i*j, i - 1, Join[l, Array[i&, j]]], {j, 0, n/i}]]];
    a[n_] := a[n] = If[n == 1, 1, Count[Tally[g[n, n, {}]], {_, 1}] ];
    Table[Print[n, " ", a[n]]; a[n], {n, 1, 50}] (* Jean-François Alcover, Sep 23 2024, after Alois P. Heinz in A060240 *)
  • Sage
    def A060426(n) :
        mult = {}
        for P in Partitions(n) :
            dim = P.dimension()
            mult[dim] = mult.get(dim, 0) + 1
        return len([m for m in iter(mult) if mult[m]==1])
    # Eric M. Schmidt, Apr 29 2013

Extensions

More terms from Eric M. Schmidt, Apr 29 2013

A060840 Number of irreducible representations of symmetric group S_n whose degree is not divisible by 3.

Original entry on oeis.org

1, 2, 3, 3, 6, 9, 9, 18, 9, 9, 18, 27, 27, 54, 81, 81, 162, 54, 54, 108, 162, 162, 324, 486, 486, 972, 27, 27, 54, 81, 81, 162, 243, 243, 486, 243, 243, 486, 729, 729, 1458, 2187, 2187, 4374, 1458, 1458, 2916, 4374, 4374, 8748, 13122, 13122, 26244, 405, 405, 810
Offset: 1

Views

Author

Noam Katz (noamkj(AT)hotmail.com), May 02 2001

Keywords

Examples

			a(4) = 3 because the degrees for S_4 are 1,1,2,3,3 and by the formula: 4 in base 3 is 11 and a(4) = 1*3
		

References

  • I. G. MacDonald, On the degrees of the irreducible representations of symmetric groups, Bull. London Math. Soc. 3 (1971), 189-192

Crossrefs

Cf. A059867.

Programs

  • Mathematica
    a[n_] := (id = IntegerDigits[n, 3]; lg = Length[id]; Times @@ Table[ Which[ id[[lg-i]] == 0, 1, id[[lg-i]] == 1, 3^i, True, 3^i*(3^i+3)/2], {i, lg-1, 0, -1}]); Table[a[n], {n, 1, 56}] (* Jean-François Alcover, Apr 30 2013 *)
  • Sage
    def A060840(n) : dig = n.digits(3); return prod([1, 3^m, 3^m*(3^m+3)//2][dig[m]] for m in range(len(dig)))
    # Eric M. Schmidt, Apr 30 2013

Formula

If n = sum a_i*3^e[i] in base 3 where a_i is 0, 1, 2 then a(n) = product g(i) where if a(i) = 0 g(i) = 1, if a(i) = 1 g(i) = 3^i, if a(i) = 2 g(i) = 3^i * (3^i + 3) / 2

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), May 10 2001

A356387 a(n) is the product of all parts in negaFibonacci representation of n.

Original entry on oeis.org

1, 1, 2, 2, -5, 5, 5, 10, 10, 39, -39, -39, -13, 13, 13, 26, 26, -65, 65, 65, 130, 130, -816, 816, 816, 272, -272, -272, -544, -544, 102, -102, -102, -34, 34, 34, 68, 68, -170, 170, 170, 340, 340, 1326, -1326, -1326, -442, 442, 442, 884, 884, -2210, 2210, 2210
Offset: 0

Views

Author

Rémy Sigrist, Aug 05 2022

Keywords

Comments

a(0) = 1 for the empty product.
See A273156 and A356388 for similar sequences.

Examples

			For n = 11:
- using F(-k) = A039834(k):
- 11 = F(-1) + F(-4) + F(-7),
- so a(11) = F(-1) * F(-4) * F(-7) = 1 * -3 * 13 = -39.
		

Crossrefs

Programs

  • PARI
    a(n) = { my (v=1); while (n, my (neg=0, pos=0, f); for (e=0, oo, f=fibonacci(-1-e); if (f<0, neg+=f, pos+=f); if (neg <=n && n <= pos, v*=f; n-=f; break))); return (v) }

A356388 a(n) is the product of all parts in negaFibonacci representation of -n.

Original entry on oeis.org

1, -1, -3, -3, 3, -16, -16, -8, -8, 8, 24, 24, -24, -210, -210, -105, -105, 105, -42, -42, -21, -21, 21, 63, 63, -63, 336, 336, 168, 168, -168, -504, -504, 504, -7150, -7150, -3575, -3575, 3575, -1430, -1430, -715, -715, 715, 2145, 2145, -2145, -550, -550
Offset: 0

Views

Author

Rémy Sigrist, Aug 05 2022

Keywords

Comments

a(0) = 1 for the empty product.
See A273156 and A356387 for similar sequences.

Examples

			For n = 11:
- using F(-k) = A039834(k):
- -11 = F(-4) + F(-6),
- so a(11) = F(-4) * F(-6) = -3 * -8 = 24.
		

Crossrefs

Programs

  • PARI
    a(n) = { my (v=1); n=-n; while (n, my (neg=0, pos=0, f); for (e=0, oo, f=fibonacci(-1-e); if (f<0, neg+=f, pos+=f); if (neg <=n && n <= pos, v*=f; n-=f; break))); return (v) }
Showing 1-10 of 11 results. Next