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.

Previous Showing 11-20 of 22 results. Next

A272011 Irregular triangle read by rows: strictly decreasing sequences of nonnegative numbers given in lexicographic order.

Original entry on oeis.org

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

Views

Author

Peter Kagey, Apr 17 2016

Keywords

Comments

Length of n-th row given by A000120(n);
Maximum of n-th row given by A000523(n);
Minimum of n-th row given by A007814(n);
GCD of n-th row given by A064894(n);
Sum of n-th row given by A073642(n + 1).
n-th row begins at index A000788(n - 1) for n > 0.
The first appearance of n is at A001787(n).
a(A001787(n) + 1) = a(A001787(n)) for all n > 0.
a(A001787(n) + 2) = 0 for all n > 0.
a(A001787(n) + 3) = a(A001787(n)) for all n > 1.
a(A001787(n) + 4) = 1 for all n > 1.
a(A001787(n) + 5) = a(A001787(n)) for all n > 1.
Row n < 1024 lists the digits of A262557(n). - M. F. Hasler, Dec 11 2019

Examples

			Row n is given by the exponents in the binary expansion of n. For example, row 5 = [2, 0] because 5 = 2^2 + 2^0.
Row 0: []
Row 1: [0]
Row 2: [1]
Row 3: [1, 0]
Row 4: [2]
Row 5: [2, 0]
Row 6: [2, 1]
Row 7: [2, 1, 0]
		

Crossrefs

Cf. A133457 gives the rows in reverse order.

