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

A346633 Sum of even-indexed parts (even bisection) of the n-th composition in standard order.

Original entry on oeis.org

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

Views

Author

Gus Wiseman, Aug 01 2021

Keywords

Comments

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.

Examples

			Composition number 741 in standard order is (2,1,1,3,2,1), so a(741) = 1 + 3 + 1 = 5.
		

Crossrefs

Including odd-indexed parts gives A029837.
Subtracting from the odd version gives A124754.
Positions of zeros are A131577.
The odd-indexed version is A209281(n+1).
The version for prime indices is A346698 (reverse: A346700).
A000120 and A080791 count binary digits 1 and 0, with difference A145037.
A011782 counts compositions.
A056239 adds up prime indices, row sums of A112798.
A097805 counts compositions by alternating (or reverse-alternating) sum.
A316524 gives the alternating sum of prime indices (reverse: A344616).
A325534 counts separable partitions, ranked by A335433.
A325535 counts inseparable partitions, ranked by A335448.
A345197 counts compositions by sum, length, and alternating sum.

Programs

  • Mathematica
    stc[n_]:=Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
    Table[Total[Last/@Partition[Append[stc[n],0],2]],{n,0,100}]

Formula

a(n) = (A029837(n) - A124754(n))/2.
a(n) = A029837(n) - A209281(n + 1).
a(n) = A124754(n) + A209281(n + 1).

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).

A372541 Least k such that the k-th squarefree number has exactly n ones in its binary expansion.

Original entry on oeis.org

1, 3, 6, 11, 20, 60, 78, 157, 314, 624, 1245, 3736, 4982, 9962, 19920, 39844, 79688, 239046, 318725, 956194, 1912371, 2549834, 5099650, 15298984, 20398664, 40797327, 81594626, 163189197, 326378284, 979135127, 1305513583, 2611027094, 5222054081, 10444108051
Offset: 0

Views

Author

Gus Wiseman, May 09 2024

Keywords

