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.

A295989 Irregular triangle T(n, k), read by rows, n >= 0 and 0 <= k < A001316(n): T(n, k) is the (k+1)-th nonnegative number m such that n AND m = m (where AND denotes the bitwise AND operator).

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Dec 02 2017

Keywords

Comments

The (n+1)-th row has A001316(n) terms and sums to n * A001316(n) / 2.
For any n >= 0 and k such that 0 <= k < A001316(n):
- if A000120(n) > 0 then T(n, 1) = A006519(n),
- if A000120(n) > 1 then T(n, 2) = 2^A285099(n),
- if A000120(n) > 0 then T(n, A001316(n)/2 - 1) = A053645(n),
- if A000120(n) > 0 then T(n, A001316(n)/2) = 2^A000523(n),
- if A000120(n) > 0 then T(n, A001316(n) - 2) = A129760(n),
- T(n, A001316(n) - 1) = n,
- the six previous relations correspond respectively (when applicable) to the second term, the third term, the pair of central terms, the penultimate term and the last term of a row,
- T(n, k) AND T(n, A001316(n) - k - 1) = 0,
- T(n, k) + T(n, A001316(n) - k - 1) = n,
- T(n, k) = k for any k < A006519(n+1),
- A000120(T(n, k)) = A000120(k).
If we plot (n, T(n,k)) then we obtain a skewed Sierpinski triangle (see Links section).
If interpreted as a flat sequence a(n) for n >= 0:
- a(n) = 0 iff n = A006046(k) for some k >= 0,
- a(n) = 1 iff n = A006046(2*k + 1) + 1 for some k >= 0,
- a(A006046(k) - 1) = k - 1 for any k > 0.

Examples

			Triangle begins:
  0:   [0]
  1:   [0, 1]
  2:   [0, 2]
  3:   [0, 1, 2, 3]
  4:   [0, 4]
  5:   [0, 1, 4, 5]
  6:   [0, 2, 4, 6]
  7:   [0, 1, 2, 3, 4, 5, 6, 7]
  8:   [0, 8]
  9:   [0, 1, 8, 9]
  10:  [0, 2, 8, 10]
  11:  [0, 1, 2, 3, 8, 9, 10, 11]
  12:  [0, 4, 8, 12]
  13:  [0, 1, 4, 5, 8, 9, 12, 13]
  14:  [0, 2, 4, 6, 8, 10, 12, 14]
  15:  [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
		

Crossrefs

First column of array in A352909.

Programs

  • Mathematica
    A295989row[n_] := Select[Range[0, n], BitAnd[#, n-#] == 0 &];
    Array[A295989row, 25, 0] (* Paolo Xausa, Feb 24 2024 *)
  • PARI
    T(n,k) = if (k==0, 0, n%2==0, 2*T(n\2,k), k%2==0, 2*T(n\2, k\2), 2*T(n\2, k\2)+1)

Formula

For any n >= 0 and k such that 0 <= k < A001316(n):
- T(n, 0) = 0,
- T(2*n, k) = 2*T(n, k),
- T(2*n+1, 2*k) = 2*T(n, k),
- T(2*n+1, 2*k+1) = 2*T(n, k) + 1.