Programs

  • Mathematica
    Map[Length[#] - Flatten[Position[#, 1]] &, IntegerDigits[Range[50], 2]] (* Paolo Xausa, Feb 13 2024 *)
  • PARI
    apply( A272011_row(n)=Vecrev(vecextract([0..exponent(n+!n)],n)), [0..39]) \\ For n < 2^10: row(n)=digits(A262557[n]). There are 2^k rows starting with k, they start at row 2^k. - M. F. Hasler, Dec 11 2019

A372474 Least k such that the k-th prime number has exactly n zeros in its binary expansion.

Original entry on oeis.org

2, 1, 8, 7, 19, 32, 99, 55, 174, 310, 565, 1029, 1902, 3513, 6544, 6543, 23001, 43395, 82029, 155612, 295957, 564164, 1077901, 3957811, 3965052, 7605342, 14630844, 28194383, 54400029, 105097568, 393615809, 393615807, 762939128, 1480206930, 2874398838, 5586502349
Offset: 0

Views

Author

Gus Wiseman, May 11 2024

Keywords

Examples

			The prime numbers A000040(a(n)) together with their binary expansions and binary indices begin:
         3:                          11 ~ {1,2}
         2:                          10 ~ {2}
        19:                       10011 ~ {1,2,5}
        17:                       10001 ~ {1,5}
        67:                     1000011 ~ {1,2,7}
       131:                    10000011 ~ {1,2,8}
       523:                  1000001011 ~ {1,2,4,10}
       257:                   100000001 ~ {1,9}
      1033:                 10000001001 ~ {1,4,11}
      2053:                100000000101 ~ {1,3,12}
      4099:               1000000000011 ~ {1,2,13}
      8209:              10000000010001 ~ {1,5,14}
     16417:             100000000100001 ~ {1,6,15}
     32771:            1000000000000011 ~ {1,2,16}
     65539:           10000000000000011 ~ {1,2,17}
     65537:           10000000000000001 ~ {1,17}
    262147:         1000000000000000011 ~ {1,2,19}
    524353:        10000000000001000001 ~ {1,7,20}
   1048609:       100000000000000100001 ~ {1,6,21}
   2097169:      1000000000000000010001 ~ {1,5,22}
   4194433:     10000000000000010000001 ~ {1,8,23}
   8388617:    100000000000000000001001 ~ {1,4,24}
  16777729:   1000000000000001000000001 ~ {1,10,25}
  67108913: 100000000000000000000110001 ~ {1,5,6,27}
  67239937: 100000000100000000000000001 ~ {1,18,27}
		

Crossrefs

Positions of first appearances in A035103.
For squarefree instead of prime we have A372473, firsts of A372472.
Counting ones (weight) gives A372517, firsts of A014499.
Counting squarefree bits gives A372540, firsts of A372475, runs A077643.
Counting squarefree ones gives A372541, firsts of A372433.
Counting bits (length) gives A372684, firsts of A035100.
A000120 counts ones in binary expansion (binary weight), zeros A080791.
A030190 gives binary expansion, reversed A030308.
A048793 lists positions of ones in reversed binary expansion, sum A029931.
A070939 gives length of binary expansion (number of bits).

Programs

  • Mathematica
    nn=10000;
    spnm[y_]:=Max@@NestWhile[Most,y,Union[#]!=Range[0,Max@@#]&];
    dcs=DigitCount[Select[Range[nn],PrimeQ],2,0];
    Table[Position[dcs,i][[1,1]],{i,0,spnm[dcs]}]
  • Python
    from itertools import count
    from sympy import isprime, primepi
    from sympy.utilities.iterables import multiset_permutations
    def A372474(n):
        for l in count(n):
            m = 1<Chai Wah Wu, May 13 2024

Formula

a(n) = A000720(A066195(n)). - Robert Israel, May 13 2024

Extensions

a(22)-a(35) from and offset corrected by Chai Wah Wu, May 13 2024

A372472 Number of zeros in the binary expansion of the n-th squarefree number.

Original entry on oeis.org

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

Views

Author

Gus Wiseman, May 09 2024

Keywords

Examples

			The 12th squarefree number is 17, with binary expansion (1,0,0,0,1), so a(12) = 3.
		

Crossrefs

Positions of first appearances are A372473.
Restriction of A023416 to A005117.
For prime instead of squarefree we have A035103, ones A014499, bits A035100.
Counting 1's instead of 0's (so restrict A000120 to A005117) gives A372433.
For binary length we have A372475, run-lengths A077643.
A030190 gives binary expansion, reversed A030308.
A048793 lists positions of ones in reversed binary expansion, sum A029931.
A371571 lists positions of zeros in binary expansion, sum A359359.
A371572 lists positions of ones in binary expansion, sum A230877.
A372515 lists positions of zeros in reversed binary expansion, sum A359400.

Programs

Formula

a(n) = A023416(A005117(n)).
a(n) + A372433(n) = A070939(A005117(n)) = A372475(n).

A059867 Number of irreducible representations of the symmetric group S_n that have odd degree.

Original entry on oeis.org

1, 2, 2, 4, 4, 8, 8, 8, 8, 16, 16, 32, 32, 64, 64, 16, 16, 32, 32, 64, 64, 128, 128, 128, 128, 256, 256, 512, 512, 1024, 1024, 32, 32, 64, 64, 128, 128, 256, 256, 256, 256, 512, 512, 1024, 1024, 2048, 2048, 512, 512, 1024, 1024, 2048, 2048, 4096, 4096, 4096, 4096
Offset: 1

Views

Author

Noam Katz (noamkj(AT)hotmail.com), Feb 28 2001

Keywords

Comments

Ayyer et al. (2016, 2016) obtain this sequence (which they call "odd partitions") as the number of partitions of n such that the dimension of the corresponding irreducible representation of S_n is odd.

Examples

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

Crossrefs

Cf. A000120, A029930; A029931: the bisection of log_2(a(n)); A073642, A089248.

Programs

  • Mathematica
    a[n_] := 2^Total[Flatten[Position[Reverse[IntegerDigits[n, 2]], 1]] - 1];
    Array[a, 60] (* Jean-François Alcover, Jul 21 2018 *)
  • PARI
    A059867(n)={my(d=binary(n));prod(k=1,#d,if(d[#d+1-k],2^(k-1),1));} \\ Joerg Arndt, Apr 29 2013
    
  • PARI
    a(n) = {my(b = Vecrev(binary(n))); 2^sum(k=1, #b, (k-1)*b[k]);} \\ Michel Marcus, Jan 11 2016
  • Sage
    def A059867(n) : dig = n.digits(2); return prod(2^n for n in range(len(dig)) if dig[n]==1) # Eric M. Schmidt, Apr 27 2013
    

Formula

If n = sum 2^e[i] in binary, then the number of odd degree irreducible complex representations of S_n is 2^sum e[i]. In words: write n in binary and take the product of the powers of 2 that appear.
G.f.: prod(k>=0, 1 + 2^k * x^2^k). a(n) = 2^A073642(n). - Ralf Stephan, Jun 02 2003
a(1)=1, a(2n) = 2^e1(n)*a(n), a(2n+1) = a(2n), where e1(n) = A000120(n). - Ralf Stephan, Jun 19 2003

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Mar 27 2001

A271410 LCM of exponents in binary expansion of 2n.

Original entry on oeis.org

1, 1, 2, 2, 3, 3, 6, 6, 4, 4, 4, 4, 12, 12, 12, 12, 5, 5, 10, 10, 15, 15, 30, 30, 20, 20, 20, 20, 60, 60, 60, 60, 6, 6, 6, 6, 6, 6, 6, 6, 12, 12, 12, 12, 12, 12, 12, 12, 30, 30, 30, 30, 30, 30, 30, 30, 60, 60, 60, 60, 60, 60, 60, 60, 7, 7, 14, 14, 21, 21, 42
Offset: 0

Views

Author

Peter Kagey, Apr 11 2016

Keywords

Examples

			a(2) = lcm(2) = 2 because 2*2 = 2^2;
a(3) = lcm(1, 2) = 2 because 2*3 = 2^1 + 2^2;
a(7) = lcm(1, 2, 3) = 6 because 2*7 = 2^3 + 2^2 + 2^1.
		

Crossrefs

Programs

  • Mathematica
    lcm[n_]:=Module[{idn2=IntegerDigits[n,2]},LCM@@Pick[Reverse[Range[ Length[ idn2]]], idn2,1]]; Join[{1},Array[lcm,100]] (* Harvey P. Dale, Jan 24 2019 *)
  • PARI
    a(n) = my(ve = select(x->x==1, Vecrev(binary(2*n)), 1)); lcm(vector(#ve, k, ve[k]-1)); \\ Michel Marcus, Apr 12 2016
    
  • PARI
    a(n)=lcm(Vec(select(x->x, Vecrev(binary(n)), 1))) \\ Charles R Greathouse IV, Apr 12 2016
    
  • Python
    from math import lcm
    def A271410(n): return lcm(*(i for i, b in enumerate(bin(n)[:1:-1],1) if b == '1')) # Chai Wah Wu, Dec 12 2022

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)

A372515 Irregular triangle read by rows where row n lists the positions of zeros in the reversed binary expansion of n.

Original entry on oeis.org

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

Views

Author

Gus Wiseman, May 26 2024

Keywords

Examples

			The reversed binary expansion of 100 is (0,0,1,0,0,1,1), with zeros at positions {1,2,4,5}, so row 100 is (1,2,4,5).
Triangle begins:
   1:
   2: 1
   3:
   4: 1 2
   5: 2
   6: 1
   7:
   8: 1 2 3
   9: 2 3
  10: 1 3
  11: 3
  12: 1 2
  13: 2
  14: 1
  15:
  16: 1 2 3 4
		

Crossrefs

Row lengths are A023416, partial sums A059015.
For ones instead of zeros we have A048793, lengths A000120, sums A029931.
Row sums are A359400, non-reversed A359359.
Same as A368494 but with empty rows () instead of (0).
A003714 lists numbers with no successive binary indices.
A030190 gives binary expansion, reverse A030308.
A039004 lists the positions of zeros in A345927.

Programs

  • Mathematica
    Table[Join@@Position[Reverse[IntegerDigits[n,2]],0],{n,30}]

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

Original entry on oeis.org

0, 1, 1, 5, 2, 8, 9, 18, 5, 15, 16, 29, 19, 34, 36, 54, 12, 30, 31, 52, 34, 57, 59, 85, 41, 68, 70, 100, 75, 107, 110, 145, 27, 61, 62, 99, 65, 104, 106, 148, 72, 115, 117, 163, 122, 170, 173, 224, 87, 138, 140, 194, 145, 201, 204, 263, 156, 216, 219, 282, 226
Offset: 0

Views

Author

Brian Reed, Oct 21 2011

Keywords

Examples

			a(5) = (5-2) + (5-0) = 8 because 5 = 2^2 + 2^0.
a(7) = (7-2) + (7-1) + (7-0) = 18 because 7 = 2^2 + 2^1 + 2^0.
		

Crossrefs

Programs

  • MATLAB
    % n is number of terms to be computed:
    function [B] = predAddition(n)
       for i = 0:n
          k = i;
          c = 0;
          s = 0;
          while(k ~= 0)
             if ((i - c) >= 0)
                s = s + mod(k,2)*(i-c);
             end
             c = c + 1;
             k = (k - mod(k,2))/2;
          end
          B(i+1) = s;
       end
    end
  • Maple
    b:= (n, k)-> `if`(n=0, 0, k*(n mod 2)+b(floor(n/2), k-1)):
    a:= n-> b(n, n):
    seq(a(n), n=0..100);  # Alois P. Heinz, Oct 25 2011

Formula

a(n) = n*A000120(n) - A073642(n). - Franklin T. Adams-Watters, Oct 22 2011
a(n) = b(n,n) with b(0,k) = 0, b(n,k) = k*(n mod 2) + b(floor(n/2),k-1) for n>0. - Alois P. Heinz, Oct 25 2011

A198193 Replace 2^k in the binary representation of n with n+(k-L) where L = floor(log(n)/log(2)).

Original entry on oeis.org

0, 1, 2, 5, 4, 8, 11, 18, 8, 15, 18, 28, 23, 35, 39, 54, 16, 30, 33, 50, 38, 57, 61, 83, 47, 70, 74, 100, 81, 109, 114, 145, 32, 61, 64, 96, 69, 103, 107, 144, 78, 116, 120, 161, 127, 170, 175, 221, 95, 141, 145, 194, 152, 203, 208, 262, 165, 220, 225, 283
Offset: 0

Views

Author

Brian Reed, Oct 26 2011

Keywords

Comments

That is, if n = 2^a + 2^b + 2^c + ... then a(n) = (n+(a-L)) + (n+(b-L)) + (n+(c-L)) + ...).

Examples

			a(4) = (4+(2-2)) = 4 because int(log(4)/log(2)) = 2 and 4 = 2^2.
a(6) = (6+(2-2)) + (6+(1-2)) = 11 because int(log(6)/log(2)) = 2 and 6 = 2^2 + 2^1.
		

Crossrefs

Programs

  • MATLAB
    % n is number of terms to be computed, b is the base. The examples all use b=2:
    function [V] = revAddition(n,b)
       for i = 0:n
          k = i;
          if (i > 0)
             l = floor(log(i)/log(b));
          end
          s = 0;
          while(k ~= 0)
             if ((i-l) >= 0)
                s = s + mod(k,b)*(i-l);
             end
             l = l - 1;
             k = (k - mod(k,b))/b;
          end
          V(i+1) = s;
       end
    end
    
  • Maple
    read("transforms") :
    A198193 := proc(n)
            (n-A000523(n))*wt(n)+A073642(n) ;
    end proc:
    seq(A198193(n),n=0..20) ; # R. J. Mathar, Nov 17 2011
  • Mathematica
    Table[b = Reverse[IntegerDigits[n, 2]]; L = Length[b] - 1; Sum[b[[k]] (n + k - 1 - L), {k, Length[b]}], {n, 0, 59}] (* T. D. Noe, Nov 01 2011 *)
  • Python
    def A198193(n): return sum((n-i)*int(j) for i,j in enumerate(bin(n)[2:])) # Chai Wah Wu, Mar 13 2021

Formula

Let L = A000523(n), then a(n) = (n-L)*A000120(n) + A073642(n).

A309983 Numbers n resulting from adding the exponents of 2 associated with the "1" terms of their binary representation and subtracting the exponents of 2 associated with the "0" terms of their binary representation.

Original entry on oeis.org

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

Views

Author

Mark Povich, Aug 26 2019

Keywords

Examples

			When n=18, a(n) = 0. Convert 18 to binary (=10010). The 1s are in the 2^4 place and the 2^1 place. Take those exponents and add them (=5). The 0's are in the 2^3, 2^2, and 2^0 places. Subtract those exponents (=5) from the previous sum to get 0.
When n=26, a(n) = 6. Convert 26 to binary (=11010). The 1s are in the 2^4, 2^3, and 2^1 places. Take those exponents and add them (=8). The 0's are in the 2^2 and 2^0 places. Subtract those exponents (=2) from the previous sum to get 6.
		

Crossrefs

Cf. A073642 (when only 1 digits are considered).

Programs

  • Mathematica
    a[n_] := Block[{d = Reverse@IntegerDigits[n, 2]}, Total@ Flatten@ {Position[d, 1]-1, 1-Position[d, 0]}]; Array[a, 74] (* Giovanni Resta, Aug 26 2019 *)
  • PARI
    a(n) = {my(b=Vecrev(binary(n))); my(v1 = Vec(select(x->(x==1), b, 1))); my(v0 = Vec(select(x->(x==0), b, 1))); (vecsum(v1) - #v1) - (vecsum(v0) - #v0);} \\ Michel Marcus, Aug 26 2019
    
  • Python
    def dec_to_bin(dec_num): #define a function that converts decimal to binary.
        bin_num = 0
        power = 0
        while dec_num > 0:
            bin_num += 10 ** power * (dec_num % 2)
            dec_num //= 2
            power += 1
        return bin_num
    def rev_bin(n):
        return list(reversed(str(dec_to_bin(n))))
    n = 18
    neg = [pos for pos, num in enumerate(rev_bin(n)) if num == "0"]
    posi = [pos for pos, num in enumerate(rev_bin(n)) if num == "1"]
    print(sum(posi)-sum(neg))
    
  • Python
    def A309983(n):
        r, i = 0, 0
        while n > 0:
            d, n = n%2, n//2
            if d == 1:
                r = r+i
            else:
                r = r-i
            i = i+1
        return r # A.H.M. Smeets, Oct 07 2019
Previous Showing 11-20 of 22 results. Next