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.

A342697 For any number n with binary expansion Sum_{k >= 0} b(k) * 2^k, the binary expansion of a(n) is Sum_{k >= 0} floor((b(k) + b(k+1) + b(k+2))/2) * 2^k.

Original entry on oeis.org

0, 0, 0, 1, 0, 1, 3, 3, 0, 0, 2, 3, 6, 7, 7, 7, 0, 0, 0, 1, 4, 5, 7, 7, 12, 12, 14, 15, 14, 15, 15, 15, 0, 0, 0, 1, 0, 1, 3, 3, 8, 8, 10, 11, 14, 15, 15, 15, 24, 24, 24, 25, 28, 29, 31, 31, 28, 28, 30, 31, 30, 31, 31, 31, 0, 0, 0, 1, 0, 1, 3, 3, 0, 0, 2, 3, 6
Offset: 0

Views

Author

Rémy Sigrist, Mar 18 2021

Keywords

Comments

The value of the k-th bit in a(n) corresponds to the most frequent value in the bit triple starting at the k-th bit in n.

Examples

			The first terms, in decimal and in binary, are:
  n   a(n)  bin(n)  bin(a(n))
  --  ----  ------  ---------
   0     0       0          0
   1     0       1          0
   2     0      10          0
   3     1      11          1
   4     0     100          0
   5     1     101          1
   6     3     110         11
   7     3     111         11
   8     0    1000          0
   9     0    1001          0
  10     2    1010         10
  11     3    1011         11
  12     6    1100        110
  13     7    1101        111
  14     7    1110        111
  15     7    1111        111
		

Crossrefs

Programs

  • Mathematica
    A342697[n_] := Quotient[7*n - BitXor[n, 2*n, 4*n], 8];
    Array[A342697, 100, 0] (* Paolo Xausa, Aug 06 2025 *)
  • PARI
    a(n) = sum(k=0, #binary(n), ((bittest(n, k)+bittest(n, k+1)+bittest(n, k+2))>=2) * 2^k)

Formula

a(n) = 0 iff n belongs to A048715.
a(n) = floor(A048730(n)/8) = floor(A048733(n)/2). - Kevin Ryde, Mar 26 2021

A342698 For any number n with binary expansion (b(1), b(2), ..., b(k)), the binary expansion of a(n) is (floor((b(k)+b(1)+b(2))/2), floor((b(1)+b(2)+b(3))/2), ..., floor((b(k-1)+b(k)+b(1))/2)).

Original entry on oeis.org

0, 1, 1, 3, 0, 7, 7, 7, 0, 9, 5, 15, 12, 15, 15, 15, 0, 17, 1, 19, 8, 27, 15, 31, 24, 25, 29, 31, 28, 31, 31, 31, 0, 33, 1, 35, 0, 35, 7, 39, 16, 49, 21, 55, 28, 63, 31, 63, 48, 49, 49, 51, 56, 59, 63, 63, 56, 57, 61, 63, 60, 63, 63, 63, 0, 65, 1, 67, 0, 67, 7
Offset: 0

Views

Author

Rémy Sigrist, Mar 18 2021

Keywords

Comments

This sequence is a variant of A342697; here we deal with bit triples in a "cyclic" binary representation of n.

Examples

			The first terms, in decimal and in binary, are:
  n   a(n)  bin(n)  bin(a(n))
  --  ----  ------  ---------
   0     0       0          0
   1     1       1          1
   2     1      10          1
   3     3      11         11
   4     0     100          0
   5     7     101        111
   6     7     110        111
   7     7     111        111
   8     0    1000          0
   9     9    1001       1001
  10     5    1010        101
  11    15    1011       1111
  12    12    1100       1100
  13    15    1101       1111
  14    15    1110       1111
  15    15    1111       1111
		

Crossrefs

Cf. A003817, A342697, A342699 (fixed points), A342700.

Programs

  • PARI
    a(n) = my (w=#binary(n)); sum(k=0, w-1, ((bittest(n, (k-1)%w)+bittest(n, k%w)+bittest(n, (k+1)%w))>=2) * 2^k)

Formula

a(n) + A342700(n) = A003817(n).
a(n) = n iff n belongs to A342699.
Showing 1-2 of 2 results.