Examples

			The squarefree numbers A005117(a(n)) together with their binary expansions and binary indices begin:
       1:                   1 ~ {1}
       3:                  11 ~ {1,2}
       7:                 111 ~ {1,2,3}
      15:                1111 ~ {1,2,3,4}
      31:               11111 ~ {1,2,3,4,5}
      95:             1011111 ~ {1,2,3,4,5,7}
     127:             1111111 ~ {1,2,3,4,5,6,7}
     255:            11111111 ~ {1,2,3,4,5,6,7,8}
     511:           111111111 ~ {1,2,3,4,5,6,7,8,9}
    1023:          1111111111 ~ {1,2,3,4,5,6,7,8,9,10}
    2047:         11111111111 ~ {1,2,3,4,5,6,7,8,9,10,11}
    6143:       1011111111111 ~ {1,2,3,4,5,6,7,8,9,10,11,13}
    8191:       1111111111111 ~ {1,2,3,4,5,6,7,8,9,10,11,12,13}
   16383:      11111111111111 ~ {1,2,3,4,5,6,7,8,9,10,11,12,13,14}
   32767:     111111111111111 ~ {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
   65535:    1111111111111111 ~ {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}
  131071:   11111111111111111 ~ {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17}
		

Crossrefs

Positions of firsts appearances in A372433.
Counting zeros instead of ones gives A372473, firsts in A372472.
For prime instead of squarefree we have A372517, firsts of A014499.
Counting bits (length) gives A372540, firsts of A372475, runs A077643.
A000120 counts ones in binary expansion (binary weight), zeros A080791.
A005117 lists squarefree numbers.
A030190 gives binary expansion, reversed A030308.
A048793 lists positions of ones in reversed binary expansion, sum A029931.
A145037, A097110 count ones minus zeros, for primes A372516, A177796.
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

  • Mathematica
    nn=10000;
    spnm[y_]:=Max@@NestWhile[Most,y,Union[#]!=Range[0,Max@@#]&];
    dcs=DigitCount[Select[Range[nn],SquareFreeQ],2,1];
    Table[Position[dcs,i][[1,1]],{i,spnm[dcs-1]}]
  • Python
    from math import isqrt
    from itertools import count
    from sympy import factorint, mobius
    from sympy.utilities.iterables import multiset_permutations
    def A372541(n):
        if n==0: return 1
        for l in count(n):
            m = 1<Chai Wah Wu, May 10 2024

Extensions

a(23)-a(33) from Chai Wah Wu, May 10 2024

A372516 Number of ones minus number of zeros in the binary expansion of the n-th prime number.

Original entry on oeis.org

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

Views

Author

Gus Wiseman, May 13 2024

Keywords

Comments

Absolute value is A177718.

Examples

			The binary expansion of 83 is (1,0,1,0,0,1,1), and 83 is the 23rd prime, so a(23) = 4 - 3 = 1.
		

Crossrefs

The sum instead of difference is A035100, firsts A372684 (primes A104080).
The negative version is A037861(A000040(n)).
Restriction of A145037 to the primes.
The unsigned version is A177718.
- Positions of zeros are A177796, indices of the primes A066196.
- Positions of positive terms are indices of the primes A095070.
- Positions of negative terms are indices of the primes A095071.
- Positions of negative ones are A372539, indices of the primes A095072.
- Positions of ones are A372538, indices of the primes A095073.
- Positions of nonnegative terms are indices of the primes A095074.
- Positions of nonpositive terms are indices of the primes A095075.
A000120 counts ones in binary expansion (binary weight), zeros A080791.
A030190 gives binary expansion, reversed A030308.
A035103 counts zeros in binary expansion of primes, firsts A372474.
A048793 lists binary indices, reverse A272020, sum A029931.
A070939 gives length of binary expansion.
A101211 lists run-lengths in binary expansion, row-lengths A069010.
A372471 lists the binary indices of each prime.

Programs

  • Mathematica
    Table[DigitCount[Prime[n],2,1]-DigitCount[Prime[n],2,0],{n,100}]
    DigitCount[#,2,1]-DigitCount[#,2,0]&/@Prime[Range[100]] (* Harvey P. Dale, May 09 2025 *)

Formula

a(n) = A000120(A000040(n)) - A080791(A000040(n)).
a(n) = A014499(n) - A035103(n).
a(n) = A145037(A000040(n))

A360099 To get A(n,k), replace 0's in the binary expansion of n with (-1) and interpret the result in base k; square array A(n,k), n>=0, k>=0, read by antidiagonals.

Original entry on oeis.org

0, 0, 1, 0, 1, -1, 0, 1, 0, 1, 0, 1, 1, 2, -1, 0, 1, 2, 3, -1, 1, 0, 1, 3, 4, 1, 1, -1, 0, 1, 4, 5, 5, 3, 1, 1, 0, 1, 5, 6, 11, 7, 5, 3, -1, 0, 1, 6, 7, 19, 13, 11, 7, -2, 1, 0, 1, 7, 8, 29, 21, 19, 13, 1, 0, -1, 0, 1, 8, 9, 41, 31, 29, 21, 14, 3, 0, 1, 0, 1, 9, 10, 55, 43, 41, 31, 43, 16, 5, 2, -1
Offset: 0

Views

Author

Alois P. Heinz, Jan 25 2023

Keywords

Comments

The empty bit string is used as binary expansion of 0, so A(0,k) = 0.

Examples

			Square array A(n,k) begins:
   0,  0, 0,  0,  0,   0,   0,   0,   0,   0,   0, ...
   1,  1, 1,  1,  1,   1,   1,   1,   1,   1,   1, ...
  -1,  0, 1,  2,  3,   4,   5,   6,   7,   8,   9, ...
   1,  2, 3,  4,  5,   6,   7,   8,   9,  10,  11, ...
  -1, -1, 1,  5, 11,  19,  29,  41,  55,  71,  89, ...
   1,  1, 3,  7, 13,  21,  31,  43,  57,  73,  91, ...
  -1,  1, 5, 11, 19,  29,  41,  55,  71,  89, 109, ...
   1,  3, 7, 13, 21,  31,  43,  57,  73,  91, 111, ...
  -1, -2, 1, 14, 43,  94, 173, 286, 439, 638, 889, ...
   1,  0, 3, 16, 45,  96, 175, 288, 441, 640, 891, ...
  -1,  0, 5, 20, 51, 104, 185, 300, 455, 656, 909, ...
		

Crossrefs

Columns k=0-6, 10 give: A062157, A145037, A006257, A147991, A147992, A153777, A147993, A359925.
Rows n=0-10 give: A000004, A000012, A023443, A000027(k+1), A165900, A002061, A165900(k+1), A002061(k+1), A083074, A152618, A062158.
Main diagonal gives A360096.

Programs

  • Maple
    A:= proc(n, k) option remember; local m;
         `if`(n=0, 0, k*A(iquo(n, 2, 'm'), k)+2*m-1)
        end:
    seq(seq(A(n, d-n), n=0..d), d=0..12);
    # second Maple program:
    A:= (n, k)-> (l-> add((2*l[i]-1)*k^(i-1), i=1..nops(l)))(Bits[Split](n)):
    seq(seq(A(n, d-n), n=0..d), d=0..12);

Formula

G.f. for column k satisfies g_k(x) = k*(x+1)*g_k(x^2) + x/(1+x).
A(n,k) = k*A(floor(n/2),k)+2*(n mod 2)-1 for n>0, A(0,k)=0.
A(n,k) mod 2 = A057427(n) if k is even.
A(n,k) mod 2 = A030300(n) if k is odd and n>=1.
A(2^(n+1),1) + n = 0.

A346702 The a(n)-th composition in standard order is the odd bisection of the n-th composition in standard order.

Original entry on oeis.org

0, 1, 2, 1, 4, 2, 1, 3, 8, 4, 2, 5, 1, 3, 6, 3, 16, 8, 4, 9, 2, 5, 10, 5, 1, 3, 6, 3, 12, 6, 3, 7, 32, 16, 8, 17, 4, 9, 18, 9, 2, 5, 10, 5, 20, 10, 5, 11, 1, 3, 6, 3, 12, 6, 3, 7, 24, 12, 6, 13, 3, 7, 14, 7, 64, 32, 16, 33, 8, 17, 34, 17, 4, 9, 18, 9, 36, 18
Offset: 0

Views

Author

Gus Wiseman, Aug 12 2021

Keywords

Comments

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.
a(n) is the row number in A066099 of the odd bisection of the n-th row of A066099.

Examples

			Composition number 741 in standard order is (2,1,1,3,2,1), with odd bisection (2,1,2), which is composition number 22 in standard order, hence a(741) = 22.
		

Crossrefs

Length of the a(n)-th standard composition is A000120(n)/2 rounded up.
Positions of 1's are A003945.
Positions of 2's (and zero) are A083575.
Sum of the a(n)-th standard composition is A209281(n+1).
Positions of first appearances are A290259.
The version for prime indices is A346703.
The version for even bisection is A346705, with sums A346633.
A000120 and A080791 count binary digits 1 and 0, with difference A145037.
A011782 counts compositions.
A029837 gives length of binary expansion.
A097805 counts compositions by alternating (or reverse-alternating) sum.
A345197 counts compositions by sum, length, and alternating sum.

Programs

  • Mathematica
    Table[Total[2^Accumulate[Reverse[First/@Partition[Append[ Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse,0],2]]]]/2,{n,0,100}]

Formula

A029837(a(n)) = A209281(n).

A300562 Condensed deep factorization of n, in binary. (Remove all trailing 0's and one trailing 1 from A300560.)

Original entry on oeis.org

0, 1, 11100, 111, 111100100, 110011100, 111110000, 1111100, 1110011, 1100111100100, 1111100100100, 1111000011100, 1110011100100, 1100111110000, 11100100111100100, 11111, 1111110000100, 11001110011, 1111110010000, 11110000111100100
Offset: 1

Views

Author

M. F. Hasler, Mar 08 2018

Keywords

Comments

The binary representation of the deep factorization of n, A300560, is obtained by recursively replacing any factor prime(i)^e_i by the expression [i [e_i]], and finally taking '[' and ']' as binary digits 1 and 0.
This always ends in trailing 0's which can be safely removed without loss of information; then there is a final binary digit 1 that can also be dropped. The result is a(n), in binary, equal to A300563(n) when converted to decimal.
The initial a(1) = 0 results from the empty factorization of 1.
To reconstruct the deep factorization of n > 1, append a digit 1 and then as many 0's (namely: A145037(a(n))+1) as to have the same number of as 1's.

Examples

			The first term a(1) = 0 represents, by convention, the empty factorization of the number 1.
To reconstruct the full deep factorization A300560(n), append a digit 1 and then as many 0's as to balance the number of 1's:
a(2) = 1, append a 1 => 11; append two 0's => 1100 = A300560(2).
a(3) = 11100, append a 1 => 111001; append two 0's => 11100100 = A300560(3).
a(4) = 111, append a 1 => 1111; append four 0's => 11110000 = A300560(4).
		

Crossrefs

Programs

Formula

a(n) = A007088(A300563(n)), see there for an expression in terms of A300560. - M. F. Hasler, Mar 16 2018

A300563 Condensed deep factorization of n, A300562(n) written in decimal: floor of odd part of A300561(n) divided by 2.

Original entry on oeis.org

0, 1, 28, 7, 484, 412, 496, 124, 115, 6628, 7972, 7708, 7396, 6640, 117220, 31, 8068, 1651, 8080, 123364, 117232, 106276, 7792, 127516, 1939, 105700, 1852, 123376, 118564, 1690084, 129316, 2020, 1875748, 106372, 1985008, 30835, 127204, 106384, 1875172, 2040292, 124708
Offset: 1

Views

Author

M. F. Hasler, Mar 08 2018

Keywords

Comments

The binary representation of the deep factorization of n, A300560, is obtained by recursively replacing any factor prime(i)^e_i by the expression [i [e_i]], and finally taking '[' and ']' as binary digits 1 and 0.
This always ends in trailing 0's which can be safely removed without loss of information; then there is a final binary digit 1 that can also be dropped. The result is A300562(n) in binary, equal to a(n) when converted to decimal.
The initial a(1) = 0 results from the empty factorization of 1.
To reconstruct the deep factorization of n > 1, take a(n)*2+1, multiply by 2^A145037(a(n)*2+1) (i.e., number of bits = 1 minus number of bits = 0), and write it in binary.

Examples

			The first term a(1) = 0 represents, by convention, the empty factorization of the number 1.
The binary-coded deep factorization is restored as follows (and a(n) calculated from this going the opposite direction):
a(2) = 1, append a bit 1 or do 1 X 2 + 1 = 3 = 11[2]. This has 2 bits 1, no bit 0 so append 2 bits 0 => A300560(2) = 1100 in binary, or 12 = A300561(2) in decimal.
a(3) = 28 = 11100[2], append a bit 1 or do 28 X 2 + 1 = 57 = 111001[2]. This has 4 bits 1 and 2 bits 0, so append two more of the latter => A300560(3) = 11100100 in binary or A300561(3) = 228 in decimal.
a(4) = 7 = 111[2], append a bit 1 or do 7 X 2 + 1 = 15 = 1111[2]. This has 4 bits 1 and no bit 0 so append 4 0's => 11110000 = A300560(4) or A300561(4) = 240 in decimal.
See A300560 for conversion of this binary coding of the deep factorization into the ordinary factorization.
		

Crossrefs

Programs

Formula

a(n) = A004526(A000265(A300561(n))), where A004526 = floor(./2) and A000265(x) = x/2^A007814(x) is the odd part of x, A007814 is 2-adic valuation. - M. F. Hasler, Mar 16 2018

A301336 a(n) = total number of 1's minus total number of 0's in binary expansions of 0, ..., n.

Original entry on oeis.org

-1, 0, 0, 2, 1, 2, 3, 6, 4, 4, 4, 6, 6, 8, 10, 14, 11, 10, 9, 10, 9, 10, 11, 14, 13, 14, 15, 18, 19, 22, 25, 30, 26, 24, 22, 22, 20, 20, 20, 22, 20, 20, 20, 22, 22, 24, 26, 30, 28, 28, 28, 30, 30, 32, 34, 38, 38, 40, 42, 46, 48, 52, 56, 62, 57, 54, 51, 50, 47, 46, 45, 46, 43, 42, 41, 42
Offset: 0

Views

Author

Ilya Gutkovskiy, Mar 28 2018

Keywords

Examples

			+---+-----+---+---+---+---+------------+
| n | bin.|1's|sum|0's|sum|    a(n)    |
+---+-----+---+---+---+---+------------+
| 0 |   0 | 0 | 0 | 1 | 1 | 0 - 1 =-1  |
| 1 |   1 | 1 | 1 | 0 | 1 | 1 - 1 = 0  |
| 2 |  10 | 1 | 2 | 1 | 2 | 2 - 2 = 0  |
| 3 |  11 | 2 | 4 | 0 | 2 | 4 - 2 = 2  |
| 4 | 100 | 1 | 5 | 2 | 4 | 5 - 4 = 1  |
| 5 | 101 | 2 | 7 | 1 | 5 | 7 - 5 = 2  |
| 6 | 110 | 2 | 9 | 1 | 6 | 9 - 6 = 3  |
+---+-----+---+---+---+---+------------+
bin. - n written in base 2;
1's - number of 1's in binary expansion of n;
0's - number of 0's in binary expansion of n;
sum - total number of 1's (or 0's) in binary expansions of 0, ..., n.
		

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; `if`(n=0, -1,
          a(n-1)+add(2*i-1, i=Bits[Split](n)))
        end:
    seq(a(n), n=0..75);  # Alois P. Heinz, Nov 11 2024
  • Mathematica
    Accumulate[DigitCount[Range[0, 75], 2, 1] - DigitCount[Range[0, 75], 2, 0]]
  • Python
    def A301336(n):
        return sum(2*bin(i).count('1')-len(bin(i))+2 for i in range(n+1)) # Chai Wah Wu, Sep 03 2020
    
  • Python
    def A301336(n): return (n+1)*((n.bit_count()<<1)-(t:=(n+1).bit_length()))+(1<>j)-(r if n<<1>=m*(r:=k<<1|1) else 0)) for j in range(1,n.bit_length()+1))-2 # Chai Wah Wu, Nov 11 2024

Formula

G.f.: -1/(1 - x) + (1/(1 - x)^2)*Sum_{k>=0} x^(2^k)*(1 - x^(2^k))/(1 + x^(2^k)).
a(n) = A000788(n) - A059015(n).
a(n) = A268289(n) - 1.
a(A000079(n)) = A000295(n).

A145057 First differences of A031443.

Original entry on oeis.org

2, 7, 1, 2, 23, 2, 1, 3, 1, 2, 5, 1, 2, 4, 79, 4, 2, 1, 5, 2, 1, 3, 1, 2, 7, 2, 1, 3, 1, 2, 5, 1, 2, 4, 11, 2, 1, 3, 1, 2, 5, 1, 2, 4, 9, 1, 2, 4, 8, 287, 8, 4, 2, 1, 9, 4, 2, 1, 5, 2, 1, 3, 1, 2, 11, 4, 2, 1, 5, 2, 1, 3, 1, 2, 7, 2, 1, 3, 1, 2, 5, 1, 2, 4, 15, 4, 2, 1, 5, 2, 1, 3, 1, 2, 7, 2, 1, 3, 1, 2, 5, 1
Offset: 1

Views

Author

Reikku Kulon, Sep 30 2008

Keywords

Comments

a(n) equals the differences between k where A145037(k) equals zero. - Reikku Kulon, Oct 02 2008

Examples

			a(3) = A031443(3) - A031443(3-1) = 10 - 9 = 1. - _David A. Corneth_, Apr 26 2022
		

Crossrefs

Programs

  • Mathematica
    Differences[Select[Range[0, 1000], SameQ@@DigitCount[#, 2] &]] (* Paolo Xausa, Nov 16 2024 *)
Previous Showing 11-20 of 25 results. Next