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-2 of 2 results.

A126441 Tabular arrangement of the natural numbers: the row on which any nonzero term a(n) appears in is A053645(a(n))=A053645(n+1), and the column is A161511(a(n)). Table is presented by columns with 2^{k-1} items in column k, unused positions are filled with 0's.

Original entry on oeis.org

1, 2, 3, 4, 5, 0, 7, 8, 9, 6, 11, 0, 0, 0, 15, 16, 17, 10, 19, 0, 13, 0, 23, 0, 0, 0, 0, 0, 0, 0, 31, 32, 33, 18, 35, 12, 21, 14, 39, 0, 0, 0, 27, 0, 0, 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 64, 65, 34, 67, 20, 37, 22, 71, 0, 25, 0, 43, 0, 29, 0, 79, 0, 0, 0, 0, 0, 0, 0, 55, 0, 0
Offset: 0

Views

Author

Alford Arnold, Jan 19 2007

Keywords

Comments

Note: 1 might be a more natural starting offset for this sequence, although the identities concerning A053645 and A161511 would have to be changed. - Antti Karttunen, Oct 12 2009.
This can be regarded as an arrangement of the partitions, indexed by position in A125106. The partitions in a given row all have the same remaining partition when the largest part is removed; specifically, the partition indexed by the row number in A125106 (with row 0 having the empty partition remaining).
The first value on row n is A004760(n+1). The second value on each row is A004760(n+1) plus A062383(n); subsequent values increase by ever enlarging powers of two. Or equivalently, each subsequent value on the row after the first nonzero value is given by A004754(previous value on the same row).
A055941(r) tells how many terms the row r (>= 0) has been shifted rightward from its "natural position", i.e. with how many zeros that row has been prepended.
The number of (nonzero) entries in column k is A000041(k).

Examples

			The largest power of 2 <= 6 is 4, 6 - 4 = 2, so 6 is in row 2. By A125106, 6 corresponds to the partition [2^2], total 4, so 6 goes in column 4. Thus T(2,4) = 6.
The table begins:
1.2.4..8.16.32.64.128.256.512.1024
..3.5..9.17.33.65.129.257.513.1025
.......6.10.18.34..66.130.258..514
....7.11.19.35.67.131.259.515.1027
............12.20..36..68.132..260
.........13.21.37..69.133.261..517
............14.22..38..70.134..262
......15.23.39.71.135.263.519.1031
...................24..40..72..136
...............25..41..73.137..265
...................26..42..74..138
............27.43..75.139.267..523
.......................28..44...76
...............29..45..77.141..269
...................30..46..78..142
.........31.47.79.143.271.527.1039
...........................48...80
.......................49..81..145
...........................50...82
...................51..83.147..275
		

Crossrefs

Cf. A125106, A053645, A000041, A004760, A062383, A000079 (column lengths).
A053645(a(A166274(n))) = A053645(1+A166274(n)) for all n>=1.
Positions of zeros: A166275, this sequence without zeros: A161924. A161920(n) gives the position of the first nonzero term on the row n-1.

Programs

  • Mathematica
    columns = 7; row[n_] := n-2^Floor[Log2[n]]; col[0] = 0; col[n_] := If[EvenQ[n], col[n/2] + DigitCount[n/2, 2, 1], col[(n-1)/2]+1]; Clear[T]; T[, ] = 0; Do[T[row[k], col[k]] = k, {k, 1, 2^columns}]; Table[T[n-1, k], {k, 1, columns}, {n, 1, 2^(k-1)}] // Flatten (* Jean-François Alcover, Sep 09 2017 *)

Extensions

Edited by Franklin T. Adams-Watters, Jan 23 2007
Further edited and Scheme-code added by Antti Karttunen, Oct 12 2009

A055941 a(n) = Sum_{j=0..k-1} (i(j) - j) where n = Sum_{j=0..k-1} 2^i(j).

Original entry on oeis.org

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

Views

Author

Anno Siegel (siegel(AT)zrz.tu-berlin.de), Jul 18 2000

Keywords

Comments

Used to calculate number of subspaces of Zp^n where Zp is field of integers mod p.
Consider a square matrix A and call it special if (0) A is an upper triangular matrix, (1) a nonzero column of A has a 1 on the main diagonal and (2) if a row has a 1 on the main diagonal then this is the only nonzero element in that row.
If the diagonal of a special matrix is given (it can only contain 0's and 1's), many of the fields of A are determined by (0), (1) and (2). The number of fields that can be freely chosen while still satisfying (0), (1) and (2) is a(n), where n is the diagonal, read as a binary number with least significant bit at upper left.
a(n) is also the minimum number of adjacent bit swap operations required to pack all the ones of n to the right. - Philippe Beaudoin, Aug 19 2014
From Rakesh Khanna A, Aug 06 2021: (Start)
a(n) is also the area under the curve formed from the binary representation of n where each 0-bit corresponds to an increase of one unit along the x-axis and each 1-bit corresponds to an increase of one unit along the y-axis.
E.g., n = 20 = 10100_2 and the area under the curve shown below is a(n) = 5.
1 0 1 0 0
\ \ \ \ \ |
\ \ \+----+----+
\ \ | |
\+----+ +
| |
----+----+----+----+
(End)

Examples

			20 = 2^4 + 2^2, thus a(20) = (2-0) + (4-1) = 5.
		

References

  • A. Siegel, Linear Aspects of Boolean Functions, 1999 (unpublished).

Crossrefs

Programs

  • Mathematica
    b[n_] := b[n] = If[n == 0, 0, If[EvenQ[n], b[n/2] + DigitCount[n/2, 2, 1], b[(n - 1)/2] + 1]];
    a[n_] := b[n] - DigitCount[n, 2, 1];
    Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Sep 23 2018 *)
  • PARI
    a(n) = {my(b=binary(n)); nb = 0; for (i=1, #b-1, if (b[i], nb += sum(j=i+1, #b, !b[j]));); nb;} \\ Michel Marcus, Aug 12 2014
    
  • Python
    def A055941(n):
        s = bin(n)[2:]
        return sum(s[i:].count('0') for i,d in enumerate(s,start=1) if d == '1')
    # Chai Wah Wu, Sep 07 2014

Formula

a(n) = Sum (total number of 0-bits to the right of 1-bit) over all 1-bits of n.
a(n) = A161511(n) - A000120(n) = A161920(n+1) - 1 - A029837(n+1).
a(n) = 0 if A241816(n) = n; 1 + a(A241816(n)) otherwise. - Philippe Beaudoin, Aug 19 2014

Extensions

Edited and extended by Antti Karttunen, Oct 12 2009
Showing 1-2 of 2 